diff options
Diffstat (limited to 'providers/implementations/signature/dsa_sig.c')
-rw-r--r-- | providers/implementations/signature/dsa_sig.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/providers/implementations/signature/dsa_sig.c b/providers/implementations/signature/dsa_sig.c index 45dc235832..eb28c595b7 100644 --- a/providers/implementations/signature/dsa_sig.c +++ b/providers/implementations/signature/dsa_sig.c @@ -98,7 +98,6 @@ typedef struct { /* The Algorithm Identifier of the combined signature algorithm */ unsigned char aid_buf[OSSL_MAX_ALGORITHM_ID_SIZE]; - unsigned char *aid; size_t aid_len; /* main digest */ @@ -160,6 +159,7 @@ static int dsa_setup_md(PROV_DSA_CTX *ctx, WPACKET pkt; int md_nid; size_t mdname_len = strlen(mdname); + unsigned char *aid = NULL; md = EVP_MD_fetch(ctx->libctx, mdname, mdprops); md_nid = ossl_digest_get_approved_nid(md); @@ -223,9 +223,11 @@ static int dsa_setup_md(PROV_DSA_CTX *ctx, md_nid) && WPACKET_finish(&pkt)) { WPACKET_get_total_written(&pkt, &ctx->aid_len); - ctx->aid = WPACKET_get_curr(&pkt); + aid = WPACKET_get_curr(&pkt); } WPACKET_cleanup(&pkt); + if (aid != NULL && ctx->aid_len != 0) + memmove(ctx->aid_buf, aid, ctx->aid_len); ctx->mdctx = NULL; ctx->md = md; @@ -674,7 +676,9 @@ static int dsa_get_ctx_params(void *vpdsactx, OSSL_PARAM *params) p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_ALGORITHM_ID); if (p != NULL - && !OSSL_PARAM_set_octet_string(p, pdsactx->aid, pdsactx->aid_len)) + && !OSSL_PARAM_set_octet_string(p, + pdsactx->aid_len == 0 ? NULL : pdsactx->aid_buf, + pdsactx->aid_len)) return 0; p = OSSL_PARAM_locate(params, OSSL_SIGNATURE_PARAM_DIGEST); |