rte_crypto.h(3)

πŸ’– NAME πŸ’–

rte_crypto.h β€” straight out of the Library Functions Manual, section 3, bestie. It's the crypto header file that holds all the shared, common definitions for DPDK's crypto ops. She's the blueprint. The moment. 🫢


✨ SYNOPSIS ✨

Okay so first of all, the includes, and yes you need all of them:

#include <rte_mbuf.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_common.h>
#include 'rte_crypto_sym.h'
#include 'rte_crypto_asym.h'

(not me clocking that the last two use single quotes instead of angle brackets β€” that's literally what's in the header, so we leave it, periodt πŸ’…)

πŸŽ€ Data Structures πŸŽ€

Two structs, both iconic:

  • struct rte_crypto_op
  • struct rte_crypto_op_pool_private

πŸ“ Macros πŸ“

#define RTE_CRYPTO_OP_AUX_FLAGS_SESS_SOFT_EXPIRY   (1 << 0)
#define RTE_CRYPTO_OP_AUX_FLAGS_IPSEC_SOFT_EXPIRY
    RTE_CRYPTO_OP_AUX_FLAGS_SESS_SOFT_EXPIRY

🌸 Enumerations 🌸

  • enum rte_crypto_op_type { RTE_CRYPTO_OP_TYPE_UNDEFINED, RTE_CRYPTO_OP_TYPE_SYMMETRIC, RTE_CRYPTO_OP_TYPE_ASYMMETRIC }
  • enum rte_crypto_op_status { RTE_CRYPTO_OP_STATUS_SUCCESS, RTE_CRYPTO_OP_STATUS_NOT_PROCESSED, RTE_CRYPTO_OP_STATUS_AUTH_FAILED, RTE_CRYPTO_OP_STATUS_INVALID_SESSION, RTE_CRYPTO_OP_STATUS_INVALID_ARGS, RTE_CRYPTO_OP_STATUS_ERROR }
  • enum rte_crypto_op_sess_type { RTE_CRYPTO_OP_WITH_SESSION, RTE_CRYPTO_OP_SESSIONLESS, RTE_CRYPTO_OP_SECURITY_SESSION }

πŸ¦‹ Functions πŸ¦‹

Here's the whole girl squad of function signatures, lowkey the main character list:

static void __rte_crypto_op_reset (struct rte_crypto_op *op, enum rte_crypto_op_type type)
static uint16_t __rte_crypto_op_get_priv_data_size (struct rte_mempool *mempool)
struct rte_mempool * rte_crypto_op_pool_create (const char *name, enum rte_crypto_op_type type, unsigned nb_elts, unsigned cache_size, uint16_t priv_size, int socket_id)
static int __rte_crypto_op_raw_bulk_alloc (struct rte_mempool *mempool, enum rte_crypto_op_type type, struct rte_crypto_op **ops, uint16_t nb_ops)
static struct rte_crypto_op * rte_crypto_op_alloc (struct rte_mempool *mempool, enum rte_crypto_op_type type)
static unsigned rte_crypto_op_bulk_alloc (struct rte_mempool *mempool, enum rte_crypto_op_type type, struct rte_crypto_op **ops, uint16_t nb_ops)
static void * __rte_crypto_op_get_priv_data (struct rte_crypto_op *op, uint32_t size)
static void rte_crypto_op_free (struct rte_crypto_op *op)
static struct rte_crypto_op * rte_crypto_sym_op_alloc_from_mbuf_priv_data (struct rte_mbuf *m)
static struct rte_crypto_sym_xform * rte_crypto_op_sym_xforms_alloc (struct rte_crypto_op *op, uint8_t nb_xforms)
static int rte_crypto_op_attach_sym_session (struct rte_crypto_op *op, void *sess)
static int rte_crypto_op_attach_asym_session (struct rte_crypto_op *op, struct rte_cryptodev_asym_session *sess)

πŸ’œ Detailed Description πŸ’œ

RTE Cryptography Common Definitions πŸŽ‰

That's the whole vibe. It's giving "definition in file rte_crypto.h." β€” literally, that's what the docs say and I'm not gonna gatekeep it.


🌈 Macro Definition Documentation 🌈

#define RTE_CRYPTO_OP_AUX_FLAGS_SESS_SOFT_EXPIRY (1 << 0)

Session soft expiry limit has been reached. Bestie, this applies to any session that has a soft lifetime feature supported. She's the little flag that says "your session is getting old, heads up."

See also πŸ‘€

  • rte_security_ipsec_lifetime
  • rte_security_tls_record_lifetime

Definition at line 68 of file rte_crypto.h.

#define RTE_CRYPTO_OP_AUX_FLAGS_IPSEC_SOFT_EXPIRY

