16 #ifndef included_vnet_crypto_crypto_h 17 #define included_vnet_crypto_crypto_h 19 #define VNET_CRYPTO_RING_SIZE 512 24 #define foreach_crypto_cipher_alg \ 25 _(DES_CBC, "des-cbc", 7) \ 26 _(3DES_CBC, "3des-cbc", 24) \ 27 _(AES_128_CBC, "aes-128-cbc", 16) \ 28 _(AES_192_CBC, "aes-192-cbc", 24) \ 29 _(AES_256_CBC, "aes-256-cbc", 32) \ 30 _(AES_128_CTR, "aes-128-ctr", 16) \ 31 _(AES_192_CTR, "aes-192-ctr", 24) \ 32 _(AES_256_CTR, "aes-256-ctr", 32) 35 #define foreach_crypto_aead_alg \ 36 _(AES_128_GCM, "aes-128-gcm", 16) \ 37 _(AES_192_GCM, "aes-192-gcm", 24) \ 38 _(AES_256_GCM, "aes-256-gcm", 32) 40 #define foreach_crypto_hmac_alg \ 43 _(SHA224, "sha-224") \ 44 _(SHA256, "sha-256") \ 45 _(SHA384, "sha-384") \ 49 #define foreach_crypto_op_type \ 50 _(ENCRYPT, "encrypt") \ 51 _(DECRYPT, "decrypt") \ 52 _(AEAD_ENCRYPT, "aead-encrypt") \ 53 _(AEAD_DECRYPT, "aead-decrypt") \ 58 #define _(n, s) VNET_CRYPTO_OP_TYPE_##n, 64 #define foreach_crypto_op_status \ 65 _(PENDING, "pending") \ 66 _(COMPLETED, "completed") \ 67 _(FAIL_NO_HANDLER, "no-handler") \ 68 _(FAIL_BAD_HMAC, "bad-hmac") 79 #define _(n, s) VNET_CRYPTO_OP_STATUS_##n, 89 #define _(n, s, l) VNET_CRYPTO_ALG_##n, 93 #define _(n, s) VNET_CRYPTO_ALG_HMAC_##n, 108 #define _(n, s, l) VNET_CRYPTO_OP_##n##_ENC, VNET_CRYPTO_OP_##n##_DEC, 112 #define _(n, s) VNET_CRYPTO_OP_##n##_HMAC, 131 #define VNET_CRYPTO_OP_FLAG_INIT_IV (1 << 0) 132 #define VNET_CRYPTO_OP_FLAG_HMAC_CHECK (1 << 1)
#define foreach_crypto_op_status
format_function_t format_vnet_crypto_op_type
vnet_crypto_engine_t * engines
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
uword * alg_index_by_name
vnet_crypto_thread_t * threads
vnet_crypto_op_data_t opt_data[VNET_CRYPTO_N_OP_IDS]
vnet_crypto_alg_data_t * algs
format_function_t format_vnet_crypto_op
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
format_function_t format_vnet_crypto_alg
int vnet_crypto_is_set_handler(vnet_crypto_alg_t alg)
void vnet_crypto_register_key_handler(vlib_main_t *vm, u32 engine_index, vnet_crypto_key_handler_t *keyh)
void vnet_crypto_register_ops_handler(vlib_main_t *vm, u32 engine_index, vnet_crypto_op_id_t opt, vnet_crypto_ops_handler_t *oph)
clib_bitmap_t * act_queues
u32 vnet_crypto_key_add(vlib_main_t *vm, vnet_crypto_alg_t alg, u8 *data, u16 length)
#define static_always_inline
void vnet_crypto_key_del(vlib_main_t *vm, vnet_crypto_key_index_t index)
#define foreach_crypto_aead_alg
static_always_inline void vnet_crypto_op_init(vnet_crypto_op_t *op, vnet_crypto_op_id_t type)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
u32 vnet_crypto_process_ops(vlib_main_t *vm, vnet_crypto_op_t ops[], u32 n_ops)
#define foreach_crypto_hmac_alg
vl_api_fib_path_type_t type
void() vnet_crypto_key_handler_t(vlib_main_t *vm, vnet_crypto_key_op_t kop, vnet_crypto_key_index_t idx)
vnet_crypto_key_handler_t * key_op_handler
unformat_function_t unformat_vnet_crypto_alg
u32() vnet_crypto_ops_handler_t(vlib_main_t *vm, vnet_crypto_op_t *ops[], u32 n_ops)
format_function_t format_vnet_crypto_op_status
uword * engine_index_by_name
u32 vnet_crypto_submit_ops(vlib_main_t *vm, vnet_crypto_op_t **jobs, u32 n_jobs)
static_always_inline vnet_crypto_op_type_t vnet_crypto_get_op_type(vnet_crypto_op_id_t id)
u32 vnet_crypto_key_index_t
static_always_inline vnet_crypto_key_t * vnet_crypto_get_key(vnet_crypto_key_index_t index)
format_function_t format_vnet_crypto_engine
u32 vnet_crypto_register_engine(vlib_main_t *vm, char *name, int prio, char *desc)
#define foreach_crypto_op_type
vnet_crypto_op_type_t type
vnet_crypto_op_status_t status
int vnet_crypto_set_handler(char *ops_handler_name, char *engine)
vnet_crypto_main_t crypto_main
vnet_crypto_ops_handler_t ** ops_handlers
#define foreach_crypto_cipher_alg