- esp_main_t *em = &esp_main;
- u32 cpu_index = os_get_cpu_number ();
- HMAC_CTX *ctx = &(em->per_thread_data[cpu_index].hmac_ctx);
+ ipsec_proto_main_t *em = &ipsec_proto_main;
+ u32 thread_index = vlib_get_thread_index ();
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
+ HMAC_CTX *ctx = em->per_thread_data[thread_index].hmac_ctx;
+#else
+ HMAC_CTX *ctx = &(em->per_thread_data[thread_index].hmac_ctx);
+#endif