summaryrefslogtreecommitdiffstats
path: root/src/plugins/ikev2/ikev2.c
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2020-07-06 14:52:25 +0000
committerBenoƮt Ganne <bganne@cisco.com>2020-07-07 08:18:57 +0000
commit190983de619e340a148cff8b1b1d8c9e0cd8c95a (patch)
treede24a96080ee53bd327b2eb0ccd5c48a379d5d49 /src/plugins/ikev2/ikev2.c
parent742000af2043ab2f9b18f5a062491fe1ab66573e (diff)
ikev2: per thread usage of openssl context
Type: refactor Change-Id: I04af90b4d86c00092ce1732aeb3c0517af1808e0 Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Diffstat (limited to 'src/plugins/ikev2/ikev2.c')
-rw-r--r--src/plugins/ikev2/ikev2.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/plugins/ikev2/ikev2.c b/src/plugins/ikev2/ikev2.c
index 8537e0a40ad..08a66cbf8fa 100644
--- a/src/plugins/ikev2/ikev2.c
+++ b/src/plugins/ikev2/ikev2.c
@@ -3989,10 +3989,22 @@ ikev2_init (vlib_main_t * vm)
vec_validate_aligned (km->per_thread_data, tm->n_vlib_mains - 1,
CLIB_CACHE_LINE_BYTES);
- for (thread_id = 0; thread_id < tm->n_vlib_mains - 1; thread_id++)
- {
- km->per_thread_data[thread_id].sa_by_rspi =
- hash_create (0, sizeof (uword));
+ for (thread_id = 0; thread_id < tm->n_vlib_mains; thread_id++)
+ {
+ ikev2_main_per_thread_data_t *ptd =
+ vec_elt_at_index (km->per_thread_data, thread_id);
+
+ ptd->sa_by_rspi = hash_create (0, sizeof (uword));
+
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ ptd->evp_ctx = EVP_CIPHER_CTX_new ();
+ ptd->hmac_ctx = HMAC_CTX_new ();
+#else
+ EVP_CIPHER_CTX_init (&ptd->_evp_ctx);
+ ptd->evp_ctx = &ptd->_evp_ctx;
+ HMAC_CTX_init (&(ptd->_hmac_ctx));
+ ptd->hmac_ctx = &ptd->_hmac_ctx;
+#endif
}
km->sa_by_ispi = hash_create (0, sizeof (uword));