X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=providers%2Fimplementations%2Fsignature%2Fmac_legacy.c;h=fb99221f0877c6ed38424b7555651a21e08ce719;hp=7d23e36f2b746dea174bef407495d90732ab057b;hb=91593b37840067c588ce38bc628922d4b3400917;hpb=4333b89f504e7a8de9c42a0d27f68530b5301848 diff --git a/providers/implementations/signature/mac_legacy.c b/providers/implementations/signature/mac_legacy.c index 7d23e36f2b..fb99221f08 100644 --- a/providers/implementations/signature/mac_legacy.c +++ b/providers/implementations/signature/mac_legacy.c @@ -117,11 +117,11 @@ static int mac_digest_sign_init(void *vpmacctx, const char *mdname, void *vkey) (char *)mdname, (char *)engine, pmacctx->key->properties, - pmacctx->key->priv_key, - pmacctx->key->priv_key_len)) + NULL, 0)) return 0; - if (!EVP_MAC_init(pmacctx->macctx)) + if (!EVP_MAC_init(pmacctx->macctx, pmacctx->key->priv_key, + pmacctx->key->priv_key_len, NULL)) return 0; return 1; @@ -172,9 +172,13 @@ static void *mac_dupctx(void *vpmacctx) return NULL; *dstctx = *srcctx; + dstctx->propq = NULL; dstctx->key = NULL; dstctx->macctx = NULL; + if (srcctx->propq != NULL && (dstctx->propq = OPENSSL_strdup(srcctx->propq)) == NULL) + goto err; + if (srcctx->key != NULL && !ossl_mac_key_up_ref(srcctx->key)) goto err; dstctx->key = srcctx->key;