From 729840de15827de690ae9a5b04765e1f8b17ef13 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Fri, 13 Oct 2023 22:46:55 +0200 Subject: [PATCH] EVP_PKEY_CTX_new*(): add diagnostic detail which algortihm is not supported --- crypto/evp/pmeth_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 268b1617e37993..060daa723d4280 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -182,12 +182,13 @@ static EVP_PKEY_CTX *int_ctx_new(OSSL_LIB_CTX *libctx, EVP_PKEY_CTX *ret = NULL; const EVP_PKEY_METHOD *pmeth = NULL, *app_pmeth = NULL; EVP_KEYMGMT *keymgmt = NULL; + int pknid = pkey != NULL ? pkey->type : -1; /* Code below to be removed when legacy support is dropped. */ /* BEGIN legacy */ if (id == -1) { if (pkey != NULL && !evp_pkey_is_provided(pkey)) { - id = pkey->type; + id = pknid; } else { if (pkey != NULL) { /* Must be provided if we get here */ @@ -310,7 +311,8 @@ static EVP_PKEY_CTX *int_ctx_new(OSSL_LIB_CTX *libctx, } if (pmeth == NULL && keymgmt == NULL) { - ERR_raise(ERR_LIB_EVP, EVP_R_UNSUPPORTED_ALGORITHM); + ERR_raise_data(ERR_LIB_EVP, EVP_R_UNSUPPORTED_ALGORITHM, + "pkey nid=%d, id=%d, name=%s", pknid, id, keytype); } else { ret = OPENSSL_zalloc(sizeof(*ret)); }