[v2,2/3] app/test: add SHAKE test cases

Message ID 20230112104733.1835722-3-vfialko@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series Add support for SHAKE |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Volodymyr Fialko Jan. 12, 2023, 10:47 a.m. UTC
  Add test cases for SHAKE hash algorithm for Digest and Digest-Verify.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
---
 app/test/test_cryptodev_hash_test_vectors.h | 66 +++++++++++++++++++++
 1 file changed, 66 insertions(+)
  

Comments

Akhil Goyal Jan. 30, 2023, 7:25 p.m. UTC | #1
> Subject: [PATCH v2 2/3] app/test: add SHAKE test cases
> 
> Add test cases for SHAKE hash algorithm for Digest and Digest-Verify.
> 
> Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
> ---
Acked-by: Akhil Goyal <gakhil@marvell.com>
  

Patch

diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h
index 4b57286fa5..fa9986a4da 100644
--- a/app/test/test_cryptodev_hash_test_vectors.h
+++ b/app/test/test_cryptodev_hash_test_vectors.h
@@ -538,6 +538,52 @@  hmac_sha3_512_test_vector = {
 	}
 };
 
+static const struct blockcipher_test_data
+shake_128_test_vector = {
+	.auth_algo = RTE_CRYPTO_AUTH_SHAKE_128,
+	.ciphertext = {
+		.data = plaintext_hash,
+		.len = 512
+	},
+	.digest = {
+		.data = {
+			0x69, 0xBD, 0xD5, 0x14, 0x85, 0xE0, 0x44, 0xA4,
+			0x25, 0xE6, 0x9F, 0x81, 0xC8, 0x18, 0x58, 0x3E,
+			0xFE, 0xC9, 0x0B, 0xAD, 0x27, 0x98, 0x14, 0x3F,
+			0xB9, 0x7D, 0x68, 0x4D, 0x60, 0x77, 0x82, 0x64,
+			0x6D, 0x64, 0x66, 0x67, 0xFA, 0xBC, 0x4F, 0xAC,
+			0x9C, 0x75, 0x8D, 0x63, 0xBA, 0xBD, 0x2B, 0x03,
+			0x0F, 0x2F, 0x46, 0x15, 0x88, 0xF0, 0x8C, 0x09,
+			0xAC, 0x87, 0x84, 0x5B, 0xCA, 0x65, 0xA1, 0x14
+		},
+		.len = 64,
+		.truncated_len = 64
+	}
+};
+
+static const struct blockcipher_test_data
+shake_256_test_vector = {
+	.auth_algo = RTE_CRYPTO_AUTH_SHAKE_256,
+	.ciphertext = {
+		.data = plaintext_hash,
+		.len = 512
+	},
+	.digest = {
+		.data = {
+			0x9E, 0xA2, 0x1B, 0x84, 0x15, 0x0E, 0xF0, 0x46,
+			0xD9, 0xA9, 0x11, 0x02, 0x11, 0x67, 0x9A, 0xDC,
+			0x62, 0x95, 0x8C, 0xD6, 0xEF, 0x89, 0x35, 0x8C,
+			0xBF, 0x41, 0x5F, 0x23, 0x16, 0xBD, 0x0C, 0xDE,
+			0xEC, 0x1D, 0x47, 0x90, 0xA4, 0xD9, 0x18, 0x63,
+			0xE1, 0x60, 0xF8, 0xAF, 0x0F, 0x57, 0xBA, 0xCA,
+			0x5D, 0x97, 0x58, 0xF5, 0xFF, 0xE4, 0x85, 0x40,
+			0xCA, 0x7D, 0xB8, 0x35, 0x3B, 0x89, 0xCA, 0x34
+		},
+		.len = 64,
+		.truncated_len = 64
+	}
+};
+
 static const struct blockcipher_test_data
 cmac_test_vector = {
 	.auth_algo = RTE_CRYPTO_AUTH_AES_CMAC,
@@ -853,6 +899,26 @@  static const struct blockcipher_test_case hash_test_cases[] = {
 		.test_data = &hmac_sha3_512_test_vector,
 		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
 	},
+	{
+		.test_descr = "SHAKE_128 Digest",
+		.test_data = &shake_128_test_vector,
+		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
+	},
+	{
+		.test_descr = "SHAKE_128 Digest Verify",
+		.test_data = &shake_128_test_vector,
+		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
+	},
+	{
+		.test_descr = "SHAKE_256 Digest",
+		.test_data = &shake_256_test_vector,
+		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_GEN,
+	},
+	{
+		.test_descr = "SHAKE_256 Digest Verify",
+		.test_data = &shake_256_test_vector,
+		.op_mask = BLOCKCIPHER_TEST_OP_AUTH_VERIFY,
+	},
 	{
 		.test_descr = "CMAC Digest 12B",
 		.test_data = &cmac_test_vector_12,