summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2020-11-26 15:06:34 +1000
committerShane Lontis <shane.lontis@oracle.com>2020-12-04 08:33:28 +1000
commitc2386b81feae22786502abb99b3b39f85e66d8a1 (patch)
tree443d197a86046839b698f0f3be545cc925dcb85c /providers
parent283320281bda4e1b5cfaedb0db723a96325aabb9 (diff)
Fix dsa & rsa signature dupctx() so that ctx->propq is strduped
Discovered when fixing up ecdsa code. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/13520)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/signature/dsa.c8
-rw-r--r--providers/implementations/signature/rsa.c7
2 files changed, 13 insertions, 2 deletions
diff --git a/providers/implementations/signature/dsa.c b/providers/implementations/signature/dsa.c
index a1621acf62..515845c56c 100644
--- a/providers/implementations/signature/dsa.c
+++ b/providers/implementations/signature/dsa.c
@@ -85,7 +85,6 @@ typedef struct {
/* main digest */
EVP_MD *md;
EVP_MD_CTX *mdctx;
- size_t mdsize;
int operation;
} PROV_DSA_CTX;
@@ -361,7 +360,6 @@ static void dsa_freectx(void *vpdsactx)
ctx->propq = NULL;
ctx->mdctx = NULL;
ctx->md = NULL;
- ctx->mdsize = 0;
DSA_free(ctx->dsa);
OPENSSL_free(ctx);
}
@@ -382,6 +380,7 @@ static void *dsa_dupctx(void *vpdsactx)
dstctx->dsa = NULL;
dstctx->md = NULL;
dstctx->mdctx = NULL;
+ dstctx->propq = NULL;
if (srcctx->dsa != NULL && !DSA_up_ref(srcctx->dsa))
goto err;
@@ -397,6 +396,11 @@ static void *dsa_dupctx(void *vpdsactx)
|| !EVP_MD_CTX_copy_ex(dstctx->mdctx, srcctx->mdctx))
goto err;
}
+ if (srcctx->propq != NULL) {
+ dstctx->propq = OPENSSL_strdup(srcctx->propq);
+ if (dstctx->propq == NULL)
+ goto err;
+ }
return dstctx;
err:
diff --git a/providers/implementations/signature/rsa.c b/providers/implementations/signature/rsa.c
index b463f03d7f..98ebf6b243 100644
--- a/providers/implementations/signature/rsa.c
+++ b/providers/implementations/signature/rsa.c
@@ -870,6 +870,7 @@ static void *rsa_dupctx(void *vprsactx)
dstctx->md = NULL;
dstctx->mdctx = NULL;
dstctx->tbuf = NULL;
+ dstctx->propq = NULL;
if (srcctx->rsa != NULL && !RSA_up_ref(srcctx->rsa))
goto err;
@@ -890,6 +891,12 @@ static void *rsa_dupctx(void *vprsactx)
goto err;
}
+ if (srcctx->propq != NULL) {
+ dstctx->propq = OPENSSL_strdup(srcctx->propq);
+ if (dstctx->propq == NULL)
+ goto err;
+ }
+
return dstctx;
err:
rsa_freectx(dstctx);