[2/2] test/crypto: specify correct parameters with null algos

Message ID 20230512053353.68-2-anoobj@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: akhil goyal
Headers
Series [1/2] test/crypto: use separate keys for auth and cipher |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing fail Testing issues
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-unit-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS

Commit Message

Anoob Joseph May 12, 2023, 5:33 a.m. UTC
  Keys are not required for NULL algorithms. Same way IV, digest lengths
should also be set to 0. The values are invalid and any PMD which
validates such parameters would return "-ENOTSUP" for such cases which
would result in false skipping of tests.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
---
 app/test/test_cryptodev_aes_test_vectors.h   | 114 ++++++-------------
 app/test/test_cryptodev_hash_test_vectors.h  |  19 +---
 app/test/test_cryptodev_mixed_test_vectors.h |  92 +++++----------
 3 files changed, 71 insertions(+), 154 deletions(-)
  

Comments

Akhil Goyal May 16, 2023, 10:22 a.m. UTC | #1
> Subject: [PATCH 2/2] test/crypto: specify correct parameters with null algos
> 
> Keys are not required for NULL algorithms. Same way IV, digest lengths
> should also be set to 0. The values are invalid and any PMD which
> validates such parameters would return "-ENOTSUP" for such cases which
> would result in false skipping of tests.
> 
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  
Power, Ciara May 17, 2023, 3:50 p.m. UTC | #2
Hi Anoob,

> -----Original Message-----
> From: Anoob Joseph <anoobj@marvell.com>
> Sent: Friday 12 May 2023 06:34
> To: Akhil Goyal <gakhil@marvell.com>; Fan Zhang
> <fanzhang.oss@gmail.com>; Power, Ciara <ciara.power@intel.com>
> Cc: Hemant Agrawal <hemant.agrawal@nxp.com>; Jerin Jacob
> <jerinj@marvell.com>; Tejasree Kondoj <ktejasree@marvell.com>;
> dev@dpdk.org
> Subject: [PATCH 2/2] test/crypto: specify correct parameters with null algos
> 
> Keys are not required for NULL algorithms. Same way IV, digest lengths
> should also be set to 0. The values are invalid and any PMD which validates
> such parameters would return "-ENOTSUP" for such cases which would result
> in false skipping of tests.
> 
> Signed-off-by: Anoob Joseph <anoobj@marvell.com>
> ---
>  app/test/test_cryptodev_aes_test_vectors.h   | 114 ++++++-------------
>  app/test/test_cryptodev_hash_test_vectors.h  |  19 +---
> app/test/test_cryptodev_mixed_test_vectors.h |  92 +++++----------
>  3 files changed, 71 insertions(+), 154 deletions(-)
<snip>

+1 for this change, not sure why data was added in these vectors.
In saying that, it seems to fail for QAT autotest....
Passing for AESNI_MB PMD though.

Will need to debug a little more for QAT failure, not sure why this is happening yet.

Thanks,
Ciara
  

Patch

