Data Accelerator Offload
|
#include <stdbool.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | dao_lc_buf |
struct | dao_lc_sym_op |
union | dao_cpt_res_s |
struct | dao_cpt_res_s::cpt_cn10k_res_s |
struct | dao_cpt_res_s::cpt_cn9k_res_s |
struct | dao_lc_info |
struct | dao_lc_dev_conf |
struct | dao_lc_qp_conf |
struct | dao_lc_res |
struct | dao_lc_cmd_sess_event |
struct | dao_lc_cmd_event |
struct | dao_lc_sym_fc_ctx |
struct | dao_lc_sym_ctx |
Macros | |
#define | DAO_CRYPTO_VERSION_LEN 32 |
#define | DAO_CRYPTO_MAX_NB_DEV 1 |
#define | DAO_CMD_QP_IDX_INVALID 0xFFFF |
#define | DAO_LC_SESS_ID_INVALID 0 |
Functions | |
int | dao_liquid_crypto_init (void) |
int | dao_liquid_crypto_fini (void) |
int | dao_liquid_crypto_info_get (struct dao_lc_info *info) |
int | dao_liquid_crypto_dev_create (struct dao_lc_dev_conf *conf) |
int | dao_liquid_crypto_dev_destroy (uint8_t dev_id) |
int | dao_liquid_crypto_qp_configure (uint8_t dev_id, uint16_t qp_id, struct dao_lc_qp_conf *conf) |
int | dao_liquid_crypto_dev_start (uint8_t dev_id) |
int | dao_liquid_crypto_dev_stop (uint8_t dev_id) |
int | dao_liquid_crypto_enqueue_op_passthrough (uint8_t dev_id, uint16_t qp_id, uint64_t op_cookie) |
int | dao_crypto_enqueue_op_pkcs1v15enc (uint8_t dev_id, uint16_t qp_id, enum dao_liquid_crypto_rsa_key_type key_type, uint16_t mod_len, uint16_t exp_len, uint16_t msg_len, uint8_t *mod, uint8_t *exp, uint8_t *msg, uint8_t *em, uint64_t op_cookie) |
int | dao_crypto_enqueue_op_pkcs1v15dec (uint8_t dev_id, uint16_t qp_id, enum dao_liquid_crypto_rsa_key_type key_type, uint16_t mod_len, uint16_t exp_len, uint8_t *mod, uint8_t *exp, uint8_t *em, uint8_t *msg, uint64_t op_cookie) |
int | dao_crypto_enqueue_op_pkcs1v15enc_crt (uint8_t dev_id, uint16_t qp_id, uint16_t mod_len, uint16_t msg_len, uint8_t *q, uint8_t *dQ, uint8_t *p, uint8_t *dP, uint8_t *qInv, uint8_t *msg, uint8_t *em, uint64_t op_cookie) |
int | dao_crypto_enqueue_op_pkcs1v15dec_crt (uint8_t dev_id, uint16_t qp_id, uint16_t mod_len, uint8_t *q, uint8_t *dQ, uint8_t *p, uint8_t *dP, uint8_t *qInv, uint8_t *em, uint8_t *msg, uint64_t op_cookie) |
uint16_t | dao_liquid_crypto_sym_enqueue_burst (uint8_t dev_id, uint16_t qp_id, struct dao_lc_sym_op *op, uint16_t nb_ops) |
uint16_t | dao_liquid_crypto_dequeue_burst (uint8_t dev_id, uint16_t qp_id, struct dao_lc_res *res, uint16_t nb_ops) |
int | dao_liquid_crypto_sym_sess_create (uint8_t dev_id, const struct dao_lc_sym_ctx *ctx, uint64_t sess_cookie) |
int | dao_liquid_crypto_sym_sess_destroy (uint8_t dev_id, uint64_t sess_id, uint64_t sess_cookie) |
uint16_t | dao_liquid_crypto_cmd_event_dequeue (uint8_t dev_id, struct dao_lc_cmd_event *events, uint16_t nb_events) |
This file contains the API for liquid crypto.
Definition in file dao_liquid_crypto.h.
#define DAO_CRYPTO_VERSION_LEN 32 |
The maximum length of the version string.
Definition at line 18 of file dao_liquid_crypto.h.
#define DAO_CRYPTO_MAX_NB_DEV 1 |
The maximum number of devices supported by the liquid crypto library.
Definition at line 20 of file dao_liquid_crypto.h.
#define DAO_CMD_QP_IDX_INVALID 0xFFFF |
Use DAO_CMD_QP_IDX_INVALID as cmd_qp_idx value to disable command queue altogether.
Definition at line 22 of file dao_liquid_crypto.h.
#define DAO_LC_SESS_ID_INVALID 0 |
Session ID returned as response if the session create request fails
Definition at line 24 of file dao_liquid_crypto.h.
enum dao_cpt_comp_code |
CPT hardware completion codes.
Definition at line 88 of file dao_liquid_crypto.h.
enum dao_uc_rsa_comp_code |
CPT microcode completion codes.
Definition at line 108 of file dao_liquid_crypto.h.
The liquid crypto RSA key type.
Enumerator | |
---|---|
DAO_LC_RSA_KEY_TYPE_PUBLIC | Public key |
DAO_LC_RSA_KEY_TYPE_PRIVATE | Private key |
Definition at line 246 of file dao_liquid_crypto.h.
The liquid crypto command event type.
This enumeration defines the command event types supported by liquid crypto. The command event type is used to indicate the type of command event.
Enumerator | |
---|---|
DAO_LC_CMD_EVENT_SESS_CREATE | Event type for session create |
DAO_LC_CMD_EVENT_SESS_DESTROY | Event type for session destroy |
Definition at line 259 of file dao_liquid_crypto.h.
enum dao_lc_sym_opcode |
The liquid crypto symmetric op code.
This enumeration defines the symmetric operation codes supported by the microcode.
Enumerator | |
---|---|
DAO_LC_SYM_OPCODE_FC | Opcode for Flexi Crypto |
Definition at line 297 of file dao_liquid_crypto.h.
enum dao_lc_fc_iv_src |
The liquid crypto flexi crypto IV source.
Enumerator | |
---|---|
DAO_LC_FC_IV_SRC_CTX | Flexi Crypto IV Source = CTX |
DAO_LC_FC_IV_SRC_OP | Flexi Crypto IV Source = OP |
Definition at line 305 of file dao_liquid_crypto.h.
The liquid crypto flexi crypto AES key length.
Enumerator | |
---|---|
DAO_LC_FC_AES_KEY_LEN_128 | Flexi Crypto AES Key Length = 128 |
DAO_LC_FC_AES_KEY_LEN_192 | Flexi Crypto AES Key Length = 192 |
DAO_LC_FC_AES_KEY_LEN_256 | Flexi Crypto AES Key Length = 256 |
Definition at line 315 of file dao_liquid_crypto.h.
enum dao_lc_fc_enc_cipher |
The liquid crypto flexi crypto encryption cipher.
Definition at line 327 of file dao_liquid_crypto.h.
The liquid crypto flexi crypto authentication input type.
Enumerator | |
---|---|
DAO_LC_FC_AUTH_INPUT_OPAD_IPAD | Flexi Crypto Authentication Input Type = OPAD/IPAD |
DAO_LC_FC_AUTH_INPUT_KEY | Flexi Crypto Authentication Input Type = Key |
Definition at line 355 of file dao_liquid_crypto.h.
The liquid crypto flexi crypto authentication key source.
Enumerator | |
---|---|
DAO_LC_FC_AUTH_KEY_SRC_CTX | Flexi Crypto Authentication Key Source = CTX |
DAO_LC_FC_AUTH_KEY_SRC_OP | Flexi Crypto Authentication Key Source = OP |
Definition at line 365 of file dao_liquid_crypto.h.
enum dao_lc_fc_hash_type |
The liquid crypto flexi crypto hash type.
Definition at line 375 of file dao_liquid_crypto.h.
int dao_liquid_crypto_init | ( | void | ) |
Initialize liquid crypto.
This function initializes the liquid crypto library. This API must be called before any other liquid crypto API and must be called after calling rte_eal_init().
int dao_liquid_crypto_fini | ( | void | ) |
Cleanup liquid crypto.
This function cleans up the liquid crypto library.
int dao_liquid_crypto_info_get | ( | struct dao_lc_info * | info | ) |
Get liquid crypto information.
This function retrieves the liquid crypto information.
info | [out] A pointer to the liquid crypto information structure. |
int dao_liquid_crypto_dev_create | ( | struct dao_lc_dev_conf * | conf | ) |
Create a liquid crypto device.
This function creates a liquid crypto device.
conf | A pointer to the liquid crypto device configuration structure. |
int dao_liquid_crypto_dev_destroy | ( | uint8_t | dev_id | ) |
Destroy a liquid crypto device.
This function destroys a liquid crypto device. The device must be stopped before it can be destroyed.
dev_id | The device identifier. |
int dao_liquid_crypto_qp_configure | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
struct dao_lc_qp_conf * | conf | ||
) |
Configure a liquid crypto queue pair.
This function configures a liquid crypto queue pair. Queue pairs can be configured only when the device is stopped.
dev_id | The device identifier. Value must between 0 and dao_lc_info.nb_dev - 1. |
qp_id | The queue pair identifier. Value must between 0 and dao_lc_info.nb_qp[dev_id] - 1. |
conf | A pointer to the liquid crypto queue pair configuration structure. |
int dao_liquid_crypto_dev_start | ( | uint8_t | dev_id | ) |
Start a liquid crypto device.
This function starts a liquid crypto device. The device must be created before it can be started.
dev_id | The device identifier. |
int dao_liquid_crypto_dev_stop | ( | uint8_t | dev_id | ) |
Stop a liquid crypto device.
This function stops a liquid crypto device.
dev_id | The device identifier. |
int dao_liquid_crypto_enqueue_op_passthrough | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
uint64_t | op_cookie | ||
) |
Enqueue passthrough operation to the liquid crypto device.
dev_id | The identifier of the device. |
qp_id | The index of the queue pair on which the operation is to be enqueued. |
op_cookie | The cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued. |
int dao_crypto_enqueue_op_pkcs1v15enc | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
enum dao_liquid_crypto_rsa_key_type | key_type, | ||
uint16_t | mod_len, | ||
uint16_t | exp_len, | ||
uint16_t | msg_len, | ||
uint8_t * | mod, | ||
uint8_t * | exp, | ||
uint8_t * | msg, | ||
uint8_t * | em, | ||
uint64_t | op_cookie | ||
) |
Enqueue request to perform RSA encrypt operation on the crypto device.
dev_id | The identifier of the device. |
qp_id | The index of the queue pair on which the operation is to be enqueued. |
key_type | The type of RSA key to be used. |
mod_len | The length of the modulus. |
exp_len | The length of the exponent. |
msg_len | The length of the message. |
mod | The address of the buffer containing the modulus. |
exp | The address of the buffer containing the exponent. |
msg | The address of the buffer containing the message. |
em | The address of the buffer where the encrypted message is to be stored. |
op_cookie | The cookie to be associated with the operation. This cookie is returned in the dao_crypto_res structure when the operation is dequeued. |
int dao_crypto_enqueue_op_pkcs1v15dec | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
enum dao_liquid_crypto_rsa_key_type | key_type, | ||
uint16_t | mod_len, | ||
uint16_t | exp_len, | ||
uint8_t * | mod, | ||
uint8_t * | exp, | ||
uint8_t * | em, | ||
uint8_t * | msg, | ||
uint64_t | op_cookie | ||
) |
Enqueue request to perform RSA decrypt operation on the crypto device.
dev_id | The identifier of the device. |
qp_id | The index of the queue pair on which the operation is to be enqueued. |
key_type | The type of RSA key to be used. |
mod_len | The length of the modulus. |
exp_len | The length of the exponent. |
mod | The address of the buffer containing the modulus. |
exp | The address of the buffer containing the exponent. |
em | The address of the buffer containing the encrypted message. Length of this buffer must be at least mod_len bytes. |
msg | The address of the buffer where the decrypted message is to be stored. |
op_cookie | The cookie to be associated with the operation. This cookie is returned in the dao_crypto_res structure when the operation is dequeued. |
int dao_crypto_enqueue_op_pkcs1v15enc_crt | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
uint16_t | mod_len, | ||
uint16_t | msg_len, | ||
uint8_t * | q, | ||
uint8_t * | dQ, | ||
uint8_t * | p, | ||
uint8_t * | dP, | ||
uint8_t * | qInv, | ||
uint8_t * | msg, | ||
uint8_t * | em, | ||
uint64_t | op_cookie | ||
) |
Enqueue request to perform RSA CRT encrypt operation on the crypto device.
dev_id | The identifier of the device. |
qp_id | The index of the queue pair on which the operation is to be enqueued. |
mod_len | The length of the modulus. Value must be even and should be at least 34 bytes and at most 1024 bytes. |
msg_len | The length of the message in bytes. Value must be at most mod_len - 11. |
q | The address of the buffer containing the first factor. Length of this buffer must be mod_len/2 bytes and the value must be odd. |
dQ | The address of the buffer containing the first factor's CRT exponent. Length of this buffer must be mod_len/2 bytes. |
p | The address of the buffer containing the second factor. Length of this buffer must be mod_len/2 bytes and the value must be odd. |
dP | The address of the buffer containing the second factor's CRT exponent. Length of this buffer must be mod_len/2 bytes. |
qInv | The address of the buffer containing the CRT coefficient. Length of this buffer must be mod_len/2 bytes. |
msg | The address of the buffer containing the message. |
em | The address of the buffer where the encrypted message is to be stored. |
op_cookie | The cookie to be associated with the operation. This cookie is returned in the dao_crypto_res structure when the operation is dequeued. |
int dao_crypto_enqueue_op_pkcs1v15dec_crt | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
uint16_t | mod_len, | ||
uint8_t * | q, | ||
uint8_t * | dQ, | ||
uint8_t * | p, | ||
uint8_t * | dP, | ||
uint8_t * | qInv, | ||
uint8_t * | em, | ||
uint8_t * | msg, | ||
uint64_t | op_cookie | ||
) |
Enqueue request to perform RSA CRT decrypt operation on the crypto device.
dev_id | The identifier of the device. |
qp_id | The index of the queue pair on which the operation is to be enqueued. |
mod_len | The length of the modulus in bytes. Value must be even and should be at least 34 bytes and at most 1024 bytes. |
q | The address of the buffer containing the first factor. Length of this buffer must be mod_len/2 bytes and the value must be odd. |
dQ | The address of the buffer containing the first factor's CRT exponent. Length of this buffer must be mod_len/2 bytes. |
p | The address of the buffer containing the second factor. Length of this buffer must be mod_len/2 bytes and the value must be odd. |
dP | The address of the buffer containing the second factor's CRT exponent. Length of this buffer must be mod_len/2 bytes. |
qInv | The address of the buffer containing the CRT coefficient. Length of this buffer must be mod_len/2 bytes. |
em | The address of the buffer containing the encrypted message. |
msg | The address of the buffer where the decrypted message is to be stored. |
op_cookie | The cookie to be associated with the operation. This cookie is returned in the dao_crypto_res structure when the operation is dequeued. |
uint16_t dao_liquid_crypto_sym_enqueue_burst | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
struct dao_lc_sym_op * | op, | ||
uint16_t | nb_ops | ||
) |
Enqueue a burst of requests to perform symmetric crypto operations on the crypto device.
dev_id | The identifier of the device. |
qp_id | The index of the queue pair on which the operations are to be enqueued. |
op | The array of pointers to dao_lc_sym_op structures containing the operations to be enqueued. |
nb_ops | The number of operations to enqueue. |
uint16_t dao_liquid_crypto_dequeue_burst | ( | uint8_t | dev_id, |
uint16_t | qp_id, | ||
struct dao_lc_res * | res, | ||
uint16_t | nb_ops | ||
) |
Dequeue burst of crypto operations from the crypto device.
dev_id | The identifier of the device. |
qp_id | The index of the queue pair on which ops are to be dequeued. |
res | [out] The array of pointers to dao_lc_res structures where the results of the operations are stored. |
nb_ops | The maximum number of operations to dequeue. |
int dao_liquid_crypto_sym_sess_create | ( | uint8_t | dev_id, |
const struct dao_lc_sym_ctx * | ctx, | ||
uint64_t | sess_cookie | ||
) |
Create a symmetric session on the liquid crypto device.
The session create request would be submitted via the command queue designated by cmd_qp_idx of the device.
dev_id | The identifier of the device. |
ctx | The symmetric context. |
sess_cookie | The cookie to be associated with the operation. This cookie is returned in the dao_lc_cmd_sess_event structure when the operation is dequeued. The session ID of the session created would be returned in the dao_lc_cmd_sess_event structure. |
int dao_liquid_crypto_sym_sess_destroy | ( | uint8_t | dev_id, |
uint64_t | sess_id, | ||
uint64_t | sess_cookie | ||
) |
Destroy a symmetric session on the liquid crypto device.
The session destroy request would be submitted via the command queue designated by cmd_qp_idx of the device.
dev_id | The identifier of the device. |
sess_id | The session identifier. |
sess_cookie | The cookie to be associated with the operation. This cookie is returned in the dao_lc_sess_event structure when the operation is dequeued. |
uint16_t dao_liquid_crypto_cmd_event_dequeue | ( | uint8_t | dev_id, |
struct dao_lc_cmd_event * | events, | ||
uint16_t | nb_events | ||
) |
Dequeue burst of command events from the command queue.
dev_id | The identifier of the device. |
events | The array of pointers to dao_lc_cmd_event structures where the command events can be stored. |
nb_events | The maximum number of command events to dequeue. |