DPDK  24.07.0
Data Structures | Enumerations | Functions | Variables
rte_crypto_sym.h File Reference
#include <string.h>
#include <rte_compat.h>
#include <rte_mbuf.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_common.h>

Go to the source code of this file.

Data Structures

struct  rte_crypto_vec
 
struct  rte_crypto_sgl
 
struct  rte_crypto_va_iova_ptr
 
struct  rte_crypto_sym_vec
 
union  rte_crypto_sym_ofs
 
struct  rte_crypto_cipher_xform
 
struct  rte_crypto_auth_xform
 
struct  rte_crypto_sym_xform
 
struct  rte_crypto_sym_op
 

Enumerations

enum  rte_crypto_cipher_algorithm {
  RTE_CRYPTO_CIPHER_NULL = 1, RTE_CRYPTO_CIPHER_3DES_CBC, RTE_CRYPTO_CIPHER_3DES_CTR, RTE_CRYPTO_CIPHER_3DES_ECB,
  RTE_CRYPTO_CIPHER_AES_CBC, RTE_CRYPTO_CIPHER_AES_CTR, RTE_CRYPTO_CIPHER_AES_ECB, RTE_CRYPTO_CIPHER_AES_F8,
  RTE_CRYPTO_CIPHER_AES_XTS, RTE_CRYPTO_CIPHER_ARC4, RTE_CRYPTO_CIPHER_KASUMI_F8, RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
  RTE_CRYPTO_CIPHER_ZUC_EEA3, RTE_CRYPTO_CIPHER_DES_CBC, RTE_CRYPTO_CIPHER_AES_DOCSISBPI, RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
  RTE_CRYPTO_CIPHER_SM4_ECB, RTE_CRYPTO_CIPHER_SM4_CBC, RTE_CRYPTO_CIPHER_SM4_CTR, RTE_CRYPTO_CIPHER_SM4_OFB,
  RTE_CRYPTO_CIPHER_SM4_CFB
}
 
enum  rte_crypto_cipher_operation { RTE_CRYPTO_CIPHER_OP_ENCRYPT, RTE_CRYPTO_CIPHER_OP_DECRYPT }
 
enum  rte_crypto_auth_algorithm {
  RTE_CRYPTO_AUTH_NULL = 1, RTE_CRYPTO_AUTH_AES_CBC_MAC, RTE_CRYPTO_AUTH_AES_CMAC, RTE_CRYPTO_AUTH_AES_GMAC,
  RTE_CRYPTO_AUTH_AES_XCBC_MAC, RTE_CRYPTO_AUTH_KASUMI_F9, RTE_CRYPTO_AUTH_MD5, RTE_CRYPTO_AUTH_MD5_HMAC,
  RTE_CRYPTO_AUTH_SHA1, RTE_CRYPTO_AUTH_SHA1_HMAC, RTE_CRYPTO_AUTH_SHA224, RTE_CRYPTO_AUTH_SHA224_HMAC,
  RTE_CRYPTO_AUTH_SHA256, RTE_CRYPTO_AUTH_SHA256_HMAC, RTE_CRYPTO_AUTH_SHA384, RTE_CRYPTO_AUTH_SHA384_HMAC,
  RTE_CRYPTO_AUTH_SHA512, RTE_CRYPTO_AUTH_SHA512_HMAC, RTE_CRYPTO_AUTH_SNOW3G_UIA2, RTE_CRYPTO_AUTH_ZUC_EIA3,
  RTE_CRYPTO_AUTH_SHA3_224, RTE_CRYPTO_AUTH_SHA3_224_HMAC, RTE_CRYPTO_AUTH_SHA3_256, RTE_CRYPTO_AUTH_SHA3_256_HMAC,
  RTE_CRYPTO_AUTH_SHA3_384, RTE_CRYPTO_AUTH_SHA3_384_HMAC, RTE_CRYPTO_AUTH_SHA3_512, RTE_CRYPTO_AUTH_SHA3_512_HMAC,
  RTE_CRYPTO_AUTH_SM3, RTE_CRYPTO_AUTH_SHAKE_128, RTE_CRYPTO_AUTH_SHAKE_256
}
 
