NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
aes_gcm_common.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <doca_ctx.h>
#include <doca_log.h>
#include <doca_error.h>
#include <doca_pe.h>
#include <doca_argp.h>
#include <doca_aes_gcm.h>
#include "../common.h"
#include "aes_gcm_common.h"
Include dependency graph for aes_gcm_common.c:

Go to the source code of this file.

Functions

 DOCA_LOG_REGISTER (AES_GCM::COMMON)
 
void init_aes_gcm_params (struct aes_gcm_cfg *aes_gcm_cfg)
 
static doca_error_t parse_hex_to_bytes (const char *hex_str, size_t hex_str_size, uint8_t *bytes_arr)
 
static doca_error_t pci_address_callback (void *param, void *config)
 
static doca_error_t file_callback (void *param, void *config)
 
static doca_error_t output_callback (void *param, void *config)
 
static doca_error_t raw_key_callback (void *param, void *config)
 
static doca_error_t iv_callback (void *param, void *config)
 
static doca_error_t tag_callback (void *param, void *config)
 
static doca_error_t aad_callback (void *param, void *config)
 
static doca_error_t num_src_buf_callback (void *param, void *config)
 
static doca_error_t num_dst_buf_callback (void *param, void *config)
 
doca_error_t register_aes_gcm_params (void)
 
static void aes_gcm_state_changed_callback (const union doca_data user_data, struct doca_ctx *ctx, enum doca_ctx_states prev_state, enum doca_ctx_states next_state)
 
doca_error_t allocate_aes_gcm_resources (const char *pci_addr, uint32_t max_bufs, struct aes_gcm_resources *resources)
 
doca_error_t destroy_aes_gcm_resources (struct aes_gcm_resources *resources)
 
doca_error_t submit_aes_gcm_encrypt_task (struct aes_gcm_resources *resources, struct doca_buf *src_buf, struct doca_buf *dst_buf, struct doca_aes_gcm_key *key, const uint8_t *iv, uint32_t iv_length, uint32_t tag_size, uint32_t aad_size)
 
doca_error_t submit_aes_gcm_decrypt_task (struct aes_gcm_resources *resources, struct doca_buf *src_buf, struct doca_buf *dst_buf, struct doca_aes_gcm_key *key, const uint8_t *iv, uint32_t iv_length, uint32_t tag_size, uint32_t aad_size)
 
doca_error_t aes_gcm_task_encrypt_is_supported (struct doca_devinfo *devinfo)
 
doca_error_t aes_gcm_task_decrypt_is_supported (struct doca_devinfo *devinfo)
 
void encrypt_completed_callback (struct doca_aes_gcm_task_encrypt *encrypt_task, union doca_data task_user_data, union doca_data ctx_user_data)
 
void encrypt_error_callback (struct doca_aes_gcm_task_encrypt *encrypt_task, union doca_data task_user_data, union doca_data ctx_user_data)
 
void decrypt_completed_callback (struct doca_aes_gcm_task_decrypt *decrypt_task, union doca_data task_user_data, union doca_data ctx_user_data)
 
void decrypt_error_callback (struct doca_aes_gcm_task_decrypt *decrypt_task, union doca_data task_user_data, union doca_data ctx_user_data)
 

Function Documentation

◆ aad_callback()

static doca_error_t aad_callback ( void *  param,
void *  config 
)
static

Definition at line 252 of file aes_gcm_common.c.

◆ aes_gcm_state_changed_callback()

static void aes_gcm_state_changed_callback ( const union doca_data  user_data,
struct doca_ctx *  ctx,
enum doca_ctx_states  prev_state,
enum doca_ctx_states  next_state 
)
static

Callback triggered whenever AES-GCM state changes

@user_data [in]: User data associated with the AES-GCM context. Will hold struct aes_gcm_resources * @ctx [in]: The AES-GCM context that had a state change @prev_state [in]: Previous context state @next_state [in]: Next context state (context is already in this state when the callback is called)

The context is in starting state, this is unexpected for AES-GCM.

doca_ctx_stop() has been called. In this sample, this happens either due to a failure encountered, in which case doca_pe_progress() will cause any inflight task to be flushed, or due to the successful compilation of the sample flow. In both cases, in this sample, doca_pe_progress() will eventually transition the context to idle state.

Definition at line 480 of file aes_gcm_common.c.

◆ aes_gcm_task_decrypt_is_supported()

doca_error_t aes_gcm_task_decrypt_is_supported ( struct doca_devinfo *  devinfo)

