diff mbox series

[API-NEXT,v16,5/16] validation: ipsec: verify odp_ipsec_sa_context

Message ID 1510581630-13993-6-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v16,1/16] linux-gen: ipsec: use counter instead of random IV for GCM | expand

Commit Message

Github ODP bot Nov. 13, 2017, 2 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: 845914564f2d99792452ac22a524279f44496a1d
 **/
 test/validation/api/ipsec/ipsec.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/ipsec/ipsec.c b/test/validation/api/ipsec/ipsec.c
index ac0a083bd..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);
@@ -612,6 +617,9 @@  void ipsec_check_in_one(const ipsec_test_part *part, odp_ipsec_sa_t sa)
 					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]);
@@ -645,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]);
@@ -682,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));