#ifndef __ESP_H__
#define __ESP_H__
+#include <vnet/ip/ip.h>
+#include <vnet/ipsec/ipsec.h>
+
#include <openssl/hmac.h>
#include <openssl/rand.h>
#include <openssl/evp.h>
#define ESP_WINDOW_SIZE (64)
#define ESP_SEQ_MAX (4294967295UL)
+u8 *format_esp_header (u8 * s, va_list * args);
always_inline int
esp_replay_check (ipsec_sa_t * sa, u32 seq)
u8 * data, int data_len, u8 * signature, u8 use_esn, u32 seq_hi)
{
esp_main_t *em = &esp_main;
- u32 cpu_index = os_get_cpu_number ();
- HMAC_CTX *ctx = &(em->per_thread_data[cpu_index].hmac_ctx);
+ u32 thread_index = vlib_get_thread_index ();
+ HMAC_CTX *ctx = &(em->per_thread_data[thread_index].hmac_ctx);
const EVP_MD *md = NULL;
unsigned int len;
if (PREDICT_FALSE (em->esp_integ_algs[alg].md == 0))
return 0;
- if (PREDICT_FALSE (alg != em->per_thread_data[cpu_index].last_integ_alg))
+ if (PREDICT_FALSE (alg != em->per_thread_data[thread_index].last_integ_alg))
{
md = em->esp_integ_algs[alg].md;
- em->per_thread_data[cpu_index].last_integ_alg = alg;
+ em->per_thread_data[thread_index].last_integ_alg = alg;
}
HMAC_Init (ctx, key, key_len, md);