X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fipsec%2Fipsec.h;h=110bbcb3e5a5f0dd363e3f922297a3f178f3032b;hb=80f6fd53feaa10b4a798582100724075897c0944;hp=c877139ba122cd28dc549dc029d617c2884b9ded;hpb=c98275f327f2a69600feb4378fce3f8ccaca7921;p=vpp.git diff --git a/src/vnet/ipsec/ipsec.h b/src/vnet/ipsec/ipsec.h index c877139ba12..110bbcb3e5a 100644 --- a/src/vnet/ipsec/ipsec.h +++ b/src/vnet/ipsec/ipsec.h @@ -16,12 +16,9 @@ #define __IPSEC_H__ #include +#include #include -#include -#include -#include - #include #include @@ -69,50 +66,24 @@ typedef struct typedef struct { - const EVP_CIPHER *type; + vnet_crypto_op_id_t enc_op_id; + vnet_crypto_op_id_t dec_op_id; u8 iv_size; u8 block_size; -} ipsec_proto_main_crypto_alg_t; + u8 icv_size; +} ipsec_main_crypto_alg_t; typedef struct { - const EVP_MD *md; - u8 trunc_size; -} ipsec_proto_main_integ_alg_t; + vnet_crypto_op_id_t op_id; + u8 icv_size; +} ipsec_main_integ_alg_t; typedef struct { - CLIB_CACHE_LINE_ALIGN_MARK (cacheline0); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - EVP_CIPHER_CTX *encrypt_ctx; -#else - EVP_CIPHER_CTX encrypt_ctx; -#endif - CLIB_CACHE_LINE_ALIGN_MARK (cacheline1); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - EVP_CIPHER_CTX *decrypt_ctx; -#else - EVP_CIPHER_CTX decrypt_ctx; -#endif - CLIB_CACHE_LINE_ALIGN_MARK (cacheline2); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L - HMAC_CTX *hmac_ctx; -#else - HMAC_CTX hmac_ctx; -#endif - ipsec_crypto_alg_t last_encrypt_alg; - ipsec_crypto_alg_t last_decrypt_alg; - ipsec_integ_alg_t last_integ_alg; -} ipsec_proto_main_per_thread_data_t; - -typedef struct -{ - ipsec_proto_main_crypto_alg_t *ipsec_proto_main_crypto_algs; - ipsec_proto_main_integ_alg_t *ipsec_proto_main_integ_algs; - ipsec_proto_main_per_thread_data_t *per_thread_data; -} ipsec_proto_main_t; - -extern ipsec_proto_main_t ipsec_proto_main; + vnet_crypto_op_t *crypto_ops; + vnet_crypto_op_t *integ_ops; +} ipsec_per_thread_data_t; typedef struct { @@ -136,8 +107,10 @@ typedef struct uword *spd_index_by_spd_id; uword *spd_index_by_sw_if_index; uword *sa_index_by_sa_id; - uword *ipsec_if_pool_index_by_key; + uword *ipsec4_if_pool_index_by_key; + uword *ipsec6_if_pool_index_by_key; uword *ipsec_if_real_dev_by_show_dev; + uword *ipsec_if_by_sw_if_index; /* node indices */ u32 error_drop_node_index; @@ -171,8 +144,23 @@ typedef struct u32 ah_default_backend; /* index of default esp backend */ u32 esp_default_backend; + + /* crypto alg data */ + ipsec_main_crypto_alg_t *crypto_algs; + + /* crypto integ data */ + ipsec_main_integ_alg_t *integ_algs; + + /* per-thread data */ + ipsec_per_thread_data_t *ptd; } ipsec_main_t; +typedef enum ipsec_format_flags_t_ +{ + IPSEC_FORMAT_BRIEF = 0, + IPSEC_FORMAT_DETAIL = (1 << 0), +} ipsec_format_flags_t; + extern ipsec_main_t ipsec_main; clib_error_t *ipsec_add_del_sa_sess_cb (ipsec_main_t * im, u32 sa_index, @@ -188,7 +176,8 @@ extern vlib_node_registration_t esp6_encrypt_node; extern vlib_node_registration_t esp6_decrypt_node; extern vlib_node_registration_t ah6_encrypt_node; extern vlib_node_registration_t ah6_decrypt_node; -extern vlib_node_registration_t ipsec_if_input_node; +extern vlib_node_registration_t ipsec4_if_input_node; +extern vlib_node_registration_t ipsec6_if_input_node; /* * functions @@ -231,6 +220,13 @@ u32 ipsec_register_esp_backend (vlib_main_t * vm, ipsec_main_t * im, int ipsec_select_ah_backend (ipsec_main_t * im, u32 ah_backend_idx); int ipsec_select_esp_backend (ipsec_main_t * im, u32 esp_backend_idx); + +always_inline ipsec_sa_t * +ipsec_sa_get (u32 sa_index) +{ + return (pool_elt_at_index (ipsec_main.sad, sa_index)); +} + #endif /* __IPSEC_H__ */ /*