From e4162f86d7fd92058e5558bd81ce9dbc615fec3f Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 16 Jul 2020 06:49:45 +0200 Subject: [PATCH] DRBG: Fix the renamed functions after the EVP_MAC name reversal [extended tests] Reviewed-by: Tomas Mraz Reviewed-by: Nicola Tuveri (Merged from https://github.com/openssl/openssl/pull/12186) --- providers/implementations/rands/drbg_hmac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/providers/implementations/rands/drbg_hmac.c b/providers/implementations/rands/drbg_hmac.c index b73fe958b0..7ddfae1568 100644 --- a/providers/implementations/rands/drbg_hmac.c +++ b/providers/implementations/rands/drbg_hmac.c @@ -64,7 +64,7 @@ static int do_hmac(PROV_DRBG_HMAC *hmac, unsigned char inbyte, *params = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, hmac->K, hmac->blocklen); - if (!EVP_MAC_set_ctx_params(ctx, params) + if (!EVP_MAC_CTX_set_params(ctx, params) || !EVP_MAC_init(ctx) /* K = HMAC(K, V || inbyte || [in1] || [in2] || [in3]) */ || !EVP_MAC_update(ctx, hmac->V, hmac->blocklen) @@ -78,7 +78,7 @@ static int do_hmac(PROV_DRBG_HMAC *hmac, unsigned char inbyte, /* V = HMAC(K, V) */ *params = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, hmac->K, hmac->blocklen); - return EVP_MAC_set_ctx_params(ctx, params) + return EVP_MAC_CTX_set_params(ctx, params) && EVP_MAC_init(ctx) && EVP_MAC_update(ctx, hmac->V, hmac->blocklen) && EVP_MAC_final(ctx, hmac->V, NULL, sizeof(hmac->V)); @@ -220,7 +220,7 @@ static int drbg_hmac_generate(PROV_DRBG *drbg, for (;;) { *params = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, hmac->K, hmac->blocklen); - if (!EVP_MAC_set_ctx_params(ctx, params) + if (!EVP_MAC_CTX_set_params(ctx, params) || !EVP_MAC_init(ctx) || !EVP_MAC_update(ctx, temp, hmac->blocklen)) return 0; @@ -315,7 +315,7 @@ static void drbg_hmac_free(void *vdrbg) PROV_DRBG_HMAC *hmac; if (drbg != NULL && (hmac = (PROV_DRBG_HMAC *)drbg->data) != NULL) { - EVP_MAC_free_ctx(hmac->ctx); + EVP_MAC_CTX_free(hmac->ctx); ossl_prov_digest_reset(&hmac->digest); OPENSSL_secure_clear_free(hmac, sizeof(*hmac)); }