enum  rte_crypto_auth_operation { RTE_CRYPTO_AUTH_OP_VERIFY, RTE_CRYPTO_AUTH_OP_GENERATE }
 
enum  rte_crypto_aead_algorithm { RTE_CRYPTO_AEAD_AES_CCM = 1, RTE_CRYPTO_AEAD_AES_GCM, RTE_CRYPTO_AEAD_CHACHA20_POLY1305 }
 
enum  rte_crypto_aead_operation { RTE_CRYPTO_AEAD_OP_ENCRYPT, RTE_CRYPTO_AEAD_OP_DECRYPT }
 
enum  rte_crypto_sym_xform_type { RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED = 0, RTE_CRYPTO_SYM_XFORM_AUTH, RTE_CRYPTO_SYM_XFORM_CIPHER, RTE_CRYPTO_SYM_XFORM_AEAD }
 

Functions

static void __rte_crypto_sym_op_reset (struct rte_crypto_sym_op *op)
 
static struct rte_crypto_sym_xform__rte_crypto_sym_op_sym_xforms_alloc (struct rte_crypto_sym_op *sym_op, void *priv_data, uint8_t nb_xforms)
 
static int __rte_crypto_sym_op_attach_sym_session (struct rte_crypto_sym_op *sym_op, void *sess)
 
static __rte_experimental int rte_crypto_mbuf_to_vec (const struct rte_mbuf *mb, uint32_t ofs, uint32_t len, struct rte_crypto_vec vec[], uint32_t num)
 

Variables

const char * rte_crypto_cipher_operation_strings []
 
const char * rte_crypto_auth_operation_strings []
 
const char * rte_crypto_aead_operation_strings []
 

Detailed Description

RTE Definitions for Symmetric Cryptography

Defines symmetric cipher and authentication algorithms and modes, as well as supported symmetric crypto operation combinations.

Definition in file rte_crypto_sym.h.

Enumeration Type Documentation

◆ rte_crypto_cipher_algorithm

Symmetric Cipher Algorithms

Note, to avoid ABI breakage across releases

  • LIST_END should not be added to this enum
  • the order of enums should not be changed
  • new algorithms should only be added to the end
Enumerator
RTE_CRYPTO_CIPHER_NULL 

NULL cipher algorithm. No mode applies to the NULL algorithm.

RTE_CRYPTO_CIPHER_3DES_CBC 

Triple DES algorithm in CBC mode

RTE_CRYPTO_CIPHER_3DES_CTR 

Triple DES algorithm in CTR mode

RTE_CRYPTO_CIPHER_3DES_ECB 

Triple DES algorithm in ECB mode

RTE_CRYPTO_CIPHER_AES_CBC 

AES algorithm in CBC mode

RTE_CRYPTO_CIPHER_AES_CTR 

AES algorithm in Counter mode

RTE_CRYPTO_CIPHER_AES_ECB 

AES algorithm in ECB mode

RTE_CRYPTO_CIPHER_AES_F8 

AES algorithm in F8 mode

RTE_CRYPTO_CIPHER_AES_XTS 

AES algorithm in XTS mode

RTE_CRYPTO_CIPHER_ARC4 

(A)RC4 cipher algorithm

RTE_CRYPTO_CIPHER_KASUMI_F8 

KASUMI algorithm in F8 mode

RTE_CRYPTO_CIPHER_SNOW3G_UEA2 

SNOW 3G algorithm in UEA2 mode

RTE_CRYPTO_CIPHER_ZUC_EEA3 

ZUC algorithm in EEA3 mode

RTE_CRYPTO_CIPHER_DES_CBC 

DES algorithm in CBC mode

RTE_CRYPTO_CIPHER_AES_DOCSISBPI 

AES algorithm using modes required by DOCSIS Baseline Privacy Plus Spec. Chained mbufs are not supported in this mode, i.e. rte_mbuf.next for m_src and m_dst in the rte_crypto_sym_op must be NULL.

RTE_CRYPTO_CIPHER_DES_DOCSISBPI 

