AM64x MCU+ SDK  08.01.00

Introduction

This module contains APIs to program and use the SA2UL.

Files

file  sa2ul.h
 This file contains the prototype of SA2UL driver APIs.
 

Data Structures

struct  SA2UL_ContextParams
 Parameters passed to SA2UL_contextAlloc() More...
 
struct  SA2UL_Params
 Parameters passed to SA2UL_open() More...
 
struct  SA2UL_Object
 Object for a SA2UL crypto operation. More...
 
struct  SA2UL_Attrs
 SA2UL instance attributes - used during init time. More...
 
struct  SA2UL_Config
 SA2UL driver context. More...
 
struct  SA2UL_MCEData
 MEDdata for Encryption engine. More...
 
struct  SA2UL_SecCtxAuth
 SA2UL context RAM structure for authentication engine. More...
 
struct  SA2UL_Scctl
 SA2UL engine related structures. More...
 
struct  SA2UL_SecCtxEnc
 SA2UL context RAM structure for Encryption engine. More...
 
struct  SA2UL_SecCtx
 SA2UL context RAM structure. More...
 
struct  SA2UL_ContextObject
 

Functions

void SA2UL_init (void)
 This function initializes the SA2UL module. More...
 
void SA2UL_deinit (void)
 This function de-initializes the SA2UL module. More...
 
SA2UL_Handle SA2UL_open (uint32_t index, const SA2UL_Params *params)
 This function opens a given SA2UL module. More...
 
void SA2UL_close (SA2UL_Handle handle)
 Function to close a SA2UL module specified by the SA2UL handle. More...
 
int32_t SA2UL_contextAlloc (SA2UL_Handle handle, SA2UL_ContextObject *ctxObj, const SA2UL_ContextParams *ctxPrms)
 Function to configure secure context. More...
 
int32_t SA2UL_contextFree (SA2UL_ContextObject *pCtxObj)
 Function to free secure context configuration. More...
 
int32_t SA2UL_contextProcess (SA2UL_ContextObject *ctxObj, const uint8_t *input, uint32_t ilen, uint8_t *output)
 Function to transfer and recieve data buffer. More...
 
static void SA2UL_Params_init (SA2UL_Params *prms)
 Function to initialize default SA2UL parameters. More...
 
int32_t SA2UL_rngSetup (SA2UL_Handle handle)
 setup the SA2UL RNG module. More...
 
int32_t SA2UL_rngRead (SA2UL_Handle handle, uint32_t *num_words, uint32_t *out)
 Read random numbers into the output buffer. More...
 
static void SA2UL_ContextParams_init (SA2UL_ContextParams *ctxPrms)
 

Typedefs

typedef void * SA2UL_Handle
 Handle to the SA2UL driver returned by SA2UL_open() More...
 

SA2UL macros

#define SA2UL_MAX_HASH_SIZE_BYTES   (64U)
 Max hash size in bytes. More...
 
#define SA2UL_MAX_KEY_SIZE_BYTES   (32U)
 Max key size in bytes. More...
 
#define SA2UL_MAX_IV_SIZE_BYTES   (16U)
 Max Initialization vector (IV) size in bytes. More...
 
#define SA2UL_NUMBER_OF_RINGS   (3U)
 Max number of rings. More...
 
#define SA2UL_CACHELINE_ALIGNMENT   (128U)
 Cache line size for alignment of descriptor and buffers. More...
 
#define SA2UL_SECCTX_SIZE   (256U)
 Secure context memsize. More...
 
#define SA2UL_INSTANCES_MAX   (4U)
 Max SA2UL instances. More...
 
#define SA2UL_RING_N_ELEMS   (8U)
 Max SA2UL ring n elements. More...
 
#define SA2UL_SW_RING_NUM   (304U)
 Max SA2UL sw ring nuber. More...
 

SA2UL Algo Types

#define SA2UL_HASH_ALG_NULL   (0x10U)
 Hash Algo NULL. More...
 
