[5/7] test/crypto: verify padding corruption in DTLS-1.2

Message ID 20240617055841.2359729-6-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 June 17, 2024, 5:58 a.m. UTC
From: Vidya Sagar Velumuri <vvelumuri@marvell.com>

Add unit test to verify corrupted padding bytes in DTLS-1.2 record

Signed-off-by: Vidya Sagar Velumuri <vvelumuri@marvell.com>
---
 app/test/test_cryptodev.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
  

Patch

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index f68864e117..89b54729eb 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -12709,6 +12709,23 @@  test_tls_1_3_record_proto_display_list(void)
 	return test_tls_record_proto_all(&flags);
 }
 
+static int
+test_dtls_1_2_record_proto_sg_opt_padding_corrupt(void)
+{
+	struct tls_record_test_flags flags = {
+		.opt_padding = 8,
+		.padding_corruption = true,
+		.nb_segs_in_mbuf = 4,
+		.tls_version = RTE_SECURITY_VERSION_DTLS_1_2
+	};
+	struct crypto_testsuite_params *ts_params = &testsuite_params;
+	struct rte_cryptodev_info dev_info;
+
+	rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info);
+
+	return test_tls_record_proto_all(&flags);
+}
+
 static int
 test_tls_1_3_record_proto_corrupt_pkt(void)
 {
@@ -18204,6 +18221,10 @@  static struct unit_test_suite dtls12_record_proto_testsuite  = {
 			"DTLS record SG mode with optional padding > max range",
 			ut_setup_security, ut_teardown,
 			test_dtls_1_2_record_proto_sg_opt_padding_max),
+		TEST_CASE_NAMED_ST(
+			"DTLS record SG mode with padding corruption",
+			ut_setup_security, ut_teardown,
+			test_dtls_1_2_record_proto_sg_opt_padding_corrupt),
 		TEST_CASES_END() /**< NULL terminate unit test array */
 	}
 };