18 #include <openssl/hmac.h> 19 #include <openssl/rand.h> 20 #include <openssl/evp.h> 39 }) ip4_and_esp_header_t;
46 }) ip6_and_esp_header_t;
82 #define ESP_WINDOW_SIZE (64) 83 #define ESP_SEQ_MAX (4294967295UL) 175 if (wrap == 0 && seq > sa->
last_seq)
236 memset (em, 0,
sizeof (em[0]));
251 i->
md = EVP_sha256 ();
255 i->
md = EVP_sha256 ();
259 i->
md = EVP_sha384 ();
263 i->
md = EVP_sha512 ();
270 for (thread_id = 0; thread_id < tm->
n_vlib_mains - 1; thread_id++)
282 u8 * data,
int data_len,
u8 * signature,
u8 use_esn,
u32 seq_hi)
287 const EVP_MD *md =
NULL;
301 HMAC_Init (ctx, key, key_len, md);
303 HMAC_Update (ctx, data, data_len);
306 HMAC_Update (ctx, (
u8 *) & seq_hi,
sizeof (seq_hi));
307 HMAC_Final (ctx, signature, &len);
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
ipsec_crypto_alg_t last_decrypt_alg
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
sll srl srl sll sra u16x4 i
static void esp_replay_advance(ipsec_sa_t *sa, u32 seq)
static unsigned int hmac_calc(ipsec_integ_alg_t alg, u8 *key, int key_len, u8 *data, int data_len, u8 *signature, u8 use_esn, u32 seq_hi)
static int esp_replay_check(ipsec_sa_t *sa, u32 seq)
ipsec_integ_alg_t last_integ_alg
esp_crypto_alg_t * esp_crypto_algs
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
esp_integ_alg_t * esp_integ_algs
static void esp_replay_advance_esn(ipsec_sa_t *sa, u32 seq)
typedef CLIB_PACKED(struct{ip4_header_t ip4;esp_header_t esp;}) ip4_and_esp_header_t
EVP_CIPHER_CTX encrypt_ctx
static int esp_replay_check_esn(ipsec_sa_t *sa, u32 seq)
static_always_inline uword vlib_get_thread_index(void)
ipsec_crypto_alg_t last_encrypt_alg
static vlib_thread_main_t * vlib_get_thread_main()
static int esp_seq_advance(ipsec_sa_t *sa)
#define CLIB_CACHE_LINE_BYTES
esp_main_per_thread_data_t * per_thread_data
EVP_CIPHER_CTX decrypt_ctx