FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
crypto.h File Reference
+ Include dependency graph for crypto.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vnet_crypto_key_t
 
struct  vnet_crypto_alg_data_t
 
struct  vnet_crypto_op_t
 
struct  vnet_crypto_op_data_t
 
struct  vnet_crypto_thread_t
 
struct  vnet_crypto_engine_t
 
struct  vnet_crypto_main_t
 

Macros

#define VNET_CRYPTO_RING_SIZE   512
 
#define foreach_crypto_cipher_alg
 
#define foreach_crypto_aead_alg
 
#define foreach_crypto_hmac_alg
 
#define foreach_crypto_op_type
 
#define foreach_crypto_op_status
 
#define VNET_CRYPTO_OP_FLAG_INIT_IV   (1 << 0)
 
#define VNET_CRYPTO_OP_FLAG_HMAC_CHECK   (1 << 1)
 

Typedefs

typedef u32 vnet_crypto_key_index_t
 
typedef u32() vnet_crypto_ops_handler_t(vlib_main_t *vm, vnet_crypto_op_t *ops[], u32 n_ops)
 
typedef void() vnet_crypto_key_handler_t(vlib_main_t *vm, vnet_crypto_key_op_t kop, vnet_crypto_key_index_t idx)
 

Enumerations

enum  vnet_crypto_op_type_t { VNET_CRYPTO_OP_N_TYPES }
 
enum  vnet_crypto_key_op_t { VNET_CRYPTO_KEY_OP_ADD, VNET_CRYPTO_KEY_OP_DEL, VNET_CRYPTO_KEY_OP_MODIFY }
 
enum  vnet_crypto_op_status_t { VNET_CRYPTO_OP_N_STATUS }
 
enum  vnet_crypto_alg_t { VNET_CRYPTO_ALG_NONE = 0, VNET_CRYPTO_N_ALGS }
 
enum  vnet_crypto_op_id_t { VNET_CRYPTO_OP_NONE = 0, VNET_CRYPTO_N_OP_IDS }
 

Functions

u32 vnet_crypto_register_engine (vlib_main_t *vm, char *name, int prio, char *desc)
 
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)
 
void vnet_crypto_register_key_handler (vlib_main_t *vm, u32 engine_index, vnet_crypto_key_handler_t *keyh)
 
u32 vnet_crypto_submit_ops (vlib_main_t *vm, vnet_crypto_op_t **jobs, u32 n_jobs)
 
u32 vnet_crypto_process_ops (vlib_main_t *vm, vnet_crypto_op_t ops[], u32 n_ops)
 
int vnet_crypto_set_handler (char *ops_handler_name, char *engine)
 
int vnet_crypto_is_set_handler (vnet_crypto_alg_t alg)
 
u32 vnet_crypto_key_add (vlib_main_t *vm, vnet_crypto_alg_t alg, u8 *data, u16 length)
 
void vnet_crypto_key_del (vlib_main_t *vm, vnet_crypto_key_index_t index)
 
static_always_inline void vnet_crypto_op_init (vnet_crypto_op_t *op, vnet_crypto_op_id_t type)
 
static_always_inline vnet_crypto_op_type_t vnet_crypto_get_op_type (vnet_crypto_op_id_t id)
 
static_always_inline vnet_crypto_key_tvnet_crypto_get_key (vnet_crypto_key_index_t index)
 

Variables

vnet_crypto_main_t crypto_main
 
format_function_t format_vnet_crypto_alg
 
format_function_t format_vnet_crypto_engine
 
format_function_t format_vnet_crypto_op
 
format_function_t format_vnet_crypto_op_type
 
format_function_t format_vnet_crypto_op_status
 
unformat_function_t unformat_vnet_crypto_alg
 

Macro Definition Documentation

◆ foreach_crypto_aead_alg

#define foreach_crypto_aead_alg
Value:
_(AES_128_GCM, "aes-128-gcm", 16) \
_(AES_192_GCM, "aes-192-gcm", 24) \
_(AES_256_GCM, "aes-256-gcm", 32)

Definition at line 35 of file crypto.h.

◆ foreach_crypto_cipher_alg

#define foreach_crypto_cipher_alg
Value:
_(DES_CBC, "des-cbc", 7) \
_(3DES_CBC, "3des-cbc", 24) \
_(AES_128_CBC, "aes-128-cbc", 16) \
_(AES_192_CBC, "aes-192-cbc", 24) \
_(AES_256_CBC, "aes-256-cbc", 32) \
_(AES_128_CTR, "aes-128-ctr", 16) \
_(AES_192_CTR, "aes-192-ctr", 24) \
_(AES_256_CTR, "aes-256-ctr", 32)

Definition at line 24 of file crypto.h.

◆ foreach_crypto_hmac_alg

#define foreach_crypto_hmac_alg
Value:
_(MD5, "md5") \
_(SHA1, "sha-1") \
_(SHA224, "sha-224") \
_(SHA256, "sha-256") \
_(SHA384, "sha-384") \
_(SHA512, "sha-512")

Definition at line 40 of file crypto.h.

◆ foreach_crypto_op_status

#define foreach_crypto_op_status
Value:
_(PENDING, "pending") \
_(COMPLETED, "completed") \
_(FAIL_NO_HANDLER, "no-handler") \
_(FAIL_BAD_HMAC, "bad-hmac")

Definition at line 64 of file crypto.h.

◆ foreach_crypto_op_type

