evp_test: updates for the new additional MAC_init arguments

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/14310)
This commit is contained in:
Pauli 2021-02-25 13:49:37 +10:00
parent 0edb819441
commit 41df96efc1
4 changed files with 26 additions and 14 deletions

View File

@ -1279,11 +1279,6 @@ static int mac_test_run_mac(EVP_TEST *t)
goto err;
}
}
if (expected->key != NULL)
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_KEY,
expected->key,
expected->key_len);
if (expected->custom != NULL)
params[params_n++] =
OSSL_PARAM_construct_octet_string(OSSL_MAC_PARAM_CUSTOM,
@ -1339,11 +1334,7 @@ static int mac_test_run_mac(EVP_TEST *t)
goto err;
}
if (!EVP_MAC_CTX_set_params(ctx, params)) {
t->err = "MAC_BAD_PARAMS";
goto err;
}
if (!EVP_MAC_init(ctx)) {
if (!EVP_MAC_init(ctx, expected->key, expected->key_len, params)) {
t->err = "MAC_INIT_ERROR";
goto err;
}

View File

@ -169,7 +169,7 @@ Output = 233a6c732212f4813ec4c9f357e35297e59a652fd24155205f00363f7c54734ee1e8c73
MAC = BLAKE2BMAC
Key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
Ctrl = size:128
Result = MAC_BAD_PARAMS
Result = MAC_INIT_ERROR
MAC = BLAKE2BMAC
Key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
@ -225,7 +225,7 @@ Output = e9f7704dfe5080a4aafe62a806f53ea7f98ffc24175164158f18ec5497b961f5
MAC = BLAKE2SMAC
Key = 000102030405060708090a0b0c0d0e0f
Ctrl = size:64
Result = MAC_BAD_PARAMS
Result = MAC_INIT_ERROR
MAC = BLAKE2SMAC
Key = 000102030405060708090a0b0c0d0e0f

View File

@ -213,7 +213,7 @@ MAC = HMAC
Algorithm = SHAKE128
Input = "Test that SHAKE128 fails"
Key = 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
Result = MAC_BAD_PARAMS
Result = MAC_INIT_ERROR
Title = CMAC tests (from FIPS module)

View File

@ -155,7 +155,7 @@ Output = 5150d1772f50834a503e069a973fbd7c
MAC = SipHash
Ctrl = size:13
Key = 000102030405060708090A0B0C0D0E0F
Result = MAC_BAD_PARAMS
Result = MAC_INIT_ERROR
# SIPHASH - default values: 2,4 rounds, explicit 13-byte mac (invalid size)
# by EVP_PKEY this time
@ -164,3 +164,24 @@ MAC = SipHash by EVP_PKEY
Ctrl = size:13
Key = 000102030405060708090A0B0C0D0E0F
Result = EVPPKEYCTXCTRL_ERROR
Title = SIPHASH - explicit rounds
MAC = SipHash
Ctrl = size:0
Ctrl = c-rounds:2
Ctrl = d-rounds:4
Key = 000102030405060708090A0B0C0D0E0F
Input = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E
Output = 5150d1772f50834a503e069a973fbd7c
# Generated by the reference implementation
Title = SIPHASH - non-default values: 4,8 rounds
MAC = SipHash
Ctrl = size:8
Ctrl = c-rounds:4
Ctrl = d-rounds:8
Key = 000102030405060708090A0B0C0D0E0F
Input = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E
Output = E67784BC5503DE23