Skip to contentSkip to conversation

update autotest with new algorithms

PATCH Applied Tejasree Kondoj 2 participants 8 messages Oct 21, 2022

lore
Share & tools
lore
#0 lore raw

v2 cover update autotest with new algorithms

This series updates autotest with DES, 3DES, MD5
and custom UDP ports support.

v2:
* Squashed a change in 5th patch with 2nd one.

Tejasree Kondoj (2):
test/crypto: check antireply capability only for ingress test/crypto: add unit test for custom UDP ports

Vidya Sagar Velumuri (4):
test/security: add unit tests for DES and 3DES test/security: add unit tests for auth algo MD5 test/security: update antireplay unit test for event mode test/crypto: add unit tests for DES and MD5

 app/test/test_cryptodev.c                     |   71 ++
 app/test/test_cryptodev_security_ipsec.c      |   83 +-
 app/test/test_cryptodev_security_ipsec.h      |   19 +
 ...st_cryptodev_security_ipsec_test_vectors.h | 1059 ++++++++++++++++-
 app/test/test_security_inline_proto.c         |  120 +-
 5 files changed, 1286 insertions(+), 66 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/6 test/security: add unit tests for DES and 3DES

From: Vidya Sagar Velumuri <[email protected]>

Add unit test cases and test vectors for DES-CBC
and 3DES-CBC.

---
 app/test/test_cryptodev_security_ipsec.h      |  12 +
 ...st_cryptodev_security_ipsec_test_vectors.h | 876 ++++++++++++++++++
 app/test/test_security_inline_proto.c         |  89 ++
 3 files changed, 977 insertions(+)
