[PATCH v2 20/21] test/crypto: unit tests for padding in DTLS-1.2
Aakash Sasidharan
asasidharan at marvell.com
Tue Mar 12 08:18:04 CET 2024
From: Vidya Sagar Velumuri <vvelumuri at marvell.com>
Add unit tests to verify the padding for DTLS-1.2.
Signed-off-by: Vidya Sagar Velumuri <vvelumuri at marvell.com>
---
app/test/test_cryptodev.c | 60 +++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index a324c1607b..572740cbf9 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -12483,6 +12483,42 @@ test_dtls_1_2_record_proto_zero_len_non_app(void)
return test_tls_record_proto_all(&flags);
}
+static int
+test_dtls_1_2_record_proto_dm_opt_padding(void)
+{
+ return test_tls_record_proto_opt_padding(1, 0, RTE_SECURITY_VERSION_DTLS_1_2);
+}
+
+static int
+test_dtls_1_2_record_proto_dm_opt_padding_1(void)
+{
+ return test_tls_record_proto_opt_padding(25, 0, RTE_SECURITY_VERSION_DTLS_1_2);
+}
+
+static int
+test_dtls_1_2_record_proto_sg_opt_padding(void)
+{
+ return test_tls_record_proto_opt_padding(1, 5, RTE_SECURITY_VERSION_DTLS_1_2);
+}
+
+static int
+test_dtls_1_2_record_proto_sg_opt_padding_1(void)
+{
+ return test_tls_record_proto_opt_padding(8, 4, RTE_SECURITY_VERSION_DTLS_1_2);
+}
+
+static int
+test_dtls_1_2_record_proto_sg_opt_padding_2(void)
+{
+ return test_tls_record_proto_opt_padding(8, 5, RTE_SECURITY_VERSION_DTLS_1_2);
+}
+
+static int
+test_dtls_1_2_record_proto_sg_opt_padding_max(void)
+{
+ return test_tls_record_proto_opt_padding(33, 4, RTE_SECURITY_VERSION_DTLS_1_2);
+}
+
static int
test_tls_1_3_record_proto_corrupt_pkt(void)
{
@@ -17824,6 +17860,30 @@ static struct unit_test_suite dtls12_record_proto_testsuite = {
"Antireplay with window size 4096",
ut_setup_security, ut_teardown,
test_dtls_1_2_record_proto_antireplay4096),
+ TEST_CASE_NAMED_ST(
+ "DTLS record DM mode with optional padding < 2 blocks",
+ ut_setup_security, ut_teardown,
+ test_dtls_1_2_record_proto_dm_opt_padding),
+ TEST_CASE_NAMED_ST(
+ "DTLS record DM mode with optional padding > 2 blocks",
+ ut_setup_security, ut_teardown,
+ test_dtls_1_2_record_proto_dm_opt_padding_1),
+ TEST_CASE_NAMED_ST(
+ "DTLS record SG mode with optional padding < 2 blocks",
+ ut_setup_security, ut_teardown,
+ test_dtls_1_2_record_proto_sg_opt_padding),
+ TEST_CASE_NAMED_ST(
+ "DTLS record SG mode with optional padding > 2 blocks",
+ ut_setup_security, ut_teardown,
+ test_dtls_1_2_record_proto_sg_opt_padding_1),
+ TEST_CASE_NAMED_ST(
+ "DTLS record SG mode with optional padding > 2 blocks",
+ ut_setup_security, ut_teardown,
+ test_dtls_1_2_record_proto_sg_opt_padding_2),
+ TEST_CASE_NAMED_ST(
+ "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_CASES_END() /**< NULL terminate unit test array */
}
};
--
2.25.1
More information about the dev
mailing list