#define SA2UL_HASH_ALG_SHA2_256   (0x14U)
 Hash Algo SHA-256. More...
 
#define SA2UL_HASH_ALG_SHA2_512   (0x16U)
 Hash Algo SHA-512. More...
 

SA2UL Operations Sequence

#define SA2UL_OP_ENC   (0x01U)
 SA2UL operations encryption. More...
 
#define SA2UL_OP_AUTH   (0x02U)
 SA2UL operations authentication. More...
 
#define SA2UL_OP_ENC_THEN_AUTH   (0x03U)
 SA2UL operation encryption then authentication. More...
 
#define SA2UL_OP_AUTH_THEN_ENC   (0x04U)
 SA2UL operations authentication then encryption. More...
 

SA2UL engine operation type

#define SA2UL_ENGINE_CODE_DEFAULT_ENGINE_ID   (0U)
 SA2UL engine operation type. More...
 
#define SA2UL_ENGINE_CODE_ENCRYPTION_MODULE_P1   (2U)
 
#define SA2UL_ENGINE_CODE_ENCRYPTION_MODULE_P2   (3U)
 
#define SA2UL_ENGINE_CODE_AUTHENTICATION_MODULE_P1   (4U)
 
#define SA2UL_ENGINE_CODE_AUTHENTICATION_MODULE_P2   (5U)
 
#define SA2UL_ENGINE_CODE_DEFAULT_EGRESS_PORT   (20U)
 

SA2UL Encryption Algos

#define SA2UL_ENC_ALG_AES   (0x0U)
 Encryption Algos. More...
 
#define SA2UL_ENC_ALG_TDES   (0x1U)
 
#define SA2UL_ENC_ALG_MAX   (0x2U)
 

SA2UL Encryption direction

#define SA2UL_ENC_DIR_ENCRYPT   (0x0U)
 Encryption direction (encrypt or decrypt) More...
 
#define SA2UL_ENC_DIR_DECRYPT   (0x1U)
 

SA2UL Encryption modes

#define SA2UL_ENC_MODE_ECB   (0x0U)
 Encryption modes. More...
 
#define SA2UL_ENC_MODE_CBC   (0x1U)
 
#define SA2UL_ENC_MODE_MAX   (0x2U)
 

SA2UL Encryption key sizes

#define SA2UL_ENC_KEYSIZE_128   (0x0U)
 Encryption key sizes. More...
 
#define SA2UL_ENC_KEYSIZE_192   (0x1U)
 
#define SA2UL_ENC_KEYSIZE_256   (0x2U)
 
#define SA2UL_ENC_KEYSIZE_MAX   (0x3U)
 

Macro Definition Documentation

◆ SA2UL_MAX_HASH_SIZE_BYTES

#define SA2UL_MAX_HASH_SIZE_BYTES   (64U)

Max hash size in bytes.

◆ SA2UL_MAX_KEY_SIZE_BYTES

#define SA2UL_MAX_KEY_SIZE_BYTES   (32U)

Max key size in bytes.

◆ SA2UL_MAX_IV_SIZE_BYTES

#define SA2UL_MAX_IV_SIZE_BYTES   (16U)

Max Initialization vector (IV) size in bytes.

◆ SA2UL_NUMBER_OF_RINGS

#define SA2UL_NUMBER_OF_RINGS   (3U)

Max number of rings.

◆ SA2UL_CACHELINE_ALIGNMENT

#define SA2UL_CACHELINE_ALIGNMENT   (128U)

Cache line size for alignment of descriptor and buffers.

◆ SA2UL_SECCTX_SIZE

#define SA2UL_SECCTX_SIZE   (256U)

Secure context memsize.

◆ SA2UL_INSTANCES_MAX

#define SA2UL_INSTANCES_MAX   (4U)

Max SA2UL instances.

◆ SA2UL_RING_N_ELEMS

#define SA2UL_RING_N_ELEMS   (8U)

Max SA2UL ring n elements.

◆ SA2UL_SW_RING_NUM

