summaryrefslogtreecommitdiffstats
path: root/crypto/evp/pmeth_gn.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-05-06 20:48:25 +0200
committerRichard Levitte <levitte@openssl.org>2020-05-08 15:15:16 +0200
commitc7fa92979c5964966efa298bf2a40ff451ee7482 (patch)
tree7bfdf9e74ccde00fce0c976be3f01600e47b3aff /crypto/evp/pmeth_gn.c
parent73d6b4efe6835a6c97ce61df6bf339b0903e5b7a (diff)
EVP: when setting the operation to EVP_PKEY_OP_UNDEFINED, clean up!
There were a few instances where we set the EVP_PKEY_CTX operation to EVP_PKEY_OP_UNDEFINED, but forgot to clean up first. After the operation is made undefined, there's no way to know what should be cleaned away, so that must be done first, in all spots. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11750)
Diffstat (limited to 'crypto/evp/pmeth_gn.c')
-rw-r--r--crypto/evp/pmeth_gn.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c
index a775d2bee7..fb861d2487 100644
--- a/crypto/evp/pmeth_gn.c
+++ b/crypto/evp/pmeth_gn.c
@@ -93,8 +93,10 @@ static int gen_init(EVP_PKEY_CTX *ctx, int operation)
#endif
end:
- if (ret <= 0 && ctx != NULL)
+ if (ret <= 0 && ctx != NULL) {
+ evp_pkey_ctx_free_old_ops(ctx);
ctx->operation = EVP_PKEY_OP_UNDEFINED;
+ }
return ret;
not_supported: