summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-02-25 04:49:37 +0100
committerPauli <ppzgs1@gmail.com>2021-02-28 08:25:49 +0100
commit41df96efc150d3ccee01ab692d882ddba3d2d3d8 (patch)
treeaf2b9113e22f87c5f1dde3abad45f51ebf44ed8e /test
parenttls: updates for the new additional MAC_init arguments (diff)
downloadopenssl-41df96efc150d3ccee01ab692d882ddba3d2d3d8.tar.xz
openssl-41df96efc150d3ccee01ab692d882ddba3d2d3d8.zip
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)
Diffstat (limited to 'test')
-rw-r--r--test/evp_test.c11
-rw-r--r--test/recipes/30-test_evp_data/evpmac_blake.txt4
-rw-r--r--test/recipes/30-test_evp_data/evpmac_common.txt2
-rw-r--r--test/recipes/30-test_evp_data/evpmac_siphash.txt23
4 files changed, 26 insertions, 14 deletions
diff --git a/test/evp_test.c b/test/evp_test.c
index d3b02a2e46..b9b1597be1 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -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;
}
diff --git a/test/recipes/30-test_evp_data/evpmac_blake.txt b/test/recipes/30-test_evp_data/evpmac_blake.txt
index ad5836a175..416d6b25dd 100644
--- a/test/recipes/30-test_evp_data/evpmac_blake.txt
+++ b/test/recipes/30-test_evp_data/evpmac_blake.txt
@@ -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
diff --git a/test/recipes/30-test_evp_data/evpmac_common.txt b/test/recipes/30-test_evp_data/evpmac_common.txt
index dcea924695..67a0d3482d 100644
--- a/test/recipes/30-test_evp_data/evpmac_common.txt
+++ b/test/recipes/30-test_evp_data/evpmac_common.txt
@@ -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)
diff --git a/test/recipes/30-test_evp_data/evpmac_siphash.txt b/test/recipes/30-test_evp_data/evpmac_siphash.txt
index 2e24f8b1e5..028b2d656f 100644
--- a/test/recipes/30-test_evp_data/evpmac_siphash.txt
+++ b/test/recipes/30-test_evp_data/evpmac_siphash.txt
@@ -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