From: Vidya Sagar Velumuri <vvelum...@marvell.com>

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

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

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index da8d7bf109..dd8880ed87 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -12705,6 +12705,19 @@ 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
+       };
+
+       return test_tls_record_proto_all(&flags);
+}
+
 static int
 test_tls_1_3_record_proto_corrupt_pkt(void)
 {
@@ -18200,6 +18213,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 */
        }
 };
-- 
2.25.1

Reply via email to