Okay so this one literally just is RTE_CRYPTO_OP_AUX_FLAGS_SESS_SOFT_EXPIRY.

SA soft expiry limit has been reached β€” that's the tea. Security Association said "I'm tired, boss."

Definition at line 78 of file rte_crypto.h.


🧊 Enumeration Type Documentation 🧊

enum rte_crypto_op_type

Crypto operation types β€” pick your fighter:

  • RTE_CRYPTO_OP_TYPE_UNDEFINED β€” Undefined operation type (the "figure it out later" option)
  • RTE_CRYPTO_OP_TYPE_SYMMETRIC β€” Symmetric operation
  • RTE_CRYPTO_OP_TYPE_ASYMMETRIC β€” Asymmetric operation

Definition at line 28 of file rte_crypto.h.

enum rte_crypto_op_status

Status of crypto operation β€” the mood ring of your op:

  • RTE_CRYPTO_OP_STATUS_SUCCESS β€” Operation completed successfully πŸŽ‰
  • RTE_CRYPTO_OP_STATUS_NOT_PROCESSED β€” Operation has not yet been processed by a crypto device (she's waiting her turn, patient queen)
  • RTE_CRYPTO_OP_STATUS_AUTH_FAILED β€” Authentication verification failed πŸ’€
  • RTE_CRYPTO_OP_STATUS_INVALID_SESSION β€” Symmetric operation failed due to invalid session arguments, or, if in session-less mode, failed to allocate private operation material. 😭
  • RTE_CRYPTO_OP_STATUS_INVALID_ARGS β€” Operation failed due to invalid arguments in request
  • RTE_CRYPTO_OP_STATUS_ERROR β€” Error handling operation

Definition at line 38 of file rte_crypto.h.

enum rte_crypto_op_sess_type

Crypto operation session type. So this is used to specify whether a crypto operation has a session structure attached for immutable parameters, or if all the operation information is included in the operation data structure. Basically: does she carry a session, or is she self-contained? πŸ‘‘

  • RTE_CRYPTO_OP_WITH_SESSION β€” Session based crypto operation
  • RTE_CRYPTO_OP_SESSIONLESS β€” Session-less crypto operation
  • RTE_CRYPTO_OP_SECURITY_SESSION β€” Security session crypto operation

Definition at line 61 of file rte_crypto.h.


πŸ”₯ Function Documentation πŸ”₯

__rte_crypto_op_reset

void __rte_crypto_op_reset (struct rte_crypto_op * op, enum rte_crypto_op_type type)

This one's [inline], [static] β€” header-file lifestyle.

Reset the fields of a crypto operation to their default values. Factory reset, but for an op. ✨

Parameters

  • op β€” The crypto operation to be reset.
  • type β€” The crypto operation type.

Definition at line 196 of file rte_crypto.h.

__rte_crypto_op_get_priv_data_size

uint16_t __rte_crypto_op_get_priv_data_size (struct rte_mempool * mempool)

[inline], [static], obvi.

Returns the size of private data allocated with each rte_crypto_op object by the mempool. Measuring tape behavior. πŸ“

Parameters

  • mempool β€” rte_crypto_op mempool

Returns

  • private data size

Definition at line 235 of file rte_crypto.h.

rte_crypto_op_pool_create

struct rte_mempool * rte_crypto_op_pool_create (const char * name, enum rte_crypto_op_type type, unsigned nb_elts, unsigned cache_size, uint16_t priv_size, int socket_id)

Creates a crypto operation pool β€” the whole friend group, allocated up front. 🫢

Parameters

  • name β€” pool name
  • type β€” crypto operation type, use RTE_CRYPTO_OP_TYPE_UNDEFINED for a pool which supports all operation types
  • nb_elts β€” number of elements in pool
  • cache_size β€” Number of elements to cache on lcore, see rte_mempool_create for further details about cache size
  • priv_size β€” Size of private data to allocate with each operation
  • socket_id β€” Socket to allocate memory on

Returns

  • 🌟 On success pointer to mempool
  • πŸ’€ On failure NULL

__rte_crypto_op_raw_bulk_alloc

int __rte_crypto_op_raw_bulk_alloc (struct rte_mempool * mempool, enum rte_crypto_op_type type, struct rte_crypto_op ** ops, uint16_t nb_ops)

[inline], [static].

Bulk allocate raw element from mempool and return as crypto operations. Wholesale, no individual attention, and honestly? Efficient. πŸ’…

Parameters

  • mempool β€” crypto operation mempool.
  • type β€” crypto operation type.
  • ops β€” Array to place allocated crypto operations
  • nb_ops β€” Number of crypto operations to allocate

Returns

  • On success returns number of ops allocated

Definition at line 280 of file rte_crypto.h.

rte_crypto_op_alloc

struct rte_crypto_op * rte_crypto_op_alloc (struct rte_mempool * mempool, enum rte_crypto_op_type type)

[inline], [static].

Allocate a crypto operation from a mempool with default parameters set. One (1) op, freshly picked. 🌸

Parameters

  • mempool β€” crypto operation mempool
  • type β€” operation type to allocate

Returns

  • ✨ On success returns a valid rte_crypto_op structure
  • πŸ’€ On failure returns NULL

Definition at line 308 of file rte_crypto.h.

rte_crypto_op_bulk_alloc

unsigned rte_crypto_op_bulk_alloc (struct rte_mempool * mempool, enum rte_crypto_op_type type, struct rte_crypto_op ** ops, uint16_t nb_ops)

[inline], [static].

Bulk allocate crypto operations from a mempool with default parameters set. It's giving "bring the whole group chat." πŸŽ€

Parameters

  • mempool β€” crypto operation mempool
  • type β€” operation type to allocate
  • ops β€” Array to place allocated crypto operations
  • nb_ops β€” Number of crypto operations to allocate

Returns

  • nb_ops if the number of operations requested were allocated.
  • 0 if the requested number of ops are not available. None are allocated in this case. (all or nothing, no crumbs πŸ™ˆ)

Definition at line 338 of file rte_crypto.h.

__rte_crypto_op_get_priv_data

void * __rte_crypto_op_get_priv_data (struct rte_crypto_op * op, uint32_t size)

[inline], [static].

Returns a pointer to the private data of a crypto operation if that operation has enough capacity for the requested size. Vibe check included. πŸ¦‹

Parameters

  • op β€” crypto operation.
  • size β€” size of space requested in private data.

Returns

  • if sufficient space available returns pointer to start of private data
  • if insufficient space returns NULL

Definition at line 368 of file rte_crypto.h.

rte_crypto_op_free

void rte_crypto_op_free (struct rte_crypto_op * op)

[inline], [static].

free crypto operation structure β€” If operation has been allocate from a rte_mempool, then the operation will be returned to the mempool. Rehoming arc. ♻️

Parameters

  • op β€” Pointer to symmetric crypto operation allocated with rte_crypto_op_alloc() If op is NULL, no operation is performed. (no NULL slander here, she just minds her business)

Definition at line 398 of file rte_crypto.h.

rte_crypto_sym_op_alloc_from_mbuf_priv_data

struct rte_crypto_op * rte_crypto_sym_op_alloc_from_mbuf_priv_data (struct rte_mbuf * m)

[inline], [static].

Allocate a symmetric crypto operation in the private data of an mbuf. She literally lives inside her mbuf, that's so main character. 🧚

Parameters

  • m β€” mbuf which is associated with the crypto operation, the operation will be allocated in the private data of that mbuf.

Returns

  • πŸ’– On success returns a pointer to the crypto operation.
  • πŸ’€ On failure returns NULL.

Definition at line 416 of file rte_crypto.h.

rte_crypto_op_sym_xforms_alloc

struct rte_crypto_sym_xform * rte_crypto_op_sym_xforms_alloc (struct rte_crypto_op * op, uint8_t nb_xforms)

[inline], [static].

Allocate space for symmetric crypto xforms in the private data space of the crypto operation. This also defaults the crypto xform type and configures the chaining of the xforms in the crypto operation. She sets up the whole chain reaction, no notes. πŸ”—

Returns

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

Definition at line 450 of file rte_crypto.h.

rte_crypto_op_attach_sym_session

int rte_crypto_op_attach_sym_session (struct rte_crypto_op * op, void * sess)

[inline], [static].

Attach a session to a crypto operation. Getting official. πŸ’

Parameters

  • op β€” crypto operation, must be of type symmetric
  • sess β€” cryptodev session

Definition at line 476 of file rte_crypto.h.

rte_crypto_op_attach_asym_session

int rte_crypto_op_attach_asym_session (struct rte_crypto_op * op, struct rte_cryptodev_asym_session * sess)

[inline], [static].

Attach a asymmetric session to a crypto operation. Same ritual, different type. 🫢

Parameters

  • op β€” crypto operation, must be of type asymmetric
  • sess β€” cryptodev session

Definition at line 493 of file rte_crypto.h.


🌟 Author 🌟

Generated automatically by Doxygen for DPDK from the source code. So technically a robot wrote this, and technically I'm just translating it for the girlies. πŸ’œ


okay that's the whole page bestie, no skips, no cap, every flag and line number preserved, and if you made it to the end you get certified-unix-girlfriend status πŸŒˆπŸ‘‘

this little love letter to crypto ops comes to you from DPDK, Version 25.11.3 β€” mwah, take care of her πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from