Commit Graph

27968 Commits

Author SHA1 Message Date
Luke Howard
87c59d1db2 export CommonCrypto SHA-384/512 implementations 2015-12-05 00:04:24 +11:00
Luke Howard
5ae1ab038c Merge pull request #121 from heimdal/lukeh/cfb8
Merging support for CFB8 in CommonCrypto (note will break support for OS X older than 10.7). CommonCrypto support for SHA-256/384 also added.
2015-12-04 23:59:48 +11:00
Luke Howard
4f9cc8feea add CommonCrypto support for SHA-384 and SHA-512 2015-12-04 23:56:12 +11:00
Luke Howard
93725f01f0 Fix broken CFB8 implementation, use CC for CFB8 2015-12-04 23:49:23 +11:00
Nicolas Williams
2cac8ca703 Use pthread_once() when available 2015-11-30 14:15:47 -06:00
Luke Howard
9e359ac98f base: Windows heim_base_once_t cleanup
heim_base_once_t can just be a LONG on Windows, the structure is not needed
2015-11-30 17:34:32 +11:00
Nicolas Williams
cc0e92a3c3 base: correct Windows heim_base_once_f semantics
As implemented by Jeffrey Altman heim_base_once_f() is a variant of the
"double-checked gate lock pattern".   Full memory barriers must be used
when determining whether or not to call SwitchToThread().

Change-Id: I2f8446a56c50a37c921d6e993433c9a3f7488f50
2015-11-30 00:47:54 -05:00
Jeffrey Altman
4735faba59 base: Windows implementation of heim_base_once
Provide a Windows implementation of heim_base_once that relies upon
InterlockedCompareExchange() and SwitchToThread().

Change-Id: I9cdbda796d1a27fe1e17be63f287b10132858d7f
2015-11-29 12:15:10 -05:00
Jeffrey Altman
6fbe672451 hcrypto: Default to CommonCrypto on Apple OSes
When __APPLE__ is defined and HCRYPTO_DEF_PROVIDER is not defined,
define HCRYPTO_DEF_PROVIDER to be "cc" so that Apple's CommonCrypto
implementations are used instead of the built-in "hcrypto"
implementations.

Change-Id: I393e5fc3f6c3b9339c96db58d926ff8ea1867cbb
2015-11-24 09:48:44 -05:00
Roland C. Dowdeswell
3e6fffed60 include/Makefile.am: don't clean files that are distributed.
We stop cleaning crypto-headers.h and heim_threads.h.
2015-11-06 17:06:26 -05:00
Roland C. Dowdeswell
352a7e94a3 Make the KDC use a multi-process model.
We now fork(2) a number of separate KDC processes rather than a single
process.  By default, the number is selected by asking how many CPUs
the machine has.  We also have a master process which monitors all
of the children (which do the actual work) and it will restart kids
who die for any reason.  The children will die when the parent dies.

In the case of MacOS X, we also move the bonjour code into another
separate child as it creates threads and this is known to play
rather poorly with fork(2).  We could move this logic into a
designated child at some point in the future.

We slow down the spawning to one every 25ms to prevent instant crashes
and restarts from consuming all available system time.  This approach
may want to be revisited in the future.
2015-11-06 15:39:30 -05:00
Love Hörnquist Åstrand
3544bbc0b3 Update ack.texi 2015-10-06 17:26:27 +02:00
Love Hörnquist Åstrand
c9f05de561 Merge pull request #142 from hasufell/master
Completely remove RAND_egd support
2015-10-06 17:25:17 +02:00
hasufell
427a60057c Completely remove RAND_egd support
The EGD daemon is completely unmaintained and has not seen a release
since 13 years which is not an acceptable timeframe for cryptographic
software. It is not packaged in any linux distribution I know of
and definitely not in *BSD.