app/test/test_cryptodev_security_ipsec.h +12 -0
index 67b783e637..95e86a05e0 100644
@@ -150,6 +150,18 @@ static const struct crypto_param cipher_list[] = {
 		.key_length = 0,
 		.iv_length = 0,
 	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_DES_CBC,
+		.key_length = 8,
+		.iv_length = 8,
+	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+		.alg.cipher =  RTE_CRYPTO_CIPHER_3DES_CBC,
+		.key_length = 24,
+		.iv_length = 8,
+	},
 	{
 		.type = RTE_CRYPTO_SYM_XFORM_CIPHER,
 		.alg.cipher =  RTE_CRYPTO_CIPHER_AES_CBC,
app/test/test_cryptodev_security_ipsec_test_vectors.h +876 -0

888 lines not on this page · raw message

app/test/test_security_inline_proto.c +89 -0

129 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

PATCH v2 2/6 test/security: add unit tests for auth algo MD5

In reply to Tejasree Kondoj

From: Vidya Sagar Velumuri <[email protected]>

Add unit test cases for MD5 auth algo.
Add the test vectors for MD5 auth algo.

---
 app/test/test_cryptodev_security_ipsec.h      |   6 +
 ...st_cryptodev_security_ipsec_test_vectors.h | 107 ++++++++++++++++++
 app/test/test_security_inline_proto.c         |  11 ++
 3 files changed, 124 insertions(+)
app/test/test_cryptodev_security_ipsec.h +6 -0
index 95e86a05e0..b98f4741b2 100644
@@ -193,6 +193,12 @@ static const struct crypto_param auth_list[] = {
 		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
 		.alg.auth =  RTE_CRYPTO_AUTH_NULL,
 	},
+	{
+		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
+		.alg.auth =  RTE_CRYPTO_AUTH_MD5_HMAC,
+		.key_length = 16,
+		.digest_length = 12,
+	},
 	{
 		.type = RTE_CRYPTO_SYM_XFORM_AUTH,
 		.alg.auth =  RTE_CRYPTO_AUTH_SHA256_HMAC,
app/test/test_cryptodev_security_ipsec_test_vectors.h +107 -0

113 lines not on this page · raw message

app/test/test_security_inline_proto.c +11 -0
index 289778d9be..feef54f538 100644
@@ -71,6 +71,7 @@ extern struct ipsec_test_data pkt_des_cbc_hmac_sha256;
 extern struct ipsec_test_data pkt_des_cbc_hmac_sha384;
 extern struct ipsec_test_data pkt_des_cbc_hmac_sha512;
 extern struct ipsec_test_data pkt_des_cbc_hmac_sha256_v6;
+extern struct ipsec_test_data pkt_aes_128_cbc_md5;
 
 static struct rte_mempool *mbufpool;
 static struct rte_mempool *sess_pool;
@@ -2577,6 +2578,11 @@ static struct unit_test_suite inline_ipsec_testsuite  = {
 			"Outbound known vector (ESP tunnel mode IPv4 AES-GCM 256)",
 			ut_setup_inline_ipsec, ut_teardown_inline_ipsec,
 			test_ipsec_inline_proto_known_vec, &pkt_aes_256_gcm),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Outbound known vector (ESP tunnel mode IPv4 AES-CBC MD5 [12B ICV])",
+			ut_setup_inline_ipsec, ut_teardown_inline_ipsec,
+			test_ipsec_inline_proto_known_vec,
+			&pkt_aes_128_cbc_md5),
 		TEST_CASE_NAMED_WITH_DATA(
 			"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])",
 			ut_setup_inline_ipsec, ut_teardown_inline_ipsec,
@@ -2669,6 +2675,11 @@ static struct unit_test_suite inline_ipsec_testsuite  = {
 			"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)",
 			ut_setup_inline_ipsec, ut_teardown_inline_ipsec,
 			test_ipsec_inline_proto_known_vec_inb, &pkt_aes_128_cbc_null),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Inbound known vector (ESP tunnel mode IPv4 AES-CBC MD5 [12B ICV])",
+			ut_setup_inline_ipsec, ut_teardown_inline_ipsec,
+			test_ipsec_inline_proto_known_vec_inb,
+			&pkt_aes_128_cbc_md5),
 		TEST_CASE_NAMED_WITH_DATA(
 			"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])",
 			ut_setup_inline_ipsec, ut_teardown_inline_ipsec,
Signature · 1 line
2.25.1
#3 lore raw

PATCH v2 3/6 test/security: update antireplay unit test for event mode

In reply to Tejasree Kondoj

From: Vidya Sagar Velumuri <[email protected]>

With event mode is enabled, send and receive packets via event dev

---
 app/test/test_security_inline_proto.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
app/test/test_security_inline_proto.c +14 -6
index feef54f538..700ed3844b 100644
@@ -1378,8 +1378,13 @@ test_ipsec_inline_proto_process_with_esn(struct ipsec_test_data td[],
 						tx_pkt, NULL);
 			tx_pkt->ol_flags |= RTE_MBUF_F_TX_SEC_OFFLOAD;
 		}
+
 		/* Send packet to ethdev for inline IPsec processing. */
-		nb_sent = rte_eth_tx_burst(port_id, 0, &tx_pkt, 1);
+		if (event_mode_enabled)
+			nb_sent = event_tx_burst(&tx_pkt, 1);
+		else
+			nb_sent = rte_eth_tx_burst(port_id, 0, &tx_pkt, 1);
+
 		if (nb_sent != 1) {
 			printf("\nUnable to TX packets");
 			rte_pktmbuf_free(tx_pkt);
@@ -1390,11 +1395,14 @@ test_ipsec_inline_proto_process_with_esn(struct ipsec_test_data td[],
 		rte_pause();
 
 		/* Receive back packet on loopback interface. */
-		do {
-			rte_delay_ms(1);
-			nb_rx = rte_eth_rx_burst(port_id, 0, &rx_pkt, 1);
-		} while (nb_rx == 0);
-
+		if (event_mode_enabled)
+			nb_rx = event_rx_burst(&rx_pkt, nb_sent);
+		else {
+			do {
+				rte_delay_ms(1);
+				nb_rx = rte_eth_rx_burst(port_id, 0, &rx_pkt, 1);
+			} while (nb_rx == 0);
+		}
 		rte_pktmbuf_adj(rx_pkt, RTE_ETHER_HDR_LEN);
 
 		if (res_d != NULL)
Signature · 1 line
2.25.1
#4 lore raw

PATCH v2 4/6 test/crypto: check antireply capability only for ingress

In reply to Tejasree Kondoj

From: Vidya Sagar Velumuri <[email protected]>

Antireplay is supported only for ingress. Check this capability only for ingress.

---
 app/test/test_cryptodev_security_ipsec.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
app/test/test_cryptodev_security_ipsec.c +7 -5
index cb77b39dbb..3219b41e39 100644
@@ -202,11 +202,13 @@ test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform,
 		return -ENOTSUP;
 	}
 
-	if (ipsec_xform->replay_win_sz > sec_cap->ipsec.replay_win_sz_max) {
-		if (!silent)
-			RTE_LOG(INFO, USER1,
-				"Replay window size is not supported\n");
-		return -ENOTSUP;
+	if (ipsec_xform->direction == RTE_SECURITY_IPSEC_SA_DIR_INGRESS) {
+		if (ipsec_xform->replay_win_sz > sec_cap->ipsec.replay_win_sz_max) {
+			if (!silent)
+				RTE_LOG(INFO, USER1,
+					"Replay window size is not supported\n");
+			return -ENOTSUP;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.25.1
#5 lore raw

PATCH v2 5/6 test/crypto: add unit tests for DES and MD5

In reply to Tejasree Kondoj

From: Vidya Sagar Velumuri <[email protected]>

Add unit test cases for auth algo MD5.
Add unit test cases for cipher DES-CBC.

---
 app/test/test_cryptodev.c | 50 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 50 insertions(+)
app/test/test_cryptodev.c +50 -0
index c2b33686ed..96941dd55c 100644
@@ -15179,6 +15179,11 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			"Outbound known vector (ESP tunnel mode IPv4 AES-CCM 256)",
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_known_vec, &pkt_aes_256_ccm),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Outbound known vector (ESP tunnel mode IPv4 AES-CBC MD5 [12B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec,
+			&pkt_aes_128_cbc_md5),
 		TEST_CASE_NAMED_WITH_DATA(
 			"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])",
 			ut_setup_security, ut_teardown,
@@ -15208,6 +15213,26 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_known_vec,
 			&pkt_null_aes_xcbc),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Outbound known vector (ESP tunnel mode IPv4 DES-CBC HMAC-SHA256 [16B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec,
+			&pkt_des_cbc_hmac_sha256),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Outbound known vector (ESP tunnel mode IPv4 DES-CBC HMAC-SHA384 [24B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec,
+			&pkt_des_cbc_hmac_sha384),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Outbound known vector (ESP tunnel mode IPv4 DES-CBC HMAC-SHA512 [32B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec,
+			&pkt_des_cbc_hmac_sha512),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Outbound known vector (ESP tunnel mode IPv6 DES-CBC HMAC-SHA256 [16B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec,
+			&pkt_des_cbc_hmac_sha256_v6),
 		TEST_CASE_NAMED_WITH_DATA(
 			"Outbound known vector (AH tunnel mode IPv4 HMAC-SHA256)",
 			ut_setup_security, ut_teardown,
@@ -15248,6 +15273,11 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)",
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_known_vec_inb, &pkt_aes_128_cbc_null),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Inbound known vector (ESP tunnel mode IPv4 AES-CBC MD5 [12B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec_inb,
+			&pkt_aes_128_cbc_md5),
 		TEST_CASE_NAMED_WITH_DATA(
 			"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])",
 			ut_setup_security, ut_teardown,
@@ -15277,6 +15307,26 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_known_vec_inb,
 			&pkt_null_aes_xcbc),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Inbound known vector (ESP tunnel mode IPv4 DES-CBC HMAC-SHA256 [16B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec_inb,
+			&pkt_des_cbc_hmac_sha256),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Inbound known vector (ESP tunnel mode IPv4 DES-CBC HMAC-SHA384 [24B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec_inb,
+			&pkt_des_cbc_hmac_sha384),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Inbound known vector (ESP tunnel mode IPv4 DES-CBC HMAC-SHA512 [32B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec_inb,
+			&pkt_des_cbc_hmac_sha512),
+		TEST_CASE_NAMED_WITH_DATA(
+			"Inbound known vector (ESP tunnel mode IPv6 DES-CBC HMAC-SHA256 [16B ICV])",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_known_vec_inb,
+			&pkt_des_cbc_hmac_sha256_v6),
 		TEST_CASE_NAMED_WITH_DATA(
 			"Inbound known vector (AH tunnel mode IPv4 HMAC-SHA256)",
 			ut_setup_security, ut_teardown,
Signature · 1 line
2.25.1
#6 lore raw

PATCH v2 6/6 test/crypto: add unit test for custom UDP ports

In reply to Tejasree Kondoj

From: Vidya Sagar Velumuri <[email protected]>

Add unit test for custom UDP ports with UDP encapsulation. Verify UDP header in egress path for all unit tests.

---
 app/test/test_cryptodev.c                | 21 +++++++
 app/test/test_cryptodev_security_ipsec.c | 71 ++++++++++++++++++------
 app/test/test_cryptodev_security_ipsec.h |  1 +
 3 files changed, 76 insertions(+), 17 deletions(-)
app/test/test_cryptodev.c +21 -0
index 96941dd55c..43fcef7e73 100644
@@ -9892,6 +9892,23 @@ test_ipsec_proto_err_icv_corrupt(const void *data __rte_unused)
 	return test_ipsec_proto_all(&flags);
 }
 
+static int
+test_ipsec_proto_udp_encap_custom_ports(const void *data __rte_unused)
+{
+	struct ipsec_test_flags flags;
+
+	if (gbl_driver_id == rte_cryptodev_driver_id_get(
+			RTE_STR(CRYPTODEV_NAME_CN10K_PMD)))
+		return TEST_SKIPPED;
+
+	memset(&flags, 0, sizeof(flags));
+
+	flags.udp_encap = true;
+	flags.udp_encap_custom_ports = true;
+
+	return test_ipsec_proto_all(&flags);
+}
+
 static int
 test_ipsec_proto_udp_encap(const void *data __rte_unused)
 {
@@ -15358,6 +15375,10 @@ static struct unit_test_suite ipsec_proto_testsuite  = {
 			"UDP encapsulation",
 			ut_setup_security, ut_teardown,
 			test_ipsec_proto_udp_encap),
+		TEST_CASE_NAMED_ST(
+			"UDP encapsulation with custom ports",
+			ut_setup_security, ut_teardown,
+			test_ipsec_proto_udp_encap_custom_ports),
 		TEST_CASE_NAMED_ST(
 			"UDP encapsulation ports verification test",
 			ut_setup_security, ut_teardown,
app/test/test_cryptodev_security_ipsec.c +54 -17

95 lines not on this page · raw message

app/test/test_cryptodev_security_ipsec.h +1 -0
index b98f4741b2..008b17c290 100644
@@ -93,6 +93,7 @@ struct ipsec_test_flags {
 	uint32_t tunnel_hdr_verify;
 	bool udp_encap;
 	bool udp_ports_verify;
+	bool udp_encap_custom_ports;
 	bool ip_csum;
 	bool l4_csum;
 	bool ipv6;
Signature · 1 line
2.25.1
Applied
#7 lore raw
In reply to Tejasree Kondoj
Quoted 9 lines

Subject: [PATCH v2 0/6] update autotest with new algorithms

This series updates autotest with DES, 3DES, MD5
and custom UDP ports support.

v2:
* Squashed a change in 5th patch with 2nd one.

Series Acked-by: Akhil Goyal <[email protected]>

Applied to dpdk-next-crypto

Thanks.