From 292c8bdc083d1b739ae241775bfac36f1f998294 Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 10 Feb 2020 13:32:36 +1000 Subject: [PATCH] pmeth_lib: detect unsupported OSSL_PARAM. When converting legacy controls to OSSL_PARAMs, return the unsupported -2 value correctly. Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11049) --- crypto/evp/pmeth_lib.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 20cbb08559..6be796fafc 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -938,10 +938,16 @@ static int legacy_ctrl_str_to_param(EVP_PKEY_CTX *ctx, const char *name, const OSSL_PARAM *settable = EVP_PKEY_CTX_settable_params(ctx); OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END }; int rv = 0; + int exists = 0; if (!OSSL_PARAM_allocate_from_text(¶ms[0], settable, name, value, - strlen(value), NULL)) + strlen(value), &exists)) { + if (!exists) { + ERR_raise(ERR_LIB_EVP, EVP_R_COMMAND_NOT_SUPPORTED); + return -2; + } return 0; + } if (EVP_PKEY_CTX_set_params(ctx, params)) rv = 1; OPENSSL_free(params[0].data); -- 2.25.1