diff --git a/app/test/test_cryptodev_aes_test_vectors.h b/app/test/test_cryptodev_aes_test_vectors.h
index f3686beeb5..7127156cc4 100644
--- a/app/test/test_cryptodev_aes_test_vectors.h
+++ b/app/test/test_cryptodev_aes_test_vectors.h
@@ -894,19 +894,13 @@  static const struct blockcipher_test_data aes_test_data_21 = {
 /* NULL cipher NULL auth 8-byte multiple test vector */
 static const struct blockcipher_test_data null_test_data_chain_x8_multiple = {
 	.crypto_algo = RTE_CRYPTO_CIPHER_NULL,
-	.cipher_key = {	/* arbitrary data - shouldn't be used */
-		.data = {
-			0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-			0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-		},
-		.len = 16
+	.cipher_key = {
+		.data = { 0x0 },
+		.len = 0
 	},
-	.iv = {			/* arbitrary data - shouldn't be used */
-		.data = {
-			0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
-			0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
-		},
-		.len = 16
+	.iv = {
+		.data = { 0x0 },
+		.len = 0
 	},
 	.plaintext = {
 		.data = plaintext_aes_common,
@@ -917,41 +911,27 @@  static const struct blockcipher_test_data null_test_data_chain_x8_multiple = {
 		.len = 512
 	},
 	.auth_algo = RTE_CRYPTO_AUTH_NULL,
-	.auth_key = {		/* arbitrary data - shouldn't be used */
-		.data = {
-			0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
-			0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
-			0xDE, 0xF4, 0xDE, 0xAD
-		},
-		.len = 20
+	.auth_key = {
+		.data = { 0x0 },
+		.len = 0
 	},
 	.digest = {
-		.data = {
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00
-		},
-		.len = 20,
-		.truncated_len = 12
+		.data = { 0x0 },
+		.len = 0,
+		.truncated_len = 0
 	}
 };
 
 /* NULL cipher NULL auth 4-byte multiple test vector */
 static const struct blockcipher_test_data null_test_data_chain_x4_multiple = {
 	.crypto_algo = RTE_CRYPTO_CIPHER_NULL,
-	.cipher_key = {	/* arbitrary data - shouldn't be used */
-		.data = {
-			0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-			0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-		},
-		.len = 16
+	.cipher_key = {
+		.data = { 0x0 },
+		.len = 0
 	},
-	.iv = {			/* arbitrary data - shouldn't be used */
-		.data = {
-			0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
-			0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
-		},
-		.len = 16
+	.iv = {
+		.data = { 0x0 },
+		.len = 0
 	},
 	.plaintext = {
 		.data = plaintext_aes128ctr,
@@ -962,41 +942,27 @@  static const struct blockcipher_test_data null_test_data_chain_x4_multiple = {
 		.len = 20
 	},
 	.auth_algo = RTE_CRYPTO_AUTH_NULL,
-	.auth_key = {		/* arbitrary data - shouldn't be used */
-		.data = {
-			0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
-			0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
-			0xDE, 0xF4, 0xDE, 0xAD
-		},
-		.len = 20
+	.auth_key = {
+		.data = { 0x0 },
+		.len = 0
 	},
 	.digest = {
-		.data = {
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00
-		},
-		.len = 20,
-		.truncated_len = 12
+		.data = { 0x0 },
+		.len = 0,
+		.truncated_len = 0
 	}
 };
 
 /* NULL cipher NULL auth 1-byte multiple test vector */
 static const struct blockcipher_test_data null_test_data_chain_x1_multiple = {
 	.crypto_algo = RTE_CRYPTO_CIPHER_NULL,
-	.cipher_key = {	/* arbitrary data - shouldn't be used */
-		.data = {
-			0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-			0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-		},
-		.len = 16
+	.cipher_key = {
+		.data = { 0x0 },
+		.len = 0
 	},
-	.iv = {			/* arbitrary data - shouldn't be used */
-		.data = {
-			0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
-			0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
-		},
-		.len = 16
+	.iv = {
+		.data = { 0x0 },
+		.len = 0
 	},
 	.plaintext = {
 		.data = plaintext_aes128ctr,
@@ -1007,22 +973,14 @@  static const struct blockcipher_test_data null_test_data_chain_x1_multiple = {
 		.len = 21
 	},
 	.auth_algo = RTE_CRYPTO_AUTH_NULL,
-	.auth_key = {		/* arbitrary data - shouldn't be used */
-		.data = {
-			0xF8, 0x2A, 0xC7, 0x54, 0xDB, 0x96, 0x18, 0xAA,
-			0xC3, 0xA1, 0x53, 0xF6, 0x1F, 0x17, 0x60, 0xBD,
-			0xDE, 0xF4, 0xDE, 0xAD
-		},
-		.len = 20
+	.auth_key = {
+		.data = { 0x0 },
+		.len = 0
 	},
 	.digest = {
-		.data = {
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00
-		},
-		.len = 20,
-		.truncated_len = 12
+		.data = { 0x0 },
+		.len = 0,
+		.truncated_len = 0
 	}
 };
 
diff --git a/app/test/test_cryptodev_hash_test_vectors.h b/app/test/test_cryptodev_hash_test_vectors.h
index fa9986a4da..06db248831 100644
--- a/app/test/test_cryptodev_hash_test_vectors.h
+++ b/app/test/test_cryptodev_hash_test_vectors.h
@@ -640,21 +640,14 @@  null_auth_test_vector = {
 		.data = plaintext_hash,
 		.len = 512
 	},
-	.auth_key = {		/* arbitrary data - shouldn't be used */
-		.data = {
-			0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-			0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-		},
-		.len = 16
+	.auth_key = {
+		.data = { 0x0 },
+		.len = 0
 	},
 	.digest = {
-		.data = {
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-			0x00, 0x00, 0x00, 0x00
-		},
-		.len = 20,
-		.truncated_len = 12
+		.data = { 0x0 },
+		.len = 0,
+		.truncated_len = 0
 	}
 };
 
diff --git a/app/test/test_cryptodev_mixed_test_vectors.h b/app/test/test_cryptodev_mixed_test_vectors.h
index 2816ecc6a4..161e2d905f 100644
--- a/app/test/test_cryptodev_mixed_test_vectors.h
+++ b/app/test/test_cryptodev_mixed_test_vectors.h
@@ -1084,21 +1084,15 @@  struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_zuc_test_case_1 = {
 struct mixed_cipher_auth_test_data auth_null_cipher_snow_test_case_1 = {
 	.auth_algo = RTE_CRYPTO_AUTH_NULL,
 	.auth_key = {
-		.data = {
-			0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
-			0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.auth_iv = {
-		.data = {
-			0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
-			0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.auth = {
-		.len_bits = 44 << 3,
+		.len_bits = 0,
 		.offset_bits = 0,
 	},
 	.cipher_algo = RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
@@ -1163,21 +1157,15 @@  struct mixed_cipher_auth_test_data auth_null_cipher_snow_test_case_1 = {
 struct mixed_cipher_auth_test_data auth_null_cipher_zuc_test_case_1 = {
 	.auth_algo = RTE_CRYPTO_AUTH_NULL,
 	.auth_key = {
-		.data = {
-			0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
-			0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.auth_iv = {
-		.data = {
-			0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
-			0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.auth = {
-		.len_bits = 48 << 3,
+		.len_bits = 0,
 		.offset_bits = 0,
 	},
 	.cipher_algo = RTE_CRYPTO_CIPHER_ZUC_EEA3,
@@ -1262,21 +1250,15 @@  struct mixed_cipher_auth_test_data auth_snow_cipher_null_test_case_1 = {
 	},
 	.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
 	.cipher_key = {
-		.data = {
-			0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
-			0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.cipher_iv = {
-		.data = {
-			0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
-			0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.cipher = {
-		.len_bits = 52 << 3,
+		.len_bits = 0,
 		.offset_bits = 0,
 	},
 	.plaintext = {
@@ -1342,21 +1324,15 @@  struct mixed_cipher_auth_test_data auth_zuc_cipher_null_test_case_1 = {
 	},
 	.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
 	.cipher_key = {
-		.data = {
-			0xc9, 0xe6, 0xce, 0xc4, 0x60, 0x7c, 0x72, 0xdb,
-			0x00, 0x0a, 0xef, 0xa8, 0x83, 0x85, 0xab, 0x0a
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.cipher_iv = {
-		.data = {
-			0xa9, 0x40, 0x59, 0xda, 0x50, 0x00, 0x00, 0x00,
-			0x29, 0x40, 0x59, 0xda, 0x50, 0x00, 0x80, 0x00
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.cipher = {
-		.len_bits = 77 << 3,
+		.len_bits = 0,
 		.offset_bits = 0,
 	},
 	.plaintext = {
@@ -1410,21 +1386,15 @@  struct mixed_cipher_auth_test_data auth_zuc_cipher_null_test_case_1 = {
 struct mixed_cipher_auth_test_data auth_null_cipher_aes_ctr_test_case_1 = {
 	.auth_algo = RTE_CRYPTO_AUTH_NULL,
 	.auth_key = {
-		.data = {
-			0xC7, 0x36, 0xC6, 0xAA, 0xB2, 0x2B, 0xFF, 0xF9,
-			0x1E, 0x26, 0x98, 0xD2, 0xE2, 0x2A, 0xD5, 0x7E
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.auth_iv = {
-		.data = {
-			0x14, 0x79, 0x3E, 0x41, 0x03, 0x97, 0xE8, 0xFD,
-			0x94, 0x79, 0x3E, 0x41, 0x03, 0x97, 0x68, 0xFD
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.auth = {
-		.len_bits = 48 << 3,
+		.len_bits = 0,
 		.offset_bits = 0,
 	},
 	.cipher_algo = RTE_CRYPTO_CIPHER_AES_CTR,
@@ -1507,19 +1477,15 @@  struct mixed_cipher_auth_test_data auth_aes_cmac_cipher_null_test_case_1 = {
 	},
 	.cipher_algo = RTE_CRYPTO_CIPHER_NULL,
 	.cipher_key = {
-		.data = {
-			0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-			0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-		},
-		.len = 16,
+		.data = { 0x0 },
+		.len = 0,
 	},
 	.cipher_iv = {
-		.data = {
-		},
+		.data = { 0x0 },
 		.len = 0,
 	},
 	.cipher = {
-		.len_bits = 516 << 3,
+		.len_bits = 0,
 		.offset_bits = 0,
 	},
 	.plaintext = {