DES algorithm using modes required by DOCSIS Baseline Privacy Plus Spec. Chained mbufs are not supported in this mode, i.e. rte_mbuf.next for m_src and m_dst in the rte_crypto_sym_op must be NULL.

RTE_CRYPTO_CIPHER_SM4_ECB 

ShangMi 4 (SM4) algorithm in ECB mode

RTE_CRYPTO_CIPHER_SM4_CBC 

ShangMi 4 (SM4) algorithm in CBC mode

RTE_CRYPTO_CIPHER_SM4_CTR 

ShangMi 4 (SM4) algorithm in CTR mode

RTE_CRYPTO_CIPHER_SM4_OFB 

ShangMi 4 (SM4) algorithm in OFB mode

RTE_CRYPTO_CIPHER_SM4_CFB 

ShangMi 4 (SM4) algorithm in CFB mode

Definition at line 120 of file rte_crypto_sym.h.

◆ rte_crypto_cipher_operation

Symmetric Cipher Direction

Enumerator
RTE_CRYPTO_CIPHER_OP_ENCRYPT 

Encrypt cipher operation

RTE_CRYPTO_CIPHER_OP_DECRYPT 

Decrypt cipher operation

Definition at line 184 of file rte_crypto_sym.h.

◆ rte_crypto_auth_algorithm

Symmetric Authentication / Hash Algorithms

Note, to avoid ABI breakage across releases

  • LIST_END should not be added to this enum
  • the order of enums should not be changed
  • new algorithms should only be added to the end
Enumerator
RTE_CRYPTO_AUTH_NULL 

NULL hash algorithm.

RTE_CRYPTO_AUTH_AES_CBC_MAC 

AES-CBC-MAC algorithm. Only 128-bit keys are supported.

RTE_CRYPTO_AUTH_AES_CMAC 

AES CMAC algorithm.

RTE_CRYPTO_AUTH_AES_GMAC 

AES GMAC algorithm.

RTE_CRYPTO_AUTH_AES_XCBC_MAC 

AES XCBC algorithm.

RTE_CRYPTO_AUTH_KASUMI_F9 

KASUMI algorithm in F9 mode.

RTE_CRYPTO_AUTH_MD5 

MD5 algorithm

RTE_CRYPTO_AUTH_MD5_HMAC 

HMAC using MD5 algorithm

RTE_CRYPTO_AUTH_SHA1 

160 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA1_HMAC 

HMAC using 160 bit SHA algorithm. HMAC-SHA-1-96 can be generated by setting digest_length to 12 bytes in auth/aead xforms.

RTE_CRYPTO_AUTH_SHA224 

224 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA224_HMAC 

HMAC using 224 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA256 

256 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA256_HMAC 

HMAC using 256 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA384 

384 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA384_HMAC 

HMAC using 384 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA512 

512 bit SHA algorithm.

RTE_CRYPTO_AUTH_SHA512_HMAC 

HMAC using 512 bit SHA algorithm.

RTE_CRYPTO_AUTH_SNOW3G_UIA2 

SNOW 3G algorithm in UIA2 mode.

RTE_CRYPTO_AUTH_ZUC_EIA3 

ZUC algorithm in EIA3 mode

RTE_CRYPTO_AUTH_SHA3_224 

224 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SHA3_224_HMAC 

HMAC using 224 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SHA3_256 

256 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SHA3_256_HMAC 

HMAC using 256 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SHA3_384 

384 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SHA3_384_HMAC 

HMAC using 384 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SHA3_512 

512 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SHA3_512_HMAC 

HMAC using 512 bit SHA3 algorithm.

RTE_CRYPTO_AUTH_SM3 

ShangMi 3 (SM3) algorithm

RTE_CRYPTO_AUTH_SHAKE_128 

128 bit SHAKE algorithm.

RTE_CRYPTO_AUTH_SHAKE_256 

256 bit SHAKE algorithm.

Definition at line 309 of file rte_crypto_sym.h.

◆ rte_crypto_auth_operation

Symmetric Authentication / Hash Operations

Enumerator
RTE_CRYPTO_AUTH_OP_VERIFY 