LibreSSL has already dropped support for RAND_egd.
2015-10-06 15:44:47 +02:00
Love Hörnquist Åstrand
434020567a Update copyright.texi
Add Timothy
2015-09-28 10:52:47 +02:00
Love Hörnquist Åstrand
7c86e09dd8 Update ack.texi
Add Timothy
2015-09-28 10:50:38 +02:00
Love Hörnquist Åstrand
8a906db068 Merge pull request #141 from madscientist159/master
Add ability to store extended principal attributes in LDAP
2015-09-28 10:49:13 +02:00
Timothy Pearson
f5f76ee72c Add ability to store extended principal attributes in LDAP
A careful code review was undertaken, and it was determined
that the best way to store the extended attributes was in a
native ASN1 encoded field.  LDAP does not understand the
SEQUENCE of SEQUENCE structures used extensively throughout
the extended attributes structure, and there was already a
precedent set for storing the krb5Key data in a native ASN1
encoded field.
2015-09-27 16:36:24 -05:00
Love Hörnquist Åstrand
bb14c02e12 Merge pull request #140 from madscientist159/master
Add ability to specifiy PKCS#11 slot number when using hx509
2015-09-25 00:47:01 +02:00
Timothy Pearson
042b1ee7cb Do not crash if private key not found 2015-09-24 15:48:14 -05:00
Timothy Pearson
1d07f08351 Add ability to specifiy PKCS#11 slot number when using hx509
Example usage: kinit -C PKCS11:/usr/lib/opensc-pkcs11.so,slot=3 foo@BAR.TLD
2015-09-24 15:34:51 -05:00
Jeffrey Altman
c81572ab5d Windows: Remove *_PA_ClientCanon* from export list
Change 29f6290fe6 removed the
PA_ClientCanon* ASN.1 functionality but failed to remove the generated
symbols from the Windows export list.

Change-Id: I9a46532ed7d8612fbc597dec9848505d4b440e09
2015-09-13 20:34:41 -04:00
Love Hörnquist Åstrand
0a5de96d72 Merge pull request #134 from abartlet/allow-null-authenticator
gssapi: Allow a NULL authenticator
2015-08-03 20:18:16 +02:00
Andrew Bartlett
411da1fb31 Merge pull request #138 from abartlet/lorikeet-heimdal-for-upstream
Samba Cross-realm support patches from metze

These patches were posted to heimdal-discuss by metze, and there were no objections there.
2015-07-31 18:03:07 +12:00
Stefan Metzmacher
ad3acc2aef lib/gssapi/krb5: implement gss_[un]wrap_iov[_length] with arcfour-hmac-md5
Pair-Programmed-With: Andreas Schneider <asn@samba.org>

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andreas Schneider <asn@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
bafefad87f lib/gssapi/krb5: split out a arcfour_mic_cksum_iov() function
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
ef0059b8b6 lib/gssapi/krb5: add const to arcfour_mic_key()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
5f79ac2bb9 lib/gssapi/krb5: clear temporary buffer with cleartext data.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
e33e47650a lib/gssapi/krb5: fix indentation in _gk_wrap_iov()
Now it matches _gk_unwrap_iov() and _gk_wrap_iov_length().

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
63ed962041 lib/gssapi/krb5: make _gssapi_verify_pad() more robust
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
078e6f5dd2 kdc: add support for HDB_ERR_WRONG_REALM
A backend can return this if asked with HDB_F_GET_CLIENT|HDB_F_FOR_AS_REQ
for a KRB5_NT_ENTERPRISE_PRINCIPAL record or for HDB_F_GET_SERVER | HDB_F_FOR_TGS_REQ.

entry_ex->entry.principal->realm needs to return the real realm of the principal
(or at least a the realm of the next cross-realm trust hop).

This is needed to route enterprise principals between AD domain trusts.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
81f9ed4a6c kdc: generic support for 3part servicePrincipalNames
This is not DRSUAPI specific, it works for all 3 part principals.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
a873e21d7c kdc: base _kdc_fast_mk_error() on krb5_mk_error_ext()
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
25f3db919f lib/krb5: add krb5_mk_error_ext() helper function
This gives the caller the ability to skip the client_name
and only provide client_realm. This is required for
KDC_ERR_WRONG_REALM messages.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
bbff216dc6 lib/krb5: correctly follow KRB5_KDC_ERR_WRONG_REALM client referrals
An AS-REQ with an enterprise principal will always directed to a kdc of the local
(default) realm. The KDC directs the client into the direction of the
final realm. See rfc6806.txt.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
ae4d222f58 lib/krb5: verify_logonname() to handle multi component principal
FreeIPA can generate tickets with a client principal of
'host/hostname.example.com'.

verify_logonname() should just verify the principal name
in the PAC_LOGON_NAME is the same as the principal of
the client principal (without realm) of the ticket.

