Add multi segment packet data walkthrough test for TLS 1.2
and DTLS 1.2.
Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com>
---
app/test/test_cryptodev.c | 42 +++++++++++++++++++
app/test/test_cryptodev_security_tls_record.h | 2 +-
2 files changed, 43 insertions(+), 1 deletion(-)
@@ -11981,6 +11981,8 @@ test_tls_record_proto_all(const struct tls_record_test_flags *flags)
for (i = 0; i < RTE_DIM(sec_alg_list); i++) {
payload_len = TLS_RECORD_PLAINTEXT_MIN_LEN;
+ if (flags->nb_segs_in_mbuf)
+ payload_len = RTE_MAX(payload_len, flags->nb_segs_in_mbuf);
again:
test_tls_record_td_prepare(sec_alg_list[i].param1, sec_alg_list[i].param2, flags,
td_outb, nb_pkts, payload_len);
@@ -12061,6 +12063,32 @@ test_tls_1_2_record_proto_sgl(void)
return test_tls_record_proto_all(&flags);
}
+static int
+test_tls_record_proto_sgl_data_walkthrough(enum rte_security_tls_version tls_version)
+{
+ struct tls_record_test_flags flags = {
+ .nb_segs_in_mbuf = 5,
+ .tls_version = tls_version,
+ .data_walkthrough = true
+ };
+ 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);
+ if (!(dev_info.feature_flags & RTE_CRYPTODEV_FF_IN_PLACE_SGL)) {
+ printf("Device doesn't support in-place scatter-gather. Test Skipped.\n");
+ return TEST_SKIPPED;
+ }
+
+ return test_tls_record_proto_all(&flags);
+}
+
+static int
+test_tls_1_2_record_proto_sgl_data_walkthrough(void)
+{
+ return test_tls_record_proto_sgl_data_walkthrough(RTE_SECURITY_VERSION_TLS_1_2);
+}
+
static int
test_dtls_1_2_record_proto_data_walkthrough(void)
{
@@ -12106,6 +12134,12 @@ test_dtls_1_2_record_proto_sgl(void)
return test_tls_record_proto_all(&flags);
}
+static int
+test_dtls_1_2_record_proto_sgl_data_walkthrough(void)
+{
+ return test_tls_record_proto_sgl_data_walkthrough(RTE_SECURITY_VERSION_DTLS_1_2);
+}
+
#endif
static int
@@ -17171,6 +17205,10 @@ static struct unit_test_suite tls12_record_proto_testsuite = {
"Multi-segmented mode",
ut_setup_security, ut_teardown,
test_tls_1_2_record_proto_sgl),
+ TEST_CASE_NAMED_ST(
+ "Multi-segmented mode data walkthrough",
+ ut_setup_security, ut_teardown,
+ test_tls_1_2_record_proto_sgl_data_walkthrough),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
@@ -17276,6 +17314,10 @@ static struct unit_test_suite dtls12_record_proto_testsuite = {
"Multi-segmented mode",
ut_setup_security, ut_teardown,
test_dtls_1_2_record_proto_sgl),
+ TEST_CASE_NAMED_ST(
+ "Multi-segmented mode data walkthrough",
+ ut_setup_security, ut_teardown,
+ test_dtls_1_2_record_proto_sgl_data_walkthrough),
TEST_CASES_END() /**< NULL terminate unit test array */
}
};
@@ -85,7 +85,7 @@ struct tls_record_test_data {
struct tls_record_test_flags {
bool display_alg;
- int nb_segs_in_mbuf;
+ uint8_t nb_segs_in_mbuf;
bool data_walkthrough;
enum rte_security_tls_version tls_version;
};