diff mbox series

[API-NEXT,v13,3/18] validation: ipsec: verify odp_ipsec_sa_context

Message ID 1510527615-30536-4-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [API-NEXT,v13,1/18] linux-gen: ipsec: use counter instead of random IV for GCM | expand

Commit Message

Github ODP bot Nov. 12, 2017, 11 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


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

---
/** Email created from pull request 243 (lumag:ipsec-packet-impl-3)
 ** https://github.com/Linaro/odp/pull/243
 ** Patch: https://github.com/Linaro/odp/pull/243.patch
 ** Base sha: a908a4dead95321e84d6a8a23de060051dcd8969
 ** Merge commit sha: 7261a0ce35cc31342937cb57dcc287aea0c59ede
 **/
 test/validation/api/ipsec/ipsec.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c
index a8fdf2b14..853bd88a9 100644
--- a/test/validation/api/ipsec/ipsec.c
+++ b/test/validation/api/ipsec/ipsec.c
@@ -19,6 +19,9 @@  struct suite_context_s suite_context;
 #define PKT_POOL_NUM  64
 #define PKT_POOL_LEN  (1 * 1024)
 
+#define PACKET_USER_PTR	((void *)0x1212fefe)
+#define IPSEC_SA_CTX	((void *)0xfefefafa)
+
 static odp_pktio_t pktio_create(odp_pool_t pool)
 {
 	odp_pktio_t pktio;
@@ -300,6 +303,8 @@  void ipsec_sa_param_fill(odp_ipsec_sa_param_t *param,
 
 	param->dest_queue = suite_context.queue;
 
+	param->context = IPSEC_SA_CTX;
+
 	param->crypto.cipher_alg = cipher_alg;
 	if (cipher_key)
 		param->crypto.cipher_key = *cipher_key;
@@ -317,6 +322,8 @@  void ipsec_sa_destroy(odp_ipsec_sa_t sa)
 	odp_event_t event;
 	odp_ipsec_status_t status;
 
+	CU_ASSERT_EQUAL(IPSEC_SA_CTX, odp_ipsec_sa_context(sa));
+
 	CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_disable(sa));
 
 	if (ODP_QUEUE_INVALID != suite_context.queue) {
@@ -339,8 +346,6 @@  void ipsec_sa_destroy(odp_ipsec_sa_t sa)
 	CU_ASSERT_EQUAL(ODP_IPSEC_OK, odp_ipsec_sa_destroy(sa));
 }
 
-#define PACKET_USER_PTR	((void *)0x1212fefe)
-
 odp_packet_t ipsec_packet(const ipsec_test_packet *itp)
 {
 	odp_packet_t pkt = odp_packet_alloc(suite_context.pool, itp->len);
@@ -608,7 +613,13 @@  void ipsec_check_in_one(const ipsec_test_part *part, odp_ipsec_sa_t sa)
 			CU_ASSERT_EQUAL(0, odp_ipsec_result(&result, pkto[i]));
 			CU_ASSERT_EQUAL(part->out[i].status.error.all,
 					result.status.error.all);
+			CU_ASSERT_EQUAL(suite_context.inbound_op_mode ==
+					ODP_IPSEC_OP_MODE_INLINE,
+					result.flag.inline_mode);
 			CU_ASSERT_EQUAL(sa, result.sa);
+			if (ODP_IPSEC_SA_INVALID != sa)
+				CU_ASSERT_EQUAL(IPSEC_SA_CTX,
+						odp_ipsec_sa_context(sa));
 		}
 		ipsec_check_packet(part->out[i].pkt_out,
 				   pkto[i]);
@@ -642,6 +653,8 @@  void ipsec_check_out_one(const ipsec_test_part *part, odp_ipsec_sa_t sa)
 			CU_ASSERT_EQUAL(part->out[i].status.error.all,
 					result.status.error.all);
 			CU_ASSERT_EQUAL(sa, result.sa);
+			CU_ASSERT_EQUAL(IPSEC_SA_CTX,
+					odp_ipsec_sa_context(sa));
 		}
 		ipsec_check_packet(part->out[i].pkt_out,
 				   pkto[i]);
@@ -679,6 +692,8 @@  void ipsec_check_out_in_one(const ipsec_test_part *part,
 			CU_ASSERT_EQUAL(part->out[i].status.error.all,
 					result.status.error.all);
 			CU_ASSERT_EQUAL(sa, result.sa);
+			CU_ASSERT_EQUAL(IPSEC_SA_CTX,
+					odp_ipsec_sa_context(sa));
 		}
 		CU_ASSERT_FATAL(odp_packet_len(pkto[i]) <=
 				sizeof(pkt_in.data));