Data Accelerator Offload
Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions
dao_liquid_crypto.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <dao_eth_trs.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_feature_params
 
struct  dao_lc_hmac_hash_ctx
 
struct  dao_lc_aes_key_wrap_ctx
 
struct  dao_lc_sym_ctx
 
struct  dao_lc_random_op_x9_17
 

Macros

#define DAO_LC_VERSION   "25.10.0"
 
#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
 
#define DAO_LC_SESS_ID_HASH   1
 
#define DAO_LC_SESS_ID_AES_KEY_WRAP   2
 
#define DAO_LC_MAX_DIGEST_LEN   255
 
#define DAO_LC_MAX_AUTH_KEY_LEN   1024
 
#define DAO_LC_AES_KEY_WRAP_MAX_KEY_DATA_LEN   3072
 
#define DAO_LC_AES_MAX_KEY_ENC_KEY_LEN   32
 
#define DAO_LC_AES_KEY_WRAP_IV_LEN   8
 

Enumerations

enum  dao_cpt_comp_code {
  DAO_CPT_COMP_NOT_DONE = 0 , DAO_CPT_COMP_GOOD , DAO_CPT_COMP_FAULT , DAO_CPT_COMP_SWERR ,
  DAO_CPT_COMP_HWERR , DAO_CPT_COMP_INSTERR , DAO_CPT_COMP_WARN
}
 
enum  dao_uc_comp_code {
  DAO_UC_SUCCESS = 0x00 , DAO_UC_RSA_SG_NOT_SUPPORTED = 0x04 , DAO_UC_RSA_MOD_LEN_INVALID = 0x06 , DAO_UC_RSA_MOD_LEN_NOT_EVEN = 0x09 ,
  DAO_UC_RSA_PKCS_DEC_INCORRECT = 0x0A , DAO_UC_ECC_DATA_LEN_INVALID = 0x08 , DAO_UC_ECC_PAI = 0x0b , DAO_UC_ECC_CURVE_INVALID = 0x0c ,
  DAO_UC_ECC_SIGN_R_INVALID = 0x0d , DAO_UC_ECC_SIGN_S_INVALID = 0x0e , DAO_UC_ECC_VERIFY_MISMATCH = 0x0f , DAO_UC_ECC_PUB_KEY_INVALID = 0x11 ,
  DAO_UC_ERR_GC_DATA_LEN_INVALID = 0x43 , DAO_UC_ERR_GC_CTX_LEN_INVALID = 0x45 , DAO_UC_ERR_GC_CIPHER_UNSUPPORTED = 0x46 , DAO_UC_ERR_GC_AUTH_UNSUPPORTED = 0x47 ,
  DAO_UC_ERR_GC_OFFSET_INVALID = 0x48 , DAO_UC_ERR_GC_ICV_MISCOMPARE = 0x4c , DAO_UC_ERR_GC_DATA_UNALIGNED = 0x4d , DAO_UC_ERR_GC_KEY_LEN_INVALID = 0x4e ,
  DAO_UC_ERR_GC_KEY_DATA_LEN_INVALID = 0x41
}
 
enum  dao_liquid_crypto_rsa_key_type { DAO_LC_RSA_KEY_TYPE_PUBLIC , DAO_LC_RSA_KEY_TYPE_PRIVATE }
 
enum  dao_lc_cmd_event_type { DAO_LC_CMD_EVENT_SESS_CREATE = 0 , DAO_LC_CMD_EVENT_SESS_DESTROY = 1 }
 
enum  dao_lc_sym_opcode { DAO_LC_SYM_OPCODE_FC = 0x33 , DAO_LC_SYM_OPCODE_HASH = 0x34 , DAO_LC_SYM_OPCODE_HMAC = 0x35 , DAO_LC_SYM_OPCODE_AES_KEY_WRAP = 0x1D }
 
enum  dao_lc_fc_iv_src { DAO_LC_FC_IV_SRC_CTX = 0 , DAO_LC_FC_IV_SRC_OP = 1 }
 
enum  dao_lc_fc_aes_key_len { DAO_LC_FC_AES_KEY_LEN_128 = 1 , DAO_LC_FC_AES_KEY_LEN_192 = 2 , DAO_LC_FC_AES_KEY_LEN_256 = 3 }
 
enum  dao_lc_fc_enc_cipher {
  DAO_LC_FC_ENC_CIPHER_NULL = 0 , DAO_LC_FC_ENC_CIPHER_3DES_CBC = 1 , DAO_LC_FC_ENC_CIPHER_3DES_ECB = 2 , DAO_LC_FC_ENC_CIPHER_AES_CBC = 3 ,
  DAO_LC_FC_ENC_CIPHER_AES_ECB = 4 , DAO_LC_FC_ENC_CIPHER_AES_CFB = 5 , DAO_LC_FC_ENC_CIPHER_AES_CTR = 6 , DAO_LC_FC_ENC_CIPHER_AES_GCM = 7 ,
  DAO_LC_FC_ENC_CIPHER_AES_XTS = 8 , DAO_LC_FC_ENC_CIPHER_CHACHA = 9 , DAO_LC_FC_ENC_CIPHER_AES_CCM = 10
}
 
