From: Greg Hudson Date: Fri, 8 Oct 2021 21:45:03 +0000 (-0400) Subject: Use builtin MD4, RC4 for OpenSSL 3.0 X-Git-Tag: krb5-1.20-beta1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e557f051d1605ee980b136cae020866873ffb223;p=thirdparty%2Fkrb5.git Use builtin MD4, RC4 for OpenSSL 3.0 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) --- diff --git a/src/lib/crypto/krb/crypto_int.h b/src/lib/crypto/krb/crypto_int.h index 974bea01a9..82474aabea 100644 --- a/src/lib/crypto/krb/crypto_int.h +++ b/src/lib/crypto/krb/crypto_int.h @@ -34,15 +34,30 @@ #if defined(CRYPTO_OPENSSL) +#include +#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