49 VNET_CRYPTO_OP_STATUS_FAIL_NO_HANDLER);
57 VNET_CRYPTO_OP_STATUS_FAIL_NO_HANDLER);
77 for (
i = 0;
i < n_ops;
i++)
81 if (current_op_type != opt || n_op_queue >= op_q_size)
87 current_op_type = opt;
90 op_queue[n_op_queue++] = &ops[
i];
94 op_queue, chunks, n_op_queue);
283 if (!enqueue_hdl && !dequeue_hdl)
327 case VNET_CRYPTO_ALG_##n: \ 335 case VNET_CRYPTO_ALG_HMAC_##n: \ 357 index = key - cm->
keys;
400 #define _(c, h, s, k ,d) \ 401 if (crypto_alg == VNET_CRYPTO_ALG_##c && \ 402 integ_alg == VNET_CRYPTO_ALG_HMAC_##h) \ 403 return VNET_CRYPTO_ALG_##c##_##h##_TAG##d; 423 if (!key_crypto || !key_integ)
427 if (linked_alg == ~0)
431 index = key - cm->
keys;
462 VLIB_NODE_STATE_INTERRUPT;
468 state = VLIB_NODE_STATE_DISABLED;
573 VLIB_NODE_STATE_POLLING : VLIB_NODE_STATE_INTERRUPT;
578 state = VLIB_NODE_STATE_DISABLED;
609 VLIB_NODE_STATE_DISABLED : VLIB_NODE_STATE_INTERRUPT;
615 VLIB_NODE_STATE_DISABLED : VLIB_NODE_STATE_POLLING;
649 eopt = VNET_CRYPTO_OP_TYPE_AEAD_ENCRYPT;
650 dopt = VNET_CRYPTO_OP_TYPE_AEAD_DECRYPT;
654 eopt = VNET_CRYPTO_OP_TYPE_ENCRYPT;
655 dopt = VNET_CRYPTO_OP_TYPE_DECRYPT;
719 vnet_crypto_init_cipher_data (VNET_CRYPTO_ALG_##n, \ 720 VNET_CRYPTO_OP_##n##_ENC, \ 721 VNET_CRYPTO_OP_##n##_DEC, s, 0); 725 vnet_crypto_init_cipher_data (VNET_CRYPTO_ALG_##n, \ 726 VNET_CRYPTO_OP_##n##_ENC, \ 727 VNET_CRYPTO_OP_##n##_DEC, s, 1); 731 vnet_crypto_init_hmac_data (VNET_CRYPTO_ALG_HMAC_##n, \ 732 VNET_CRYPTO_OP_##n##_HMAC, "hmac-" s); 735 #define _(n, s, k, t, a) \ 736 vnet_crypto_init_async_data (VNET_CRYPTO_ALG_##n##_TAG##t##_AAD##a, \ 737 VNET_CRYPTO_OP_##n##_TAG##t##_AAD##a##_ENC, \ 738 VNET_CRYPTO_OP_##n##_TAG##t##_AAD##a##_DEC, \ 742 #define _(c, h, s, k ,d) \ 743 vnet_crypto_init_async_data (VNET_CRYPTO_ALG_##c##_##h##_TAG##d, \ 744 VNET_CRYPTO_OP_##c##_##h##_TAG##d##_ENC, \ 745 VNET_CRYPTO_OP_##c##_##h##_TAG##d##_DEC, \ u32 vnet_crypto_process_ops(vlib_main_t *vm, vnet_crypto_op_t ops[], u32 n_ops)
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
static void vnet_crypto_init_async_data(vnet_crypto_async_alg_t alg, vnet_crypto_async_op_id_t eid, vnet_crypto_async_op_id_t did, char *name)
int() vnet_crypto_frame_enqueue_t(vlib_main_t *vm, vnet_crypto_async_frame_t *frame)
async crypto function handlers
uword * async_alg_index_by_name
void vnet_crypto_set_async_dispatch_mode(u8 mode)
vnet_crypto_engine_t * engines
vnet_crypto_thread_t * threads
uword * alg_index_by_name
#define foreach_crypto_link_async_alg
vnet_crypto_async_op_id_t op_by_type[VNET_CRYPTO_ASYNC_OP_N_TYPES]
static_always_inline void crypto_set_active_engine(vnet_crypto_op_data_t *od, vnet_crypto_op_id_t id, u32 ei, crypto_op_class_type_t oct)
static_always_inline void crypto_set_op_status(vnet_crypto_op_t *ops[], u32 n_ops, int status)
#define VNET_CRYPTO_KEY_TYPE_LINK
vnet_crypto_op_data_t opt_data[VNET_CRYPTO_N_OP_IDS]
u32() vnet_crypto_chained_ops_handler_t(vlib_main_t *vm, vnet_crypto_op_t *ops[], vnet_crypto_op_chunk_t *chunks, u32 n_ops)
int vnet_crypto_set_async_handler2(char *alg_name, char *engine)
#define pool_get_zero(P, E)
Allocate an object E from a pool P and zero it.
static_always_inline void crypto_set_active_async_engine(vnet_crypto_async_op_data_t *od, vnet_crypto_async_op_id_t id, u32 ei)
vnet_crypto_alg_data_t * algs
vnet_crypto_frame_enqueue_t ** enqueue_handlers
#define CLIB_MEMORY_STORE_BARRIER()
static uword vlib_node_add_named_next(vlib_main_t *vm, uword node, char *name)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
vnet_crypto_op_id_t op_by_type[VNET_CRYPTO_OP_N_TYPES]
vnet_crypto_async_alg_data_t * async_algs
vnet_crypto_async_op_type_t type
void vnet_crypto_request_async_mode(int is_enable)
#define vec_add2(V, P, N)
Add N elements to end of vector V, return pointer to new elements in P.
#define hash_set_mem(h, key, value)
vnet_crypto_async_alg_t vnet_crypto_link_algs(vnet_crypto_alg_t crypto_alg, vnet_crypto_alg_t integ_alg)
vnet_crypto_frame_dequeue_t * dequeue_handlers[VNET_CRYPTO_ASYNC_OP_N_IDS]
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static void vnet_crypto_init_hmac_data(vnet_crypto_alg_t alg, vnet_crypto_op_id_t id, char *name)
vlib_main_t ** vlib_mains
#define VNET_CRYPTO_ASYNC_DISPATCH_POLLING
#define clib_memcpy(d, s, n)
int vnet_crypto_is_set_handler(vnet_crypto_alg_t alg)
void vnet_crypto_register_ops_handlers(vlib_main_t *vm, u32 engine_index, vnet_crypto_op_id_t opt, vnet_crypto_ops_handler_t *fn, vnet_crypto_chained_ops_handler_t *cfn)
#define clib_bitmap_validate(v, n_bits)
void vnet_crypto_register_async_handler(vlib_main_t *vm, u32 engine_index, vnet_crypto_async_op_id_t opt, vnet_crypto_frame_enqueue_t *enqueue_hdl, vnet_crypto_frame_dequeue_t *dequeue_hdl)
void vnet_crypto_register_key_handler(vlib_main_t *vm, u32 engine_index, vnet_crypto_key_handler_t *key_handler)
#define static_always_inline
#define VLIB_INIT_FUNCTION(x)
#define pool_alloc_aligned(P, N, A)
Allocate N more free elements to pool (general version).
#define foreach_crypto_aead_alg
int vnet_crypto_set_handler2(char *alg_name, char *engine, crypto_op_class_type_t oct)
u32 active_engine_index_chained
#define VNET_CRYPTO_KEY_TYPE_DATA
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
#define foreach_crypto_hmac_alg
u32 vnet_crypto_key_add(vlib_main_t *vm, vnet_crypto_alg_t alg, u8 *data, u16 length)
vnet_crypto_chained_ops_handler_t ** chained_ops_handlers
#define hash_create_string(elts, value_bytes)
static vlib_node_state_t vlib_node_get_state(vlib_main_t *vm, u32 node_index)
Get node dispatch state.
clib_error_t * crypto_dispatch_enable_disable(int is_enable)
u32 active_engine_index_async
#define VNET_CRYPTO_ASYNC_DISPATCH_INTERRUPT
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
void() vnet_crypto_key_handler_t(vlib_main_t *vm, vnet_crypto_key_op_t kop, vnet_crypto_key_index_t idx)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
vnet_crypto_key_handler_t * key_op_handler
vnet_crypto_async_next_node_t * next_nodes
void vnet_crypto_key_del(vlib_main_t *vm, vnet_crypto_key_index_t index)
#define pool_put(P, E)
Free an object E in pool P.
u32 vnet_crypto_register_post_node(vlib_main_t *vm, char *post_node_name)
async crypto register functions
void vnet_crypto_register_ops_handler(vlib_main_t *vm, u32 engine_index, vnet_crypto_op_id_t opt, vnet_crypto_ops_handler_t *fn)
u32 active_engine_index_simple
vnet_crypto_async_frame_t * frame_pool
vl_api_tunnel_mode_t mode
vnet_crypto_async_alg_t async_alg
static_always_inline u32 vnet_crypto_process_ops_inline(vlib_main_t *vm, vnet_crypto_op_t ops[], vnet_crypto_op_chunk_t *chunks, u32 n_ops)
sll srl srl sll sra u16x4 i
#define vec_free(V)
Free vector's memory (no header).
vnet_crypto_frame_dequeue_t ** dequeue_handlers
static int vnet_crypto_key_len_check(vnet_crypto_alg_t alg, u16 length)
vnet_crypto_chained_ops_handler_t * chained_ops_handlers[VNET_CRYPTO_N_OP_IDS]
u32() vnet_crypto_ops_handler_t(vlib_main_t *vm, vnet_crypto_op_t *ops[], u32 n_ops)
static_always_inline u32 vnet_crypto_process_ops_call_handler(vlib_main_t *vm, vnet_crypto_main_t *cm, vnet_crypto_op_id_t opt, vnet_crypto_op_t *ops[], vnet_crypto_op_chunk_t *chunks, u32 n_ops)
vnet_crypto_async_alg_t alg
uword * engine_index_by_name
u32 vnet_crypto_process_chained_ops(vlib_main_t *vm, vnet_crypto_op_t ops[], vnet_crypto_op_chunk_t *chunks, u32 n_ops)
clib_bitmap_t * async_active_ids
u32 vnet_crypto_key_index_t
#define foreach_crypto_aead_async_alg
async crypto
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
vnet_crypto_async_op_data_t async_opt_data[VNET_CRYPTO_ASYNC_OP_N_IDS]
static void vnet_crypto_init_cipher_data(vnet_crypto_alg_t alg, vnet_crypto_op_id_t eid, vnet_crypto_op_id_t did, char *name, u8 is_aead)
vnet_crypto_async_op_id_t
void vnet_crypto_register_ops_handler_inline(vlib_main_t *vm, u32 engine_index, vnet_crypto_op_id_t opt, vnet_crypto_ops_handler_t *fn, vnet_crypto_chained_ops_handler_t *cfn)
u32 vnet_crypto_key_add_linked(vlib_main_t *vm, vnet_crypto_key_index_t index_crypto, vnet_crypto_key_index_t index_integ)
Use 2 created keys to generate new key for linked algs (cipher + integ) The returned key index is to ...
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vnet_crypto_async_frame_t *() vnet_crypto_frame_dequeue_t(vlib_main_t *vm, u32 *nb_elts_processed, u32 *enqueue_thread_idx)
vnet_crypto_op_type_t type
int vnet_crypto_is_set_async_handler(vnet_crypto_async_op_id_t op)
void vnet_crypto_register_chained_ops_handler(vlib_main_t *vm, u32 engine_index, vnet_crypto_op_id_t opt, vnet_crypto_chained_ops_handler_t *fn)
#define hash_get_mem(h, key)
vnet_crypto_ops_handler_t * ops_handlers[VNET_CRYPTO_N_OP_IDS]
vnet_crypto_frame_enqueue_t * enqueue_handlers[VNET_CRYPTO_ASYNC_OP_N_IDS]
vnet_crypto_op_status_t status
static vlib_thread_main_t * vlib_get_thread_main()
vl_api_dhcp_client_state_t state
static u32 vlib_num_workers()
#define vec_foreach(var, vec)
Vector iterator.
vnet_crypto_ops_handler_t ** ops_handlers
#define CLIB_CACHE_LINE_BYTES
u32 vnet_crypto_register_engine(vlib_main_t *vm, char *name, int prio, char *desc)
vnet_crypto_main_t crypto_main
clib_error_t * vnet_crypto_init(vlib_main_t *vm)
#define foreach_crypto_cipher_alg