Verify authentication digest

RTE_CRYPTO_AUTH_OP_GENERATE 

Generate authentication digest

Definition at line 388 of file rte_crypto_sym.h.

◆ rte_crypto_aead_algorithm

Symmetric AEAD Algorithms

Note, to avoid ABI breakage across releases

  • LIST_END should not be added to this enum
  • the order of enums should not be changed
  • new algorithms should only be added to the end
Enumerator
RTE_CRYPTO_AEAD_AES_CCM 

AES algorithm in CCM mode.

RTE_CRYPTO_AEAD_AES_GCM 

AES algorithm in GCM mode.

RTE_CRYPTO_AEAD_CHACHA20_POLY1305 

Chacha20 cipher with poly1305 authenticator

Definition at line 478 of file rte_crypto_sym.h.

◆ rte_crypto_aead_operation

Symmetric AEAD Operations

Enumerator
RTE_CRYPTO_AEAD_OP_ENCRYPT 

Encrypt and generate digest

RTE_CRYPTO_AEAD_OP_DECRYPT 

Verify digest and decrypt

Definition at line 488 of file rte_crypto_sym.h.

◆ rte_crypto_sym_xform_type

Crypto transformation types

Enumerator
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED 

No xform specified

RTE_CRYPTO_SYM_XFORM_AUTH 

Authentication xform

RTE_CRYPTO_SYM_XFORM_CIPHER 

Cipher xform

RTE_CRYPTO_SYM_XFORM_AEAD 

AEAD xform

Definition at line 560 of file rte_crypto_sym.h.

Function Documentation

◆ __rte_crypto_sym_op_reset()

static void __rte_crypto_sym_op_reset ( struct rte_crypto_sym_op op)
inlinestatic

Reset the fields of a symmetric operation to their default values.

Parameters
opThe crypto operation to be reset.

Definition at line 883 of file rte_crypto_sym.h.

◆ __rte_crypto_sym_op_sym_xforms_alloc()

static struct rte_crypto_sym_xform* __rte_crypto_sym_op_sym_xforms_alloc ( struct rte_crypto_sym_op sym_op,
void *  priv_data,
uint8_t  nb_xforms 
)
static

Allocate space for symmetric crypto xforms in the private data space of the crypto operation. This also defaults the crypto xform type to RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED and configures the chaining of the xforms in the crypto operation

Returns
  • On success returns pointer to first crypto xform in crypto operations chain
  • On failure returns NULL

Definition at line 900 of file rte_crypto_sym.h.

◆ __rte_crypto_sym_op_attach_sym_session()

static int __rte_crypto_sym_op_attach_sym_session ( struct rte_crypto_sym_op sym_op,
void *  sess 
)
inlinestatic

Attach a session to a symmetric crypto operation

Parameters
sym_opcrypto operation
sesscryptodev session

Definition at line 923 of file rte_crypto_sym.h.

◆ rte_crypto_mbuf_to_vec()

static __rte_experimental int rte_crypto_mbuf_to_vec ( const struct rte_mbuf mb,
uint32_t  ofs,
uint32_t  len,
struct rte_crypto_vec  vec[],
uint32_t  num 
)
inlinestatic

Converts portion of mbuf data into a vector representation. Each segment will be represented as a separate entry in vec array. Expects that provided ofs + len not to exceed mbuf's pkt_len.

Parameters
mbPointer to the rte_mbuf object.
ofsOffset within mbuf data to start with.
lenLength of data to represent.
vecPointer to an output array of IO vectors.
numSize of an output array.
Returns
  • number of successfully filled entries in vec array.
  • negative number of elements in vec array required.

Definition at line 950 of file rte_crypto_sym.h.

Variable Documentation

◆ rte_crypto_cipher_operation_strings

const char* rte_crypto_cipher_operation_strings[]

Cipher operation name strings

◆ rte_crypto_auth_operation_strings

const char* rte_crypto_auth_operation_strings[]

Authentication operation name strings

◆ rte_crypto_aead_operation_strings

const char* rte_crypto_aead_operation_strings[]

Authentication operation name strings