diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2020-10-15 13:41:59 +1000 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-01-26 15:22:14 +0100 |
commit | 5b5eea4b60b682009d2b15587c9ceeae5e9c73f8 (patch) | |
tree | 4a3261cb27a582770270a07b40ecf05ecb71c89a /test/helpers/handshake.c | |
parent | 98dbf2c1c8143c0cc6dd05be7950d90bc6792064 (diff) |
Deprecate EC_KEY + Update ec apps to use EVP_PKEY
Co-author: Richard Levitte <levitte@openssl.org>
Co-author: Tomas Mraz <tmraz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13139)
Diffstat (limited to 'test/helpers/handshake.c')
-rw-r--r-- | test/helpers/handshake.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/test/helpers/handshake.c b/test/helpers/handshake.c index 08fcd39bea..0711639fd1 100644 --- a/test/helpers/handshake.c +++ b/test/helpers/handshake.c @@ -12,6 +12,7 @@ #include <openssl/bio.h> #include <openssl/x509_vfy.h> #include <openssl/ssl.h> +#include <openssl/core_names.h> #ifndef OPENSSL_NO_SRP #include <openssl/srp.h> #endif @@ -1270,15 +1271,18 @@ static char *dup_str(const unsigned char *in, size_t len) static int pkey_type(EVP_PKEY *pkey) { - int nid = EVP_PKEY_id(pkey); - #ifndef OPENSSL_NO_EC - if (nid == EVP_PKEY_EC) { - const EC_KEY *ec = EVP_PKEY_get0_EC_KEY(pkey); - return EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); + if (EVP_PKEY_is_a(pkey, "EC")) { + char name[80]; + size_t name_len; + + if (!EVP_PKEY_get_utf8_string_param(pkey, OSSL_PKEY_PARAM_GROUP_NAME, + name, sizeof(name), &name_len)) + return NID_undef; + return OBJ_txt2nid(name); } #endif - return nid; + return EVP_PKEY_id(pkey); } static int peer_pkey_type(SSL *s) |