Samba commit b7cc8c1187ff967e44587cd0d09185330378f366
break this. We try to compare ['host']['hostname.example.com']
with ['host/hostname.example.com]' (as we interpret it as enterprise principal)
this fail if we don't compare them as strings.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11142

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
20da6cad02 doc/standardisation: add rfc6806.txt
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Stefan Metzmacher
be37f24ef4 lib/ntlm: add missing dependency to libwind.la
Signed-off-by: Stefan Metzmacher <metze@samba.org>
2015-07-31 17:30:23 +12:00
Andrew Bartlett
71c95fb38d Merge pull request #137 from douglasbagnall/oid-regenerate
Oid regenerate

The GSSAPI oid C files were originally generated by a perl 4 script that no longer runs on a modern system. Subsequently the C has been manually modified.

These patches update the script to perl 5 and alter its output to reflect the manually changed C.

Because modern perl uses hash randomisation, the order of the oids in the C file is sorted -- otherwise
they will be ordered differently every time, making changes hard to review.
2015-07-31 16:15:55 +12:00
Douglas Bagnall
832d7af018 GSSAPI: regenerate lib/gssapi/mech/gss_oid.c with consistent sort
This is generated from lib/gssapi/oid.txt using lib/gssapi/gen-oid.pl,
which sorts the entries to ensure minimal diff churn when an oid is
added or changed.

The lack of effective changes can be seen by sorting both versions, a
bit like this:

$ git show HEAD~~:lib/gssapi/mech/gss_oid.c | sort > /tmp/gss_oid.c-OLD
$ cat lib/gssapi/mech/gss_oid.c | sort > /tmp/gss_oid.c-NEW
$ diff -u /tmp/gss_oid.c*
$ #Nothing to see!

This is of course not a reliable check in general, but works for this
simple file in concert with ordinary inspection.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2015-07-31 15:51:13 +12:00
Douglas Bagnall
0d31145e9d GSSAPI: generate full NULL structure initializers in gen-oid.pl
As seen in commit cc47c8fa7 (Roland C. Dowdeswell <elric@imrryr.org>,
"Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix
issues"), compilers can be persuaded to dislike a single {NULL} and
prefer {NULL, NULL, NULL, NULL}. That patch altered the C code
directly; here we change the generating file to match.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2015-07-31 15:51:13 +12:00
Douglas Bagnall
0c36f11f17 GSSAPI: keep consistent sort order in lib/gssapi/gen-oid.pl
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2015-07-31 15:51:13 +12:00
Douglas Bagnall
afab2ff867 GSSAPI: use rk_UNCONST() on password and cert oid
These missed out on the rk_UNCONST()ification by virtue of being added
in a parallel branch. In the diagram below, they got added in 02cf28e,
while the rk_UNCONSTs were added in f5f9014.

* cc47c8f Turn on -Wextra -Wno-sign-compare -Wno-unused-paramter and fix issues.
*   3069d80 Merge branch 'master' into lukeh/acquire-cred-ex
|\
| * f5f9014 Warning fixes from Christos Zoulas
* | 02cf28e implement gss_acquire_cred_ex with password support
|/
* 2170219 add more oids

rk_UNCONST amounts to a cast to (void *), removing const.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2015-07-31 15:51:13 +12:00
Douglas Bagnall
f132e0b2a3 GSSAPI: update lib/gssapi/gen-oid.pl to work with Perl 5
The invocation `require "getopts.pl"; Getopts(...)` works in Perl 4,
but not in recent Perl 5.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2015-07-31 15:51:13 +12:00
Andrew Bartlett
8508294940 gssapi: Allow a NULL authenticator
Some non-GSSAPI implementations that instead try to create compatible packets by wrapping krb5_mk_req()
can trigger a NULL authenticator here.  Assume this to be equvilent to specifying an all-zero
channel bindings and some reasonable (fixed) flags.

Original patch by Andrew Bartlett, restructured by Douglas Bagnall

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2015-07-30 10:52:54 +12:00
Love Hörnquist Åstrand
db4175c225 Merge pull request #136 from HenryJacques/pkinit_improvements
PK-INIT improvements
2015-07-24 12:04:47 +02:00
HenryJacques
5a4e9d1539 Fix typo 2015-07-20 10:45:06 +02:00
HenryJacques
35a569bd83 Allow to use more than one token
This is needed if the first is not usable
2015-07-20 10:14:38 +02:00
HenryJacques
1639697c97 add error codes related to User PIN 2015-07-20 10:12:50 +02:00
HenryJacques
75a304c452 Fix typo 2015-07-20 10:08:57 +02:00