#define SA2UL_SW_RING_NUM   (304U)

Max SA2UL sw ring nuber.

◆ SA2UL_HASH_ALG_NULL

#define SA2UL_HASH_ALG_NULL   (0x10U)

Hash Algo NULL.

◆ SA2UL_HASH_ALG_SHA2_256

#define SA2UL_HASH_ALG_SHA2_256   (0x14U)

Hash Algo SHA-256.

◆ SA2UL_HASH_ALG_SHA2_512

#define SA2UL_HASH_ALG_SHA2_512   (0x16U)

Hash Algo SHA-512.

◆ SA2UL_OP_ENC

#define SA2UL_OP_ENC   (0x01U)

SA2UL operations encryption.

◆ SA2UL_OP_AUTH

#define SA2UL_OP_AUTH   (0x02U)

SA2UL operations authentication.

◆ SA2UL_OP_ENC_THEN_AUTH

#define SA2UL_OP_ENC_THEN_AUTH   (0x03U)

SA2UL operation encryption then authentication.

◆ SA2UL_OP_AUTH_THEN_ENC

#define SA2UL_OP_AUTH_THEN_ENC   (0x04U)

SA2UL operations authentication then encryption.

◆ SA2UL_ENGINE_CODE_DEFAULT_ENGINE_ID

#define SA2UL_ENGINE_CODE_DEFAULT_ENGINE_ID   (0U)

SA2UL engine operation type.

◆ SA2UL_ENGINE_CODE_ENCRYPTION_MODULE_P1

#define SA2UL_ENGINE_CODE_ENCRYPTION_MODULE_P1   (2U)

◆ SA2UL_ENGINE_CODE_ENCRYPTION_MODULE_P2

#define SA2UL_ENGINE_CODE_ENCRYPTION_MODULE_P2   (3U)

◆ SA2UL_ENGINE_CODE_AUTHENTICATION_MODULE_P1

#define SA2UL_ENGINE_CODE_AUTHENTICATION_MODULE_P1   (4U)

◆ SA2UL_ENGINE_CODE_AUTHENTICATION_MODULE_P2

#define SA2UL_ENGINE_CODE_AUTHENTICATION_MODULE_P2   (5U)

◆ SA2UL_ENGINE_CODE_DEFAULT_EGRESS_PORT

#define SA2UL_ENGINE_CODE_DEFAULT_EGRESS_PORT   (20U)

◆ SA2UL_ENC_ALG_AES

#define SA2UL_ENC_ALG_AES   (0x0U)

Encryption Algos.

◆ SA2UL_ENC_ALG_TDES

#define SA2UL_ENC_ALG_TDES   (0x1U)

◆ SA2UL_ENC_ALG_MAX

#define SA2UL_ENC_ALG_MAX   (0x2U)

◆ SA2UL_ENC_DIR_ENCRYPT

#define SA2UL_ENC_DIR_ENCRYPT   (0x0U)

Encryption direction (encrypt or decrypt)

◆ SA2UL_ENC_DIR_DECRYPT

#define SA2UL_ENC_DIR_DECRYPT   (0x1U)

◆ SA2UL_ENC_MODE_ECB

#define SA2UL_ENC_MODE_ECB   (0x0U)

Encryption modes.

◆ SA2UL_ENC_MODE_CBC

#define SA2UL_ENC_MODE_CBC   (0x1U)

◆ SA2UL_ENC_MODE_MAX

#define SA2UL_ENC_MODE_MAX   (0x2U)

◆ SA2UL_ENC_KEYSIZE_128

#define SA2UL_ENC_KEYSIZE_128   (0x0U)

Encryption key sizes.

◆ SA2UL_ENC_KEYSIZE_192

#define SA2UL_ENC_KEYSIZE_192   (0x1U)

◆ SA2UL_ENC_KEYSIZE_256

#define SA2UL_ENC_KEYSIZE_256   (0x2U)

◆ SA2UL_ENC_KEYSIZE_MAX

#define SA2UL_ENC_KEYSIZE_MAX   (0x3U)

