]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
LibreSSL: Fix compilation issue with RSA-OAEP
authorJouni Malinen <quic_jouni@quicinc.com>
Wed, 4 May 2022 21:31:43 +0000 (00:31 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 5 May 2022 10:02:12 +0000 (13:02 +0300)
EVP_PKEY_CTX_set_rsa_oaep_md() does not seem to be available in
LibreSSL, so for now, comment out this functionality whenever building
with that library.

Fixes: 36b11bbcffb6 ("OpenSSL: RSA-OAEP-SHA-256 encryption/decryption")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/crypto/crypto_openssl.c

index fbda869c1b1918a12d72a36a43a4b4d5d9e2acac..c6e065f82b5a48a6af29ee1033d0b023e7000f79 100644 (file)
@@ -3989,6 +3989,7 @@ struct crypto_rsa_key * crypto_rsa_key_read(const char *file, bool private_key)
 struct wpabuf * crypto_rsa_oaep_sha256_encrypt(struct crypto_rsa_key *key,
                                               const struct wpabuf *in)
 {
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x30400000L
        EVP_PKEY *pkey = (EVP_PKEY *) key;
        EVP_PKEY_CTX *pkctx;
        struct wpabuf *res = NULL;
@@ -4015,12 +4016,17 @@ struct wpabuf * crypto_rsa_oaep_sha256_encrypt(struct crypto_rsa_key *key,
 fail:
        EVP_PKEY_CTX_free(pkctx);
        return res;
+#else
+       wpa_printf(MSG_ERROR, "%s() not supported", __func__);
+       return NULL;
+#endif
 }
 
 
 struct wpabuf * crypto_rsa_oaep_sha256_decrypt(struct crypto_rsa_key *key,
                                               const struct wpabuf *in)
 {
+#if !defined(LIBRESSL_VERSION_NUMBER) || LIBRESSL_VERSION_NUMBER >= 0x30400000L
        EVP_PKEY *pkey = (EVP_PKEY *) key;
        EVP_PKEY_CTX *pkctx;
        struct wpabuf *res = NULL;
@@ -4047,6 +4053,10 @@ struct wpabuf * crypto_rsa_oaep_sha256_decrypt(struct crypto_rsa_key *key,
 fail:
        EVP_PKEY_CTX_free(pkctx);
        return res;
+#else
+       wpa_printf(MSG_ERROR, "%s() not supported", __func__);
+       return NULL;
+#endif
 }
 
 #endif /* OPENSSL_NO_SHA256 */