From: Jouni Malinen Date: Sat, 12 Mar 2022 20:27:16 +0000 (+0200) Subject: OpenSSL 3.0: Implement crypto_ec_key_group() with new API X-Git-Tag: hostap_2_11~2158 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2cb0ca1acb4f01daac460914d7d5c26e4c201ac;p=thirdparty%2Fhostap.git OpenSSL 3.0: Implement crypto_ec_key_group() with new API Get rid of the now deprecated EVP_PKEY_get0_EC_KEY() and EC_KEY_get0_group() calls. Signed-off-by: Jouni Malinen --- diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c index b54da5e42..4a867e41e 100644 --- a/src/crypto/crypto_openssl.c +++ b/src/crypto/crypto_openssl.c @@ -2893,6 +2893,15 @@ fail: int crypto_ec_key_group(struct crypto_ec_key *key) { +#if OPENSSL_VERSION_NUMBER >= 0x30000000L + char gname[50]; + int nid; + + if (EVP_PKEY_get_group_name((EVP_PKEY *) key, gname, sizeof(gname), + NULL) != 1) + return -1; + nid = OBJ_txt2nid(gname); +#else const EC_KEY *eckey; const EC_GROUP *group; int nid; @@ -2904,6 +2913,7 @@ int crypto_ec_key_group(struct crypto_ec_key *key) if (!group) return -1; nid = EC_GROUP_get_curve_name(group); +#endif switch (nid) { case NID_X9_62_prime256v1: return 19;