#define foreach_crypto_op_type
Value:
_(ENCRYPT, "encrypt") \
_(DECRYPT, "decrypt") \
_(AEAD_ENCRYPT, "aead-encrypt") \
_(AEAD_DECRYPT, "aead-decrypt") \
_(HMAC, "hmac")

Definition at line 49 of file crypto.h.

◆ VNET_CRYPTO_OP_FLAG_HMAC_CHECK

#define VNET_CRYPTO_OP_FLAG_HMAC_CHECK   (1 << 1)

Definition at line 132 of file crypto.h.

◆ VNET_CRYPTO_OP_FLAG_INIT_IV

#define VNET_CRYPTO_OP_FLAG_INIT_IV   (1 << 0)

Definition at line 131 of file crypto.h.

◆ VNET_CRYPTO_RING_SIZE

#define VNET_CRYPTO_RING_SIZE   512

Definition at line 19 of file crypto.h.

Typedef Documentation

◆ vnet_crypto_key_handler_t

typedef void() vnet_crypto_key_handler_t(vlib_main_t *vm, vnet_crypto_key_op_t kop, vnet_crypto_key_index_t idx)

Definition at line 164 of file crypto.h.

◆ vnet_crypto_key_index_t

Definition at line 159 of file crypto.h.

◆ vnet_crypto_ops_handler_t

typedef u32() vnet_crypto_ops_handler_t(vlib_main_t *vm, vnet_crypto_op_t *ops[], u32 n_ops)

Definition at line 161 of file crypto.h.

Enumeration Type Documentation

◆ vnet_crypto_alg_t

Enumerator
VNET_CRYPTO_ALG_NONE 
VNET_CRYPTO_N_ALGS 

Definition at line 86 of file crypto.h.

◆ vnet_crypto_key_op_t

Enumerator
VNET_CRYPTO_KEY_OP_ADD 
VNET_CRYPTO_KEY_OP_DEL 
VNET_CRYPTO_KEY_OP_MODIFY 

Definition at line 70 of file crypto.h.

◆ vnet_crypto_op_id_t

Enumerator
VNET_CRYPTO_OP_NONE 
VNET_CRYPTO_N_OP_IDS 

Definition at line 105 of file crypto.h.

◆ vnet_crypto_op_status_t

Enumerator
VNET_CRYPTO_OP_N_STATUS 

Definition at line 77 of file crypto.h.

◆ vnet_crypto_op_type_t

Enumerator
VNET_CRYPTO_OP_N_TYPES 

Definition at line 56 of file crypto.h.

Function Documentation

◆ vnet_crypto_get_key()

Definition at line 240 of file crypto.h.

+ Here is the caller graph for this function:

◆ vnet_crypto_get_op_type()

Definition at line 231 of file crypto.h.

◆ vnet_crypto_is_set_handler()

int vnet_crypto_is_set_handler ( vnet_crypto_alg_t  alg)

Definition at line 133 of file crypto.c.

+ Here is the caller graph for this function:

◆ vnet_crypto_key_add()

u32 vnet_crypto_key_add ( vlib_main_t vm,
vnet_crypto_alg_t  alg,
u8 data,
u16  length 
)

Definition at line 207 of file crypto.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_crypto_key_del()

void vnet_crypto_key_del ( vlib_main_t vm,
vnet_crypto_key_index_t  index 
)

Definition at line 233 of file crypto.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_crypto_op_init()

static_always_inline void vnet_crypto_op_init ( vnet_crypto_op_t op,
vnet_crypto_op_id_t  type 
)

Definition at line 221 of file crypto.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_crypto_process_ops()

u32 vnet_crypto_process_ops ( vlib_main_t vm,
vnet_crypto_op_t  ops[],
u32  n_ops 
)

Definition at line 46 of file crypto.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ vnet_crypto_register_engine()

u32 vnet_crypto_register_engine ( vlib_main_t vm,
char *  name,
int  prio,
char *  desc 
)

Definition at line 78 of file crypto.c.

+ Here is the caller graph for this function:

◆ vnet_crypto_register_key_handler()

void vnet_crypto_register_key_handler ( vlib_main_t vm,
u32  engine_index,
vnet_crypto_key_handler_t keyh 
)

Definition at line 169 of file crypto.c.

+ Here is the caller graph for this function:

◆ vnet_crypto_register_ops_handler()

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 
)

Definition at line 141 of file crypto.c.

◆ vnet_crypto_set_handler()

int vnet_crypto_set_handler ( char *  ops_handler_name,
char *  engine 
)

Definition at line 95 of file crypto.c.

+ Here is the caller graph for this function:

◆ vnet_crypto_submit_ops()

u32 vnet_crypto_submit_ops ( vlib_main_t vm,
vnet_crypto_op_t **  jobs,
u32  n_jobs 
)

Variable Documentation

◆ crypto_main

vnet_crypto_main_t crypto_main

Definition at line 20 of file crypto.c.

◆ format_vnet_crypto_alg

format_function_t format_vnet_crypto_alg

Definition at line 213 of file crypto.h.

◆ format_vnet_crypto_engine

format_function_t format_vnet_crypto_engine

Definition at line 214 of file crypto.h.

◆ format_vnet_crypto_op

format_function_t format_vnet_crypto_op

Definition at line 215 of file crypto.h.

◆ format_vnet_crypto_op_status

format_function_t format_vnet_crypto_op_status

Definition at line 217 of file crypto.h.

◆ format_vnet_crypto_op_type

format_function_t format_vnet_crypto_op_type

Definition at line 216 of file crypto.h.

◆ unformat_vnet_crypto_alg

unformat_function_t unformat_vnet_crypto_alg

Definition at line 218 of file crypto.h.