summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAakash Sasidharan <asasidharan@marvell.com>2024-03-13 16:28:44 +0530
committerAkhil Goyal <gakhil@marvell.com>2024-03-14 19:05:47 +0100
commit0ac4455c8f27aef459f7cdf836130ed091bae346 (patch)
tree8c4f16991991c0a6063bc2b23add0d507538a536 /app
parentb43bdaa4412d0dd295f9ae2a36772e42a8221b51 (diff)
test/crypto: add TLS SG data walkthrough test
Add multi segment packet data walkthrough test for TLS 1.2 and DTLS 1.2. Signed-off-by: Aakash Sasidharan <asasidharan@marvell.com> Acked-by: Anoob Joseph <anoobj@marvell.com> Acked-by: Akhil Goyal <gakhil@marvell.com>
Diffstat (limited to 'app')
-rw-r--r--app/test/test_cryptodev.c42
-rw-r--r--app/test/test_cryptodev_security_tls_record.h2
2 files changed, 43 insertions, 1 deletions
diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index e0695e9eb3..3591c91130 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -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);
@@ -12062,6 +12064,32 @@ test_tls_1_2_record_proto_sgl(void)
}
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)
{
struct tls_record_test_flags flags;
@@ -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 */
}
};
diff --git a/app/test/test_cryptodev_security_tls_record.h b/app/test/test_cryptodev_security_tls_record.h
index 56d9d11962..a6c537b35a 100644
--- a/app/test/test_cryptodev_security_tls_record.h
+++ b/app/test/test_cryptodev_security_tls_record.h
@@ -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;
};