]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
evp_pkey_ctx_setget_params_to_ctrl(): Always properly set ctx.action_type
authorTomas Mraz <tomas@openssl.org>
Mon, 24 Jun 2024 09:25:12 +0000 (11:25 +0200)
committerTomas Mraz <tomas@openssl.org>
Wed, 26 Jun 2024 09:52:02 +0000 (11:52 +0200)
Fixes #24698

Some applicable translations are bidirectional so they have
NONE action_type. However we need to set the real action_type
in the ctx.

Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/24709)

crypto/evp/ctrl_params_translate.c

index 54e589054c603fb3bd4619b636c0688e0ff3d6a1..de06348a33781c4d6e53bb61e9e4cd528079cad7 100644 (file)
@@ -2845,7 +2845,7 @@ static int evp_pkey_ctx_setget_params_to_ctrl(EVP_PKEY_CTX *pctx,
         fixup_args_fn *fixup = default_fixup_args;
         int ret;
 
-        tmpl.action_type = action_type;
+        ctx.action_type = tmpl.action_type = action_type;
         tmpl.keytype1 = tmpl.keytype2 = keytype;
         tmpl.optype = optype;
         tmpl.param_key = params->key;
@@ -2854,7 +2854,6 @@ static int evp_pkey_ctx_setget_params_to_ctrl(EVP_PKEY_CTX *pctx,
         if (translation != NULL) {
             if (translation->fixup_args != NULL)
                 fixup = translation->fixup_args;
-            ctx.action_type = translation->action_type;
             ctx.ctrl_cmd = translation->ctrl_num;
         }
         ctx.pctx = pctx;