]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL: Use internal FIPS 186-2 PRF with OpenSSL 3.0
authorJouni Malinen <j@w1.fi>
Thu, 26 May 2022 20:35:16 +0000 (23:35 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 26 May 2022 21:32:10 +0000 (00:32 +0300)
OpenSSL 3.0 has deprecated the low-level SHA1 functions and does not
include an upper layer interface that could be used to use the
SHA1_Transform() function. Use the internal SHA-1 implementation instead
as a workaround.

While this type of duplicate implementation of SHA-1 is not really
ideal, this PRF is needed only for EAP-SIM/AKA and there does not seem
to be sufficient justification to try to get this working more cleanly
with OpenSSL 3.0.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/crypto/fips_prf_openssl.c

index 4697e041093a8e94098c5cde7e3a1fb52fdcfc01..484f772094f32c9c3c7f48f7df9e0c5df99d2303 100644 (file)
@@ -7,6 +7,19 @@
  */
 
 #include "includes.h"
+#include <openssl/opensslv.h>
+
+#if OPENSSL_VERSION_NUMBER >= 0x30000000L
+
+/* OpenSSL 3.0 has deprecated the low-level SHA1 functions and does not
+ * include an upper layer interface that could be used to use the
+ * SHA1_Transform() function. Use the internal SHA-1 implementation instead
+ * as a workaround. */
+#include "sha1-internal.c"
+#include "fips_prf_internal.c"
+
+#else /* OpenSSL version >= 3.0 */
+
 #include <openssl/sha.h>
 
 #include "common.h"
@@ -97,3 +110,5 @@ int fips186_2_prf(const u8 *seed, size_t seed_len, u8 *x, size_t xlen)
 
        return 0;
 }
+
+#endif /* OpenSSL version >= 3.0 */