summaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-02-25 13:52:25 +1000
committerPauli <ppzgs1@gmail.com>2021-02-28 17:25:49 +1000
commitcf5784aa03bf4e9214dc92bd9f92fcc09e664d40 (patch)
tree46a0a39ce180acc2def4e402fefc46c5050a2687 /providers
parent91593b37840067c588ce38bc628922d4b3400917 (diff)
prov: use new MAC_init arguments in HMAC-DRBG
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14310)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/rands/drbg_hmac.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/providers/implementations/rands/drbg_hmac.c b/providers/implementations/rands/drbg_hmac.c
index 5f193fa57c..85b7adfe86 100644
--- a/providers/implementations/rands/drbg_hmac.c
+++ b/providers/implementations/rands/drbg_hmac.c
@@ -60,12 +60,8 @@ static int do_hmac(PROV_DRBG_HMAC *hmac, unsigned char inbyte,
const unsigned char *in3, size_t in3len)
{
EVP_MAC_CTX *ctx = hmac->ctx;
- OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
- *params = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, hmac->K,
- hmac->blocklen);
- if (!EVP_MAC_CTX_set_params(ctx, params)
- || !EVP_MAC_init(ctx)
+ if (!EVP_MAC_init(ctx, hmac->K, hmac->blocklen, NULL)
/* K = HMAC(K, V || inbyte || [in1] || [in2] || [in3]) */
|| !EVP_MAC_update(ctx, hmac->V, hmac->blocklen)
|| !EVP_MAC_update(ctx, &inbyte, 1)
@@ -76,10 +72,7 @@ static int do_hmac(PROV_DRBG_HMAC *hmac, unsigned char inbyte,
return 0;
/* V = HMAC(K, V) */
- *params = OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY, hmac->K,
- hmac->blocklen);
- return EVP_MAC_CTX_set_params(ctx, params)
- && EVP_MAC_init(ctx)
+ return EVP_MAC_init(ctx, hmac->K, hmac->blocklen, NULL)
&& EVP_MAC_update(ctx, hmac->V, hmac->blocklen)
&& EVP_MAC_final(ctx, hmac->V, NULL, sizeof(hmac->V));
}
@@ -202,7 +195,6 @@ static int drbg_hmac_generate(PROV_DRBG *drbg,
PROV_DRBG_HMAC *hmac = (PROV_DRBG_HMAC *)drbg->data;
EVP_MAC_CTX *ctx = hmac->ctx;
const unsigned char *temp = hmac->V;
- OSSL_PARAM params[2] = { OSSL_PARAM_END, OSSL_PARAM_END };
/* (Step 2) if adin != NULL then (K,V) = HMAC_DRBG_Update(adin, K, V) */
if (adin != NULL
@@ -218,10 +210,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_CTX_set_params(ctx, params)
- || !EVP_MAC_init(ctx)
+ if (!EVP_MAC_init(ctx, hmac->K, hmac->blocklen, NULL)
|| !EVP_MAC_update(ctx, temp, hmac->blocklen))
return 0;