LibreSSL: Fix compilation issue with RSA-OAEP

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: 36b11bbcff ("OpenSSL: RSA-OAEP-SHA-256 encryption/decryption")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
This commit is contained in:
Jouni Malinen 2022-05-05 00:31:43 +03:00 committed by Jouni Malinen
parent 5d56cf1c71
commit eb5e639856

View 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 */