Typedef Documentation

◆ SA2UL_Handle

typedef void* SA2UL_Handle

Handle to the SA2UL driver returned by SA2UL_open()

Function Documentation

◆ SA2UL_init()

void SA2UL_init ( void  )

This function initializes the SA2UL module.

◆ SA2UL_deinit()

void SA2UL_deinit ( void  )

This function de-initializes the SA2UL module.

◆ SA2UL_open()

SA2UL_Handle SA2UL_open ( uint32_t  index,
const SA2UL_Params params 
)

This function opens a given SA2UL module.

Parameters
indexIndex of config to use in the SA2UL_Config array
paramsPointer to open parameters. If NULL is passed, then default values will be used
Returns
A SA2UL_Handle on success or a NULL on an error or if it has been opened already

◆ SA2UL_close()

void SA2UL_close ( SA2UL_Handle  handle)

Function to close a SA2UL module specified by the SA2UL handle.

Parameters
handleSA2UL_Handle returned from SA2UL_open()

◆ SA2UL_contextAlloc()

int32_t SA2UL_contextAlloc ( SA2UL_Handle  handle,
SA2UL_ContextObject ctxObj,
const SA2UL_ContextParams ctxPrms 
)

Function to configure secure context.

Parameters
handleSA2UL_Handle returned from SA2UL_open()
ctxObjPointer to SA2UL_ContextObject structure
ctxPrmsPointer to secure context parameters.If NULL is passed, then default values will be used
Returns
A SystemP_SUCCESS on success or a NULL on an error or if the instance index has NOT been opened yet

◆ SA2UL_contextFree()

int32_t SA2UL_contextFree ( SA2UL_ContextObject pCtxObj)

Function to free secure context configuration.

Parameters
pCtxObjPointer to SA2UL_ContextObject structure
Returns
A SystemP_SUCCESS on success or a NULL on an error or if the instance index has NOT been opened yet

◆ SA2UL_contextProcess()

int32_t SA2UL_contextProcess ( SA2UL_ContextObject ctxObj,
const uint8_t *  input,
uint32_t  ilen,
uint8_t *  output 
)

Function to transfer and recieve data buffer.

Parameters
ctxObjPointer to SA2UL_ContextObject structure
inputPointer to input buffer to be processed
ilenLength of the input buffer
outputPointer to output buffer after the process is complete
Returns
A SystemP_SUCCESS on success or a NULL on an error or if the instance index has NOT been opened yet

◆ SA2UL_Params_init()

static void SA2UL_Params_init ( SA2UL_Params prms)
inlinestatic

Function to initialize default SA2UL parameters.

Parameters
prmsPointer to open parameters.

◆ SA2UL_rngSetup()

int32_t SA2UL_rngSetup ( SA2UL_Handle  handle)

setup the SA2UL RNG module.

Parameters
handleSA2UL_Handle returned from SA2UL_open()
Returns
SystemP_SUCCESS if successful

◆ SA2UL_rngRead()

int32_t SA2UL_rngRead ( SA2UL_Handle  handle,
uint32_t *  num_words,
uint32_t *  out 
)

Read random numbers into the output buffer.

Parameters
handleSA2UL_Handle returned from SA2UL_open()
num_wordsinput and output parameter. While calling, populate this with the number of words to be read. Valid values are 4 and 8. On return, this contains the number of random words actually read from the RNG. This can be zero if random data is not yet available
outpointer to the buffer for the random data.
Returns
returns SystemP_SUCCESS if requested data is available. SystemP_FAILURE if RNG is not initialized.

◆ SA2UL_ContextParams_init()

static void SA2UL_ContextParams_init ( SA2UL_ContextParams ctxPrms)
inlinestatic

Variable Documentation

◆ gSa2ulConfig

SA2UL_Config gSa2ulConfig[]
extern

Externally defined driver configuration array.

◆ gSa2ulConfigNum

uint32_t gSa2ulConfigNum
extern

Externally defined driver configuration Num.