]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
OpenSSL 3.0: Implement crypto_ec_key_group() with new API
authorJouni Malinen <j@w1.fi>
Sat, 12 Mar 2022 20:27:16 +0000 (22:27 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 13 Mar 2022 09:26:36 +0000 (11:26 +0200)
Get rid of the now deprecated EVP_PKEY_get0_EC_KEY() and
EC_KEY_get0_group() calls.

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

index b54da5e429ce42f3f5ac0ae46f57c93eaabc3711..4a867e41e0de7284cffd47692b239cb73068dabf 100644 (file)
@@ -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;