Definition at line 805 of file aes_gcm_common.c.

◆ aes_gcm_task_encrypt_is_supported()

doca_error_t aes_gcm_task_encrypt_is_supported ( struct doca_devinfo *  devinfo)

Definition at line 800 of file aes_gcm_common.c.

◆ allocate_aes_gcm_resources()

doca_error_t allocate_aes_gcm_resources ( const char *  pci_addr,
uint32_t  max_bufs,
struct aes_gcm_resources resources 
)

Definition at line 520 of file aes_gcm_common.c.

◆ decrypt_completed_callback()

void decrypt_completed_callback ( struct doca_aes_gcm_task_decrypt *  decrypt_task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 850 of file aes_gcm_common.c.

◆ decrypt_error_callback()

void decrypt_error_callback ( struct doca_aes_gcm_task_decrypt *  decrypt_task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 870 of file aes_gcm_common.c.

◆ destroy_aes_gcm_resources()

doca_error_t destroy_aes_gcm_resources ( struct aes_gcm_resources resources)

Definition at line 652 of file aes_gcm_common.c.

◆ DOCA_LOG_REGISTER()

DOCA_LOG_REGISTER ( AES_GCM::COMMON  )

◆ encrypt_completed_callback()

void encrypt_completed_callback ( struct doca_aes_gcm_task_encrypt *  encrypt_task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 810 of file aes_gcm_common.c.

◆ encrypt_error_callback()

void encrypt_error_callback ( struct doca_aes_gcm_task_encrypt *  encrypt_task,
union doca_data  task_user_data,
union doca_data  ctx_user_data 
)

Definition at line 830 of file aes_gcm_common.c.

◆ file_callback()

static doca_error_t file_callback ( void *  param,
void *  config 
)
static

Definition at line 126 of file aes_gcm_common.c.

◆ init_aes_gcm_params()

void init_aes_gcm_params ( struct aes_gcm_cfg aes_gcm_cfg)

Definition at line 51 of file aes_gcm_common.c.

◆ iv_callback()

static doca_error_t iv_callback ( void *  param,
void *  config 
)
static

Definition at line 200 of file aes_gcm_common.c.

◆ num_dst_buf_callback()

static doca_error_t num_dst_buf_callback ( void *  param,
void *  config 
)
static

Definition at line 289 of file aes_gcm_common.c.

◆ num_src_buf_callback()

static doca_error_t num_src_buf_callback ( void *  param,
void *  config 
)
static

Definition at line 267 of file aes_gcm_common.c.

◆ output_callback()

static doca_error_t output_callback ( void *  param,
void *  config 
)
static

Definition at line 148 of file aes_gcm_common.c.

◆ parse_hex_to_bytes()

static doca_error_t parse_hex_to_bytes ( const char *  hex_str,
size_t  hex_str_size,
uint8_t *  bytes_arr 
)
static

Definition at line 73 of file aes_gcm_common.c.

◆ pci_address_callback()

static doca_error_t pci_address_callback ( void *  param,
void *  config 
)
static

Definition at line 103 of file aes_gcm_common.c.

◆ raw_key_callback()

static doca_error_t raw_key_callback ( void *  param,
void *  config 
)
static

Definition at line 170 of file aes_gcm_common.c.

◆ register_aes_gcm_params()

doca_error_t register_aes_gcm_params ( void  )

Definition at line 309 of file aes_gcm_common.c.

◆ submit_aes_gcm_decrypt_task()

doca_error_t submit_aes_gcm_decrypt_task ( struct aes_gcm_resources resources,
struct doca_buf *  src_buf,
struct doca_buf *  dst_buf,
struct doca_aes_gcm_key *  key,
const uint8_t *  iv,
uint32_t  iv_length,
uint32_t  tag_size,
uint32_t  aad_size 
)

Definition at line 741 of file aes_gcm_common.c.

◆ submit_aes_gcm_encrypt_task()

doca_error_t submit_aes_gcm_encrypt_task ( struct aes_gcm_resources resources,
struct doca_buf *  src_buf,
struct doca_buf *  dst_buf,
struct doca_aes_gcm_key *  key,
const uint8_t *  iv,
uint32_t  iv_length,
uint32_t  tag_size,
uint32_t  aad_size 
)

Definition at line 682 of file aes_gcm_common.c.

◆ tag_callback()

static doca_error_t tag_callback ( void *  param,
void *  config 
)
static

Definition at line 229 of file aes_gcm_common.c.