Skip to content

Commit

Permalink
Use builtin MD4, RC4 for OpenSSL 3.0
Browse files Browse the repository at this point in the history
In OpenSSL 3.0, to use MD4 or RC4 one must load the "legacy" crypto
provider.  To do this in libk5crypto, we would need to create and use
an OpenSSL library context to avoid interfering with other users of
the library.  Tearing down this context at finalization time would be
further complicated by OpenSSL's use of atexit() for library
finalization, which causes its finalizer to be run earlier than
properly registered finalizers on Linux.

For simplicity, use the builtin implementations of MD4 and RC4 for
OpenSSL 3.0 and later.  Also use the builtin DES key parity
implementation since OpenSSL 3.0 deprecates DES_set_odd_parity() with
no replacement.

ticket: 9034 (new)
  • Loading branch information
greghudson committed Oct 28, 2021
1 parent ce4e370 commit e557f05
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/lib/crypto/krb/crypto_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,30 @@

#if defined(CRYPTO_OPENSSL)

#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
/*
* OpenSSL 3.0 relegates MD4 and RC4 to the legacy provider, which must be
* explicitly loaded into a library context. Performing this loading within a
* library carries complications, so use the built-in implementations of these
* primitives instead. OpenSSL 3.0 also deprecates DES_set_odd_parity() with
* no replacement.
*/
#define K5_BUILTIN_DES_KEY_PARITY
#define K5_BUILTIN_MD4
#define K5_BUILTIN_RC4
#else
#define K5_OPENSSL_DES_KEY_PARITY
#define K5_OPENSSL_MD4
#define K5_OPENSSL_RC4
#endif

#define K5_OPENSSL_AES
#define K5_OPENSSL_CAMELLIA
#define K5_OPENSSL_DES
#define K5_OPENSSL_DES_KEY_PARITY
#define K5_OPENSSL_HMAC
#define K5_OPENSSL_MD4
#define K5_OPENSSL_MD5
#define K5_OPENSSL_PBKDF2
#define K5_OPENSSL_RC4
#define K5_OPENSSL_SHA1
#define K5_OPENSSL_SHA2

Expand Down

0 comments on commit e557f05

Please sign in to comment.