[v4,01/21] test/security: enable AES-GCM in combined mode TLS

Message ID 20240313055030.1685039-2-asasidharan@marvell.com (mailing list archive)
State Superseded, archived
Delegated to: akhil goyal
Headers
Series Improvements and new test cases |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Aakash Sasidharan March 13, 2024, 5:50 a.m. UTC
  Enable AES-GCM AEAD tests in combined mode TLS test suite.

Coverity issue: 414888
Fixes: 9157ccb8f876 ("test/crypto: verify TLS headers")

Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com>
---
 app/test/test_cryptodev_security_tls_record.c | 10 ++++++++--
 app/test/test_security_proto.h                |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)
  

Patch

diff --git a/app/test/test_cryptodev_security_tls_record.c b/app/test/test_cryptodev_security_tls_record.c
index bcb2eba4ff..14a7a2511e 100644
--- a/app/test/test_cryptodev_security_tls_record.c
+++ b/app/test/test_cryptodev_security_tls_record.c
@@ -116,6 +116,7 @@  test_tls_record_td_prepare(const struct crypto_param *param1, const struct crypt
 		}
 	} else {
 		mac_len = td->xform.aead.aead.digest_length;
+		roundup_len = 0;
 		exp_nonce_len = 8;
 	}
 
@@ -123,7 +124,10 @@  test_tls_record_td_prepare(const struct crypto_param *param1, const struct crypt
 	case RTE_SECURITY_VERSION_TLS_1_2:
 	case RTE_SECURITY_VERSION_TLS_1_3:
 		hdr_len = sizeof(struct rte_tls_hdr);
-		min_padding = 1;
+		if (td->aead)
+			min_padding = 0;
+		else
+			min_padding = 1;
 		break;
 	case RTE_SECURITY_VERSION_DTLS_1_2:
 		hdr_len = sizeof(struct rte_dtls_hdr);
@@ -139,7 +143,9 @@  test_tls_record_td_prepare(const struct crypto_param *param1, const struct crypt
 
 	/* Padding */
 	tls_pkt_size += min_padding;
-	tls_pkt_size = RTE_ALIGN_MUL_CEIL(tls_pkt_size, roundup_len);
+
+	if (roundup_len)
+		tls_pkt_size = RTE_ALIGN_MUL_CEIL(tls_pkt_size, roundup_len);
 
 	/* Explicit nonce */
 	tls_pkt_size += exp_nonce_len;
diff --git a/app/test/test_security_proto.h b/app/test/test_security_proto.h
index efa023b99d..5b92daa810 100644
--- a/app/test/test_security_proto.h
+++ b/app/test/test_security_proto.h
@@ -27,16 +27,19 @@  static const struct crypto_param aead_list[] = {
 		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
 		.alg.aead =  RTE_CRYPTO_AEAD_AES_GCM,
 		.key_length = 16,
+		.digest_length = 16,
 	},
 	{
 		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
 		.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
 		.key_length = 24,
+		.digest_length = 16,
 	},
 	{
 		.type = RTE_CRYPTO_SYM_XFORM_AEAD,
 		.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
 		.key_length = 32,
+		.digest_length = 16,
 	},
 	{
 		.type = RTE_CRYPTO_SYM_XFORM_AEAD,