enum  dao_lc_fc_auth_input_type { DAO_LC_FC_AUTH_INPUT_OPAD_IPAD = 0 , DAO_LC_FC_AUTH_INPUT_KEY = 1 }
 
enum  dao_lc_fc_auth_key_src { DAO_LC_FC_AUTH_KEY_SRC_CTX = 0 , DAO_LC_FC_AUTH_KEY_SRC_OP = 1 }
 
enum  dao_lc_hash_type {
  DAO_LC_HASH_TYPE_NULL = 0 , DAO_LC_HASH_TYPE_MD5 = 1 , DAO_LC_HASH_TYPE_SHA1 = 2 , DAO_LC_HASH_TYPE_SHA2_SHA224 = 3 ,
  DAO_LC_HASH_TYPE_SHA2_SHA256 = 4 , DAO_LC_HASH_TYPE_SHA2_SHA384 = 5 , DAO_LC_HASH_TYPE_SHA2_SHA512 = 6 , DAO_LC_HASH_TYPE_GMAC = 7 ,
  DAO_LC_HASH_TYPE_POLY1305 = 8 , DAO_LC_HASH_TYPE_SM3 = 9 , DAO_LC_HASH_TYPE_SHA3_SHA224 = 10 , DAO_LC_HASH_TYPE_SHA3_SHA256 = 11 ,
  DAO_LC_HASH_TYPE_SHA3_SHA384 = 12 , DAO_LC_HASH_TYPE_SHA3_SHA512 = 13 , DAO_LC_HASH_TYPE_SHA3_SHAKE128 = 14 , DAO_LC_HASH_TYPE_SHA3_SHAKE256 = 15 ,
  DAO_LC_HASH_TYPE_CMAC = 16
}
 
enum  dao_liquid_crypto_ec_curve_type { }
 
enum  dao_lc_random_type { DAO_LC_RANDOM_TYPE_HW = 0 , DAO_LC_RANDOM_TYPE_X9_17 = 1 }
 
enum  dao_lc_aes_key_len_bytes { DAO_LC_AES_KEY_LEN_16_BYTES = 16 , DAO_LC_AES_KEY_LEN_24_BYTES = 24 , DAO_LC_AES_KEY_LEN_32_BYTES = 32 }
 

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)
 
uint16_t dao_liquid_crypto_seg_size_calc (struct dao_lc_feature_params *params)
 
int dao_liquid_crypto_enqueue_op_passthrough (uint8_t dev_id, uint16_t qp_id, uint64_t op_cookie)
 
int dao_liquid_crypto_enq_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_liquid_crypto_enq_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_liquid_crypto_enq_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_liquid_crypto_enq_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)
 
int dao_liquid_crypto_enq_op_random (uint8_t dev_id, uint16_t qp_id, struct dao_lc_random_op *op)
 
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)
 
int dao_liquid_crypto_enq_op_ecdsa_sign (uint8_t dev_id, uint16_t qp_id, enum dao_liquid_crypto_ec_curve_type curve_id, uint16_t nonce_len, uint16_t pkey_len, uint16_t digest_len, const uint8_t *nonce, const uint8_t *pkey, const uint8_t *digest_data, uint8_t *rs_outdata, uint64_t op_cookie)
 
int dao_liquid_crypto_enq_op_ecdsa_verify (uint8_t dev_id, uint16_t qp_id, enum dao_liquid_crypto_ec_curve_type curve_id, uint16_t r_len, uint16_t s_len, uint16_t digest_len, uint16_t qx_len, uint16_t qy_len, const uint8_t *r_data, const uint8_t *s_data, const uint8_t *digest, const uint8_t *qx_data, const uint8_t *qy_data, uint64_t op_cookie)
 
int dao_liquid_crypto_enq_op_rsa_oaep_enc (uint8_t dev_id, uint16_t qp_id, uint8_t *label, uint16_t label_len, enum dao_lc_hash_type hash_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_liquid_crypto_enq_op_rsa_oaep_exp_dec (uint8_t dev_id, uint16_t qp_id, uint8_t *label, uint16_t label_len, enum dao_lc_hash_type hash_type, uint16_t mod_len, uint16_t exp_len, uint16_t em_len, uint8_t *mod, uint8_t *exp, uint8_t *em, uint8_t *msg, uint64_t op_cookie)
 

Detailed Description

This file contains the API for liquid crypto.

Definition in file dao_liquid_crypto.h.

Macro Definition Documentation

◆ DAO_LC_VERSION

#define DAO_LC_VERSION   "25.10.0"

The version of the liquid crypto library

Definition at line 20 of file dao_liquid_crypto.h.

◆ DAO_CRYPTO_VERSION_LEN

#define DAO_CRYPTO_VERSION_LEN   32

The maximum length of the version string.

Definition at line 22 of file dao_liquid_crypto.h.

◆ DAO_CRYPTO_MAX_NB_DEV

#define DAO_CRYPTO_MAX_NB_DEV   1

The maximum number of devices supported by the liquid crypto library.

Definition at line 24 of file dao_liquid_crypto.h.

◆ DAO_CMD_QP_IDX_INVALID

#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 26 of file dao_liquid_crypto.h.

◆ DAO_LC_SESS_ID_INVALID

#define DAO_LC_SESS_ID_INVALID   0

Session ID returned as response if the session create request fails

Definition at line 28 of file dao_liquid_crypto.h.

◆ DAO_LC_SESS_ID_HASH

#define DAO_LC_SESS_ID_HASH   1

Session ID returned as response if the session create is for HASH operation

Definition at line 30 of file dao_liquid_crypto.h.

◆ DAO_LC_SESS_ID_AES_KEY_WRAP

#define DAO_LC_SESS_ID_AES_KEY_WRAP   2

Session ID returned as response if the session create is for AES Key Wrap operation

Definition at line 32 of file dao_liquid_crypto.h.

◆ DAO_LC_MAX_DIGEST_LEN

#define DAO_LC_MAX_DIGEST_LEN   255

Maximum digest length

Definition at line 34 of file dao_liquid_crypto.h.

◆ DAO_LC_MAX_AUTH_KEY_LEN

#define DAO_LC_MAX_AUTH_KEY_LEN   1024

Maximum authentication key

Definition at line 36 of file dao_liquid_crypto.h.

◆ DAO_LC_AES_KEY_WRAP_MAX_KEY_DATA_LEN

#define DAO_LC_AES_KEY_WRAP_MAX_KEY_DATA_LEN   3072

Maximum key data supported for key wrap

Definition at line 38 of file dao_liquid_crypto.h.

◆ DAO_LC_AES_MAX_KEY_ENC_KEY_LEN

#define DAO_LC_AES_MAX_KEY_ENC_KEY_LEN   32

Maximum size of key encryption key for AES Key Wrap

Definition at line 40 of file dao_liquid_crypto.h.

◆ DAO_LC_AES_KEY_WRAP_IV_LEN

#define DAO_LC_AES_KEY_WRAP_IV_LEN   8

AES Key Wrap IV length

Definition at line 42 of file dao_liquid_crypto.h.

Enumeration Type Documentation

◆ dao_cpt_comp_code

CPT hardware completion codes.

Enumerator
DAO_CPT_COMP_NOT_DONE 

Request not completed.

DAO_CPT_COMP_GOOD 

Request completed successfully.

DAO_CPT_COMP_FAULT 

CPT detected a memory fault.

DAO_CPT_COMP_SWERR 

Microcode detected an illegal instruction.

DAO_CPT_COMP_HWERR 

CPT detected an uncorrectable error.

DAO_CPT_COMP_INSTERR 

CPT detected an illegal instruction.

DAO_CPT_COMP_WARN 

Request completed with a warning.

Definition at line 144 of file dao_liquid_crypto.h.

◆ dao_uc_comp_code

Completion codes returned by CPT microcode.

Enumerator
DAO_UC_SUCCESS 

Request completed with no error.

DAO_UC_RSA_SG_NOT_SUPPORTED 

Scatter/Gather not supported.

DAO_UC_RSA_MOD_LEN_INVALID 

Invalid mod length.

DAO_UC_RSA_MOD_LEN_NOT_EVEN 

Mod length not even.

DAO_UC_RSA_PKCS_DEC_INCORRECT 

PKCS decrypt incorrect.

DAO_UC_ECC_DATA_LEN_INVALID 

ECDSA sign/verify error codes Invalid private and hash and random key length

DAO_UC_ECC_PAI 

ECC point at infinity

DAO_UC_ECC_CURVE_INVALID 

Invalid ECC curve

DAO_UC_ECC_SIGN_R_INVALID 

Invalid ECDSA sign r component

DAO_UC_ECC_SIGN_S_INVALID 

Invalid ECDSA sign s component

DAO_UC_ECC_VERIFY_MISMATCH 

ECC signature mismatch

DAO_UC_ECC_PUB_KEY_INVALID 

Public key point not on curve

DAO_UC_ERR_GC_DATA_LEN_INVALID 

SE GC Invalid data length.

DAO_UC_ERR_GC_CTX_LEN_INVALID 

Invalid context length.

DAO_UC_ERR_GC_CIPHER_UNSUPPORTED 

Unsupported cipher select or, if CRC32 is enabled, cipher_type must be NULL.

DAO_UC_ERR_GC_AUTH_UNSUPPORTED 

Unsupported auth type or, if CRC32 is enabled, auth_type must be NULL, or when auth_type is Poly1305, cipher select is other than ChaCha or Null.

DAO_UC_ERR_GC_OFFSET_INVALID 

Invalid offset.

DAO_UC_ERR_GC_ICV_MISCOMPARE 

Authentication data (MAC) or CRC32 mismatch.

DAO_UC_ERR_GC_DATA_UNALIGNED 

Encrypt length unaligned when MAC_Select is valid.

DAO_UC_ERR_GC_KEY_LEN_INVALID 

Invalid key length; Applicable for HMAC and AES-KW and AES-KWP

DAO_UC_ERR_GC_KEY_DATA_LEN_INVALID 

Invalid key data length

Definition at line 164 of file dao_liquid_crypto.h.

◆ dao_liquid_crypto_rsa_key_type

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 356 of file dao_liquid_crypto.h.

◆ dao_lc_cmd_event_type

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 369 of file dao_liquid_crypto.h.

◆ 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

DAO_LC_SYM_OPCODE_HASH 

Opcode for HASH

DAO_LC_SYM_OPCODE_HMAC 

Opcode for HMAC

DAO_LC_SYM_OPCODE_AES_KEY_WRAP 

Opcode for AES Key Wrap

Definition at line 407 of file dao_liquid_crypto.h.

◆ 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 421 of file dao_liquid_crypto.h.

◆ dao_lc_fc_aes_key_len

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 431 of file dao_liquid_crypto.h.

◆ dao_lc_fc_enc_cipher

The liquid crypto flexi crypto encryption cipher.

Enumerator
DAO_LC_FC_ENC_CIPHER_NULL 

Flexi Crypto Encryption Cipher Type = NULL

DAO_LC_FC_ENC_CIPHER_3DES_CBC 

Flexi Crypto Encryption Cipher Type = 3DES-CBC

DAO_LC_FC_ENC_CIPHER_3DES_ECB 

Flexi Crypto Encryption Cipher Type = 3DES-ECB

DAO_LC_FC_ENC_CIPHER_AES_CBC 

Flexi Crypto Encryption Cipher Type = AES-CBC

DAO_LC_FC_ENC_CIPHER_AES_ECB 

Flexi Crypto Encryption Cipher Type = AES-ECB

DAO_LC_FC_ENC_CIPHER_AES_CFB 

Flexi Crypto Encryption Cipher Type = AES-CFB

DAO_LC_FC_ENC_CIPHER_AES_CTR 

Flexi Crypto Encryption Cipher Type = AES-CTR

DAO_LC_FC_ENC_CIPHER_AES_GCM 

Flexi Crypto Encryption Cipher Type = AES-GCM

DAO_LC_FC_ENC_CIPHER_AES_XTS 

Flexi Crypto Encryption Cipher Type = AES-XTS

DAO_LC_FC_ENC_CIPHER_CHACHA 

Flexi Crypto Encryption Cipher Type = ChaCha Cipher Type ChaCha exclusively supports 256-bit keys only.

DAO_LC_FC_ENC_CIPHER_AES_CCM 

Flexi Crypto Encryption Cipher Type = AES-CCM

Definition at line 443 of file dao_liquid_crypto.h.

◆ dao_lc_fc_auth_input_type

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 474 of file dao_liquid_crypto.h.

◆ dao_lc_fc_auth_key_src

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 484 of file dao_liquid_crypto.h.

◆ dao_lc_hash_type

The liquid crypto hash type.

Enumerator
DAO_LC_HASH_TYPE_NULL 

Hash Type = NULL

DAO_LC_HASH_TYPE_MD5 

Hash Type = MD5

DAO_LC_HASH_TYPE_SHA1 

Hash Type = SHA1

DAO_LC_HASH_TYPE_SHA2_SHA224 

Hash Type = SHA2-SHA224

DAO_LC_HASH_TYPE_SHA2_SHA256 

Hash Type = SHA2-SHA256

DAO_LC_HASH_TYPE_SHA2_SHA384 

Hash Type = SHA2-SHA384

DAO_LC_HASH_TYPE_SHA2_SHA512 

Hash Type = SHA2-SHA512

DAO_LC_HASH_TYPE_GMAC 

Hash Type = GMAC

DAO_LC_HASH_TYPE_POLY1305 

Hash Type = POLY1305

DAO_LC_HASH_TYPE_SM3 

Hash Type = SM3

DAO_LC_HASH_TYPE_SHA3_SHA224 

Hash Type = SHA3-SHA224

DAO_LC_HASH_TYPE_SHA3_SHA256 

Hash Type = SHA3-SHA256

DAO_LC_HASH_TYPE_SHA3_SHA384 

Hash Type = SHA3-SHA384

DAO_LC_HASH_TYPE_SHA3_SHA512 

Hash Type = SHA3-SHA512

DAO_LC_HASH_TYPE_SHA3_SHAKE128 

Hash Type = SHA3-SHAKE128

DAO_LC_HASH_TYPE_SHA3_SHAKE256 

Hash Type = SHA3-SHAKE256

DAO_LC_HASH_TYPE_CMAC 

Hash Type = CMAC

Definition at line 494 of file dao_liquid_crypto.h.

◆ dao_liquid_crypto_ec_curve_type

The liquid crypto supported elliptic curves

Enumerator
DAO_LC_AE_EC_ID_PMAX 

Maximum value for elliptic curve identifier

Definition at line 534 of file dao_liquid_crypto.h.

◆ dao_lc_random_type

Parameters for random number generation operation.

This structure encapsulates all parameters required for both hardware RNG and X9.17 (3DES-based) RNG.

For hardware RNG:

  • Set type = DAO_LC_RANDOM_TYPE_HW
  • Only out_buf, rand_len, and op_cookie are required.

For X9.17 RNG:

  • Set type = DAO_LC_RANDOM_TYPE_X9_17
  • key, datetime, seed, out_seed must be provided as specified.
Enumerator
DAO_LC_RANDOM_TYPE_HW 

Use hardware RNG

DAO_LC_RANDOM_TYPE_X9_17 

Use X9.17 (3DES-based) RNG

Definition at line 778 of file dao_liquid_crypto.h.

◆ dao_lc_aes_key_len_bytes

The liquid crypto AES key length in bytes.

Enumerator
DAO_LC_AES_KEY_LEN_16_BYTES 

AES key length = 16 bytes

DAO_LC_AES_KEY_LEN_24_BYTES 

AES key length = 24 bytes

DAO_LC_AES_KEY_LEN_32_BYTES 

AES key length = 32 bytes

Definition at line 821 of file dao_liquid_crypto.h.

Function Documentation

◆ dao_liquid_crypto_init()

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().

Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENODEV, indicating that the device is not available.

◆ dao_liquid_crypto_fini()

int dao_liquid_crypto_fini ( void  )

Cleanup liquid crypto.

This function cleans up the liquid crypto library.

Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause -EINVAL, indicating an invalid argument.

◆ dao_liquid_crypto_info_get()

int dao_liquid_crypto_info_get ( struct dao_lc_info info)

Get liquid crypto information.

This function retrieves the liquid crypto information.

Parameters
info[out] A pointer to the liquid crypto information structure.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause

◆ dao_liquid_crypto_dev_create()

int dao_liquid_crypto_dev_create ( struct dao_lc_dev_conf conf)

Create a liquid crypto device.

This function creates a liquid crypto device.

Parameters
confA pointer to the liquid crypto device configuration structure.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -EEXIST, indicating that the device already exists.

◆ dao_liquid_crypto_dev_destroy()

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. Once destroyed, the device cannot be used.

Parameters
dev_idThe device identifier.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause -EINVAL, indicating an invalid argument.

◆ dao_liquid_crypto_qp_configure()

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.

Parameters
dev_idThe device identifier. Value must between 0 and dao_lc_info.nb_dev - 1.
qp_idThe queue pair identifier. Value must between 0 and dao_lc_info.nb_qp[dev_id] - 1.
confA pointer to the liquid crypto queue pair configuration structure.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.

◆ dao_liquid_crypto_dev_start()

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.

Note: For performance benefits, the actual number of descriptors would be rounded up to a power of 2.

Parameters
dev_idThe device identifier.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause -EINVAL, indicating an invalid argument. -EEXIST, indicating that the file exists.

◆ dao_liquid_crypto_dev_stop()

int dao_liquid_crypto_dev_stop ( uint8_t  dev_id)

Stop a liquid crypto device.

This function stops a liquid crypto device.

Parameters
dev_idThe device identifier.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause -EINVAL, indicating an invalid argument.

◆ dao_liquid_crypto_seg_size_calc()

uint16_t dao_liquid_crypto_seg_size_calc ( struct dao_lc_feature_params params)

Calculate the size of the maximum segment size.

This function calculates the size of the maximum segment size for the liquid crypto device to support the given feature parameters.

This value can be passed to the max_seg_size field of the dao_lc_qp_conf structure when configuring a queue pair.

Parameters
paramsA pointer to the liquid crypto feature parameters structure.
Returns
  • On success, the size of the maximum segment size is returned.
  • On failure, 0 is returned.

◆ dao_liquid_crypto_enqueue_op_passthrough()

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.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOSPC, indicating that there is no space left on the device.
  • -ENOMEM, indicating an out of memory error.
  • -EIO, indicating an I/O error.

◆ dao_liquid_crypto_enq_op_pkcs1v15enc()

int dao_liquid_crypto_enq_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.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
key_typeThe type of RSA key to be used.
mod_lenThe length of the modulus. Value should be at least 17 bytes and at most 1024 bytes.
exp_lenThe length of the exponent.
msg_lenThe length of the message. Value must be at most mod_len - 11.
modThe address of the buffer containing the modulus. Length of this buffer must be at most mod_len bytes.
expThe address of the buffer containing the exponent.
msgThe address of the buffer containing the message.
emThe address of the buffer where the encrypted message is to be stored. Length of this buffer must be at least mod_len bytes.
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENOSPC, indicating that there is no space left on the device.
  • -EIO, indicating an I/O error.

◆ dao_liquid_crypto_enq_op_pkcs1v15dec()

int dao_liquid_crypto_enq_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.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
key_typeThe type of RSA key to be used.
mod_lenThe length of the modulus. Value should be at least 17 bytes and at most 1024 bytes.
exp_lenThe length of the exponent.
modThe address of the buffer containing the modulus. Length of this buffer must be mod_len bytes.
expThe address of the buffer containing the exponent.
emThe address of the buffer containing the encrypted message. Length of this buffer must be mod_len bytes.
msgThe address of the buffer where the decrypted message is to be stored. Length of this buffer must be at least mod_len - 11 bytes.
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENOSPC, indicating that there is no space left on the device.
  • -EIO, indicating an I/O error.

◆ dao_liquid_crypto_enq_op_pkcs1v15enc_crt()

int dao_liquid_crypto_enq_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.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
mod_lenThe length of the modulus. Value must be even and should be at least 34 bytes and at most 1024 bytes.
msg_lenThe length of the message in bytes. Value must be at most mod_len - 11.
qThe address of the buffer containing the first factor. Length of this buffer must be mod_len/2 bytes and the value must be odd.
dQThe address of the buffer containing the first factor's CRT exponent. Length of this buffer must be mod_len/2 bytes.
pThe address of the buffer containing the second factor. Length of this buffer must be mod_len/2 bytes and the value must be odd.
dPThe address of the buffer containing the second factor's CRT exponent. Length of this buffer must be mod_len/2 bytes.
qInvThe address of the buffer containing the CRT coefficient. Length of this buffer must be mod_len/2 bytes.
msgThe address of the buffer containing the message.
emThe address of the buffer where the encrypted message is to be stored. Length of this buffer must be mod_len bytes.
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENOSPC, indicating that there is no space left on the device.
  • -EIO, indicating an I/O error.

◆ dao_liquid_crypto_enq_op_pkcs1v15dec_crt()

int dao_liquid_crypto_enq_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.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
mod_lenThe length of the modulus in bytes. Value must be even and should be at least 34 bytes and at most 1024 bytes.
qThe address of the buffer containing the first factor. Length of this buffer must be mod_len/2 bytes and the value must be odd.
dQThe address of the buffer containing the first factor's CRT exponent. Length of this buffer must be mod_len/2 bytes.
pThe address of the buffer containing the second factor. Length of this buffer must be mod_len/2 bytes and the value must be odd.
dPThe address of the buffer containing the second factor's CRT exponent. Length of this buffer must be mod_len/2 bytes.
qInvThe address of the buffer containing the CRT coefficient. Length of this buffer must be mod_len/2 bytes.
emThe address of the buffer containing the encrypted message. Length of this buffer must be mod_len bytes.
msgThe address of the buffer where the decrypted message is to be stored. Length of this buffer must be at least mod_len - 11 bytes.
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENOSPC, indicating that there is no space left on the device.
  • -EIO, indicating an I/O error.

◆ dao_liquid_crypto_enq_op_random()

int dao_liquid_crypto_enq_op_random ( uint8_t  dev_id,
uint16_t  qp_id,
struct dao_lc_random_op *  op 
)

Enqueue request to generate random data.

Select the RNG type and provide parameters via the op structure.

See also
struct dao_lc_random_op for details.
Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
opPointer to the random operation parameter structure.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENOSPC, indicating that there is no space left on the device.
  • -EIO, indicating an I/O error.

◆ dao_liquid_crypto_sym_enqueue_burst()

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.

Note: The max number of requests that can be enqueued at once is 128.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operations are to be enqueued.
opThe array of pointers to dao_lc_sym_op structures containing the operations to be enqueued.
nb_opsThe number of operations to enqueue.
Returns
The number of operations enqueued. The return value can be less than the number of operations requested to be enqueued if the queue is full or if there are any errors in the operations. In case of errors, 'rte_errno' will be set to indicate the cause.
  • EINVAL, indicating an invalid argument.
  • ENOMEM, indicating an out of memory error.
  • ENOSPC, indicating that there is no space left on the device.
  • EIO, indicating an I/O error.

◆ dao_liquid_crypto_dequeue_burst()

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.

Note: The max number of requests that can be dequeued at once is 128.

Parameters
dev_idThe identifier of the device.
qp_idThe 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_opsThe maximum number of operations to dequeue.
Returns
The number of operations dequeued. The return value can be less than the number of operations requested to be dequeued if the queue is empty or if there are any errors in the operations. In case of errors, 'rte_errno' will be set to indicate the cause.
  • EINVAL, indicating an invalid argument.

◆ dao_liquid_crypto_sym_sess_create()

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.

Parameters
dev_idThe identifier of the device.
ctxThe symmetric context.
sess_cookieThe 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.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause

◆ dao_liquid_crypto_sym_sess_destroy()

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.

Parameters
dev_idThe identifier of the device.
sess_idThe session identifier.
sess_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_cmd_sess_event structure when the operation is dequeued.
Returns
  • On success, 0 is returned.
  • On failure, a negative value is returned indicating the cause

◆ dao_liquid_crypto_cmd_event_dequeue()

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.

Note: The max number of requests that can be dequeued at once is 128.

Parameters
dev_idThe identifier of the device.
eventsThe array of pointers to dao_lc_cmd_event structures where the command events can be stored.
nb_eventsThe maximum number of command events to dequeue.
Returns
The number of command events dequeued. The return value can be less than the number of command events requested to be dequeued if the queue is empty or if there are no command events available. In case of errors, 'rte_errno' will be set to indicate the cause.
  • EINVAL, indicating an invalid argument.

◆ dao_liquid_crypto_enq_op_ecdsa_sign()

int dao_liquid_crypto_enq_op_ecdsa_sign ( uint8_t  dev_id,
uint16_t  qp_id,
enum dao_liquid_crypto_ec_curve_type  curve_id,
uint16_t  nonce_len,
uint16_t  pkey_len,
uint16_t  digest_len,
const uint8_t *  nonce,
const uint8_t *  pkey,
const uint8_t *  digest_data,
uint8_t *  rs_outdata,
uint64_t  op_cookie 
)

Enqueue request to perform ECDSA sign operation on the crypto device.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
curve_idThe identifier of the elliptic curve to be used for ECDSA signing. Supported curve types are:
  • DAO_LC_AE_EC_ID_P192
  • DAO_LC_AE_EC_ID_P224
  • DAO_LC_AE_EC_ID_P256
  • DAO_LC_AE_EC_ID_P384
  • DAO_LC_AE_EC_ID_P521
nonce_lenThe length of the ECDSA per-message secret number in bytes. For all curves except P-521, nonce_len must be equal to the prime length of the curve. For P-521, nonce_len can be either the prime length or (prime length - 1) bytes.
pkey_lenThe length of the ECDSA private key data in bytes. pkey_len must be equal to the prime length of the curve. For P-521, pkey_len can be either the prime length or (prime length - 1) bytes.
digest_lenThe length of the message digest in bytes. The valid digest length and maximum supported length must be equal to the prime length of the curve.
nonceThe address of the buffer containing the per-message secret number (nonce). Length must be equal to the prime length of the curve.
pkeyThe address of the buffer containing the private key data. The private key is an integer in the interval [1, n-1], where n is the order of the base point G of the elliptic curve. Length must be equal to the prime length of the curve.
digest_dataThe address of the buffer containing the message digest.
rs_outdataThe address of the buffer where the ECDSA signature (containing both r and s components) is to be stored. For all curves except P-521, the buffer must be exactly 2 * prime_length bytes in size, where prime_length is the prime length of the specified curve. For the P-521 curve, the buffer can be either 2 * prime_length bytes or 2 * (prime_length - 1) bytes in size. The signature is stored as a single contiguous block, with the r component (prime_length bytes) followed immediately by the s component (prime_length bytes).
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
0 on success, negative value on failure. -EINVAL, indicating an invalid argument. -ENOMEM, indicating an out of memory error. -ENOSPC, indicating that there is no space left on the device.

◆ dao_liquid_crypto_enq_op_ecdsa_verify()

int dao_liquid_crypto_enq_op_ecdsa_verify ( uint8_t  dev_id,
uint16_t  qp_id,
enum dao_liquid_crypto_ec_curve_type  curve_id,
uint16_t  r_len,
uint16_t  s_len,
uint16_t  digest_len,
uint16_t  qx_len,
uint16_t  qy_len,
const uint8_t *  r_data,
const uint8_t *  s_data,
const uint8_t *  digest,
const uint8_t *  qx_data,
const uint8_t *  qy_data,
uint64_t  op_cookie 
)

Enqueue request to perform ECDSA verify operation on the crypto device.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
curve_idThe identifier of the elliptic curve to be used for ECDSA verify. Supported curve types are:
  • DAO_LC_AE_EC_ID_P192
  • DAO_LC_AE_EC_ID_P224
  • DAO_LC_AE_EC_ID_P256
  • DAO_LC_AE_EC_ID_P384
  • DAO_LC_AE_EC_ID_P521
r_lenThe length of the ECDSA r sign component in bytes. For all curves except P-521, r_len must be equal to the prime length of the curve. For P-521, r_len can be either the prime length or (prime length - 1) bytes.
s_lenThe length of the ECDSA s sign component in bytes. For all curves except P-521, s_len must be equal to the prime length of the curve. For P-521, s_len can be either the prime length or (prime length - 1) bytes.
digest_lenThe length of the message digest in bytes. The valid digest length and maximum supported length must be equal to the prime length of the curve.
qx_lenThe length of the x-coordinate of the public key in bytes. For all curves except P-521, qx_len must be equal to the prime length of the curve. For P-521, qx_len can be either the prime length or (prime length - 1) bytes.
qy_lenThe length of the y-coordinate of the public key in bytes. For all curves except P-521, qy_len must be equal to the prime length of the curve. For P-521, qy_len can be either the prime length or (prime length - 1) bytes.
r_dataThe address of the buffer containing the ECDSA r component.
s_dataThe address of the buffer containing the ECDSA s component.
digestThe address of the buffer containing the message digest.
qx_dataThe address of the buffer containing the x-coordinate of the public key. The public_x key is an integer in the interval [0, q-1], where q is prime number
qy_dataThe address of the buffer containing the y-coordinate of the public key. The public_y key is an integer in the interval [0, q-1], where q is prime number
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
0 on success, negative value on failure. -EINVAL, indicating an invalid argument. -ENOMEM, indicating an out of memory error. -ENOSPC, indicating that there is no space left on the device.

◆ dao_liquid_crypto_enq_op_rsa_oaep_enc()

int dao_liquid_crypto_enq_op_rsa_oaep_enc ( uint8_t  dev_id,
uint16_t  qp_id,
uint8_t *  label,
uint16_t  label_len,
enum dao_lc_hash_type  hash_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 OAEP public encrypt operation on the crypto device.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
labelOptional label to be associated with the message. In RSA OAEP, this label is used as an input to the mask generation function (MGF) and can provide additional binding context for the encryption operation. If not required, it can be set to NULL.
label_lenThe length of the label in bytes. If no label is used, this should be set to 0.
hash_typeThe hash algorithm to be used in the OAEP padding scheme. Supported hash types are: -DAO_LC_HASH_TYPE_SHA1 -DAO_LC_HASH_TYPE_SHA2_SHA256 -DAO_LC_HASH_TYPE_SHA2_SHA384 -DAO_LC_HASH_TYPE_SHA2_SHA512
mod_lenThe length of the modulus. Value should be at least 17 bytes and at most 1024 bytes.
exp_lenThe length of the exponent.
msg_lenThe length of the message. .
modThe address of the buffer containing the modulus. Length of this buffer must be at most mod_len bytes.
expThe address of the buffer containing the exponent.
msgThe address of the buffer containing the message. The length of the message (msg_len) must satisfy: msg_len <= (mod_len - (2 * hlen) - 2), where hlen is the length of the hash output used in OAEP.
emThe address of the buffer where the encrypted message is to be stored. Length of this buffer must be at least mod_len bytes.
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENOSPC, indicating that there is no space left on the device.
  • -EIO, indicating an I/O error.

◆ dao_liquid_crypto_enq_op_rsa_oaep_exp_dec()

int dao_liquid_crypto_enq_op_rsa_oaep_exp_dec ( uint8_t  dev_id,
uint16_t  qp_id,
uint8_t *  label,
uint16_t  label_len,
enum dao_lc_hash_type  hash_type,
uint16_t  mod_len,
uint16_t  exp_len,
uint16_t  em_len,
uint8_t *  mod,
uint8_t *  exp,
uint8_t *  em,
uint8_t *  msg,
uint64_t  op_cookie 
)

Enqueue request to perform RSA OAEP private decrypt operation on the crypto device.

Parameters
dev_idThe identifier of the device.
qp_idThe index of the queue pair on which the operation is to be enqueued.
labelOptional label to be associated with the message. In RSA OAEP, this label is used as an input to the mask generation function (MGF) and can provide additional binding context for the decryption operation. If not required, it can be set to NULL.
label_lenThe length of the label in bytes. If no label is used, this should be set to 0.
hash_typeThe hash algorithm to be used in the OAEP padding scheme. Supported hash types are: -DAO_LC_HASH_TYPE_SHA1 -DAO_LC_HASH_TYPE_SHA2_SHA256 -DAO_LC_HASH_TYPE_SHA2_SHA384 -DAO_LC_HASH_TYPE_SHA2_SHA512
mod_lenThe length of the modulus. Value should be at least 17 bytes and at most LIQUID_CRYPTO_RSA_MOD_LEN_MAX bytes.
exp_lenThe length of the exponent.
modThe address of the buffer containing the modulus. Length of this buffer must be mod_len bytes.
expThe address of the buffer containing the exponent.
emThe address of the buffer containing the encrypted message. Length of this buffer must be mod_len bytes.
em_lenThe length of the encrypted message. This should be equal to mod_len bytes.
msgThe address of the buffer where the decrypted message is to be stored.
op_cookieThe cookie to be associated with the operation. This cookie is returned in the dao_lc_res structure when the operation is dequeued.
Returns
  • 0 on success, negative value on failure.
  • -EINVAL, indicating an invalid argument.
  • -ENOMEM, indicating an out of memory error.
  • -ENOSPC, indicating that there is no space left on the device.
  • -EIO, indicating an I/O error.