OpenSSL: Replace EVP_PKEY_cmp() with EVP_PKEY_eq() when available

OpenSSL 3.0 deprecated EVP_PKEY_cmp() and replaced it with EVP_PKEY_eq()
which is not available in older versions.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2022-03-12 10:54:48 +02:00
parent 5b093570dc
commit f6a53f64af

View file

@ -2932,8 +2932,13 @@ int crypto_ec_key_group(struct crypto_ec_key *key)
int crypto_ec_key_cmp(struct crypto_ec_key *key1, struct crypto_ec_key *key2)
{
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
if (EVP_PKEY_eq((EVP_PKEY *) key1, (EVP_PKEY *) key2) != 1)
return -1;
#else
if (EVP_PKEY_cmp((EVP_PKEY *) key1, (EVP_PKEY *) key2) != 1)
return -1;
#endif
return 0;
}