From 509144964ba69b69a90269da52a2dc3acb3149e6 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Wed, 2 Sep 2020 09:30:42 +0200 Subject: EVP: Preserve the EVP_PKEY id in a few more spots As long as there are internal legacy keys for EVP_PKEY, we need to preserve the EVP_PKEY numeric identity when generating a key, and when creating the EVP_PKEY_CTX. For added consistency, the EVP_PKEY_CTX contructor tries a little harder to find a EVP_PKEY_METHOD. Otherwise, we may run into situations where the EVP_PKEY_CTX ends up having no associated methods at all. Reviewed-by: Paul Yang (Merged from https://github.com/openssl/openssl/pull/12785) --- include/crypto/evp.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include') diff --git a/include/crypto/evp.h b/include/crypto/evp.h index b00634234c..43ecc79f52 100644 --- a/include/crypto/evp.h +++ b/include/crypto/evp.h @@ -62,6 +62,8 @@ struct evp_pkey_ctx_st { /* Legacy fields below */ + /* EVP_PKEY identity */ + int legacy_keytype; /* Method associated with this operation */ const EVP_PKEY_METHOD *pmeth; /* Engine that implements this method or NULL if builtin */ @@ -766,6 +768,7 @@ int evp_pkey_ctx_get_params_strict(EVP_PKEY_CTX *ctx, OSSL_PARAM *params); EVP_MD_CTX *evp_md_ctx_new_with_libctx(EVP_PKEY *pkey, const ASN1_OCTET_STRING *id, OPENSSL_CTX *libctx, const char *propq); +int evp_pkey_name2type(const char *name); #endif /* !defined(FIPS_MODULE) */ void evp_method_store_flush(OPENSSL_CTX *libctx); int evp_set_default_properties_int(OPENSSL_CTX *libctx, const char *propq, -- cgit v1.2.3