diff mbox series

[v1,13/13] validation: ipsec: inbound TFC dummy packets check

Message ID 1519923609-31634-14-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v1,1/13] linux-gen: packet: implement packet l3/l4 proto types | expand

Commit Message

Github ODP bot March 1, 2018, 5 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>

Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>

---
/** Email created from pull request 505 (muvarov:devel/master_merge_api-next)
 ** https://github.com/Linaro/odp/pull/505
 ** Patch: https://github.com/Linaro/odp/pull/505.patch
 ** Base sha: 284f52d72ec19df3774c7409780f1f9eea33b8e6
 ** Merge commit sha: e8f50fefcd57a92e0971dc1172c5402c56b8370a
 **/
 test/validation/api/ipsec/ipsec_test_in.c | 43 ++++++++++++++++++++++++++++---
 test/validation/api/ipsec/test_vectors.h  | 19 +++++++++++++-
 2 files changed, 57 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/ipsec/ipsec_test_in.c b/test/validation/api/ipsec/ipsec_test_in.c
index d02cb2438..9c1112004 100644
--- a/test/validation/api/ipsec/ipsec_test_in.c
+++ b/test/validation/api/ipsec/ipsec_test_in.c
@@ -1131,13 +1131,17 @@  static void test_in_ipv4_mcgrew_gcm_4_esp(void)
 	ipsec_sa_destroy(sa);
 }
 
-#if 0
 static void test_in_ipv4_mcgrew_gcm_12_esp(void)
 {
 	odp_ipsec_tunnel_param_t tunnel = {};
 	odp_ipsec_sa_param_t param;
 	odp_ipsec_sa_t sa;
 
+	/* This test will not work properly inbound inline mode.
+	 * Packet might be dropped and we will not check for that. */
+	if (suite_context.inbound_op_mode == ODP_IPSEC_OP_MODE_INLINE)
+		return;
+
 	ipsec_sa_param_fill(&param,
 			    true, false, 0x335467ae, &tunnel,
 			    ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12,
@@ -1164,7 +1168,38 @@  static void test_in_ipv4_mcgrew_gcm_12_esp(void)
 
 	ipsec_sa_destroy(sa);
 }
-#endif
+
+static void test_in_ipv4_mcgrew_gcm_12_esp_notun(void)
+{
+	odp_ipsec_sa_param_t param;
+	odp_ipsec_sa_t sa;
+
+	ipsec_sa_param_fill(&param,
+			    true, false, 0x335467ae, NULL,
+			    ODP_CIPHER_ALG_AES_GCM, &key_mcgrew_gcm_12,
+			    ODP_AUTH_ALG_AES_GCM, NULL,
+			    &key_mcgrew_gcm_salt_12);
+
+	sa = odp_ipsec_sa_create(&param);
+
+	CU_ASSERT_NOT_EQUAL_FATAL(ODP_IPSEC_SA_INVALID, sa);
+
+	ipsec_test_part test = {
+		.pkt_in = &pkt_mcgrew_gcm_test_12_esp,
+		.out_pkt = 1,
+		.out = {
+			{ .status.warn.all = 0,
+			  .status.error.all = 0,
+			  .l3_type = ODP_PROTO_L3_TYPE_IPV4,
+			  .l4_type = ODP_PROTO_L4_TYPE_NO_NEXT,
+			  .pkt_out = &pkt_mcgrew_gcm_test_12_notun },
+		},
+	};
+
+	ipsec_check_in_one(&test, sa);
+
+	ipsec_sa_destroy(sa);
+}
 
 static void test_in_ipv4_mcgrew_gcm_15_esp(void)
 {
@@ -1584,10 +1619,10 @@  odp_testinfo_t ipsec_in_suite[] = {
 				  ipsec_check_esp_aes_gcm_256),
 	ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_4_esp,
 				  ipsec_check_esp_aes_gcm_128),
-#if 0
 	ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_12_esp,
 				  ipsec_check_esp_aes_gcm_128),
-#endif
+	ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_12_esp_notun,
+				  ipsec_check_esp_aes_gcm_128),
 	ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_mcgrew_gcm_15_esp,
 				  ipsec_check_esp_null_aes_gmac_128),
 	ODP_TEST_INFO_CONDITIONAL(test_in_ipv4_rfc7634_chacha,
diff --git a/test/validation/api/ipsec/test_vectors.h b/test/validation/api/ipsec/test_vectors.h
index f14fdb2b3..4d5ab3bdc 100644
--- a/test/validation/api/ipsec/test_vectors.h
+++ b/test/validation/api/ipsec/test_vectors.h
@@ -1641,7 +1641,7 @@  static const ipsec_test_packet pkt_mcgrew_gcm_test_4_esp = {
 static const ipsec_test_packet pkt_mcgrew_gcm_test_12 = {
 	.len = 14,
 	.l2_offset = 0,
-	.l3_offset = ODP_PACKET_OFFSET_INVALID,
+	.l3_offset = 14,
 	.l4_offset = ODP_PACKET_OFFSET_INVALID,
 	.data = {
 		/* ETH - not a part of RFC, added for simplicity */
@@ -1650,6 +1650,23 @@  static const ipsec_test_packet pkt_mcgrew_gcm_test_12 = {
 	},
 };
 
+static const ipsec_test_packet pkt_mcgrew_gcm_test_12_notun = {
+	.len = 34,
+	.l2_offset = 0,
+	.l3_offset = 14,
+	.l4_offset = 34,
+	.data = {
+		/* ETH - not a part of RFC, added for simplicity */
+		0xf1, 0xf1, 0xf1, 0xf1, 0xf1, 0xf1,
+		0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0xf2, 0x08, 0x00,
+
+		/* IP - not a part of RFC, added for simplicity */
+		0x45, 0x00, 0x00, 0x14, 0x69, 0x8f, 0x00, 0x00,
+		0x80, 0x3b, 0x4d, 0xcc, 0xc0, 0xa8, 0x01, 0x02,
+		0xc0, 0xa8, 0x01, 0x01,
+	},
+};
+
 static const ipsec_test_packet pkt_mcgrew_gcm_test_12_esp = {
 	.len = 70,
 	.l2_offset = 0,