AM243x MCU+ SDK  08.01.00
APIs for CRYPTO AES

Introduction

Data Structures

struct  Crypto_AesParams
 Parameters passed during Crypto_aesOpen() More...
 
struct  Crypto_AesCommonFxns
 Driver implementation callbacks. More...
 
struct  Crypto_AesCbcFxns
 Driver implementation callbacks. More...
 
struct  Crypto_AesCmacFxns
 Driver implementation callbacks. More...
 
struct  Crypto_AesFxns
 Driver implementation callbacks. More...
 
struct  Crypto_AesContext
 CRYPTO AES driver context. More...
 
struct  Crypto_AesConfig
 CRYPTO AES global configuration array. More...
 

Functions

void Crypto_AesParams_init (Crypto_AesParams *params)
 Set default parameters in the Crypto_AesParams structure. More...
 
Crypto_AesHandle Crypto_aesOpen (Crypto_AesContext *ctx, const Crypto_AesParams *params)
 This function gives the configuration based on type. More...
 
int32_t Crypto_aesClose (Crypto_AesHandle handle)
 This function clears a Advance Encryption Standard (AES) context. More...
 
int32_t Crypto_aesSetKeyEnc (Crypto_AesHandle handle)
 This function sets the Advance Encryption Standard (AES) encryption key. More...
 
int32_t Crypto_aesSetKeyDec (Crypto_AesHandle handle)
 This function sets the Advance Encryption Standard (AES) decryption key. More...
 
int32_t Crypto_aesCbc (Crypto_AesHandle handle, const uint8_t *input, uint32_t ilen, uint8_t *output)
 This function finishes the Advance Encryption Standard Cipher Block Chaining (AES-CBC) operation, and writes the result to the output buffer. More...
 
int32_t Crypto_cmacSetup (Crypto_AesHandle handle)
 This function prepares a cipher context for use with the given cipher primitive. More...
 
int32_t Crypto_cmacStarts (Crypto_AesHandle handle)
 This function sets the CMAC key, and prepares to authenticate the input data. More...
 
int32_t Crypto_cmacUpdate (Crypto_AesHandle handle, const uint8_t *input, uint32_t ilen)
 This function feeds an input buffer into an ongoing CMAC computation. More...
 
int32_t Crypto_cmacFinish (Crypto_AesHandle handle, uint8_t *output)
 This function finishes the CMAC operation, and writes the result to the output buffer. More...
 
int32_t Crypto_cmacSingleShot (Crypto_AesHandle handle, const uint8_t *input, uint32_t ilen, uint8_t *output)
 This function calculates the Advance Encryption Standard Cipher-based Message Authentication Code (AES-CMAC) of a buffer. More...
 

Typedefs

typedef void * Crypto_AesHandle
 Handle to the Crypto AES driver returned by Crypto_aesOpen() More...
 
typedef int32_t(* Crypto_AesOpenFxn) (Crypto_AesContext *ctx, const Crypto_AesParams *params)
 common callback functions declarations More...
 
typedef int32_t(* Crypto_AesCloseFxn) (Crypto_AesContext *ctx)
 
typedef int32_t(* Crypto_AesSetKeyEncFxn) (Crypto_AesContext *ctx)
 aes cbc callback functions declarations More...
 
typedef int32_t(* Crypto_AesSetKeyDecFxn) (Crypto_AesContext *ctx)
 
typedef int32_t(* Crypto_AesCbcFxn) (Crypto_AesContext *ctx, const uint8_t *input, uint32_t inputLength, uint8_t *output)
 
typedef int32_t(* Crypto_CmacSetUpFxn) (Crypto_AesContext *ctx)
 aes cmac callback functions declarations More...
 
typedef int32_t(* Crypto_CmacStartFxn) (Crypto_AesContext *ctx)
 
typedef int32_t(* Crypto_CmacUpdateFxn) (Crypto_AesContext *ctx, const uint8_t *input, uint32_t ilen)
 
typedef int32_t(* Crypto_CmacFinishFxn) (Crypto_AesContext *ctx, uint8_t *output)
 
typedef int32_t(* Crypto_CmacSingleShotFxn) (Crypto_AesContext *ctx, const uint8_t *input, uint32_t ilen, uint8_t *output)
 

Macros

#define CRYPTO_AES_IV_LENGTH   (16U)
 IV buffer length should be 16 bytes. More...
 
#define CRYPTO_AES_KEY_LENGTH   (32U)
 key buffer length, min 16 bytes and max 32 bytes More...
 

AES algorithm type

#define CRYPTO_AES_DECRYPT   (0U)
 AES decryption algorithm. More...
 
#define CRYPTO_AES_ENCRYPT   (1U)
 AES encryption algorithm. More...
 
#define CRYPTO_AES_CMAC   (2U)
 AES CMAC algorithm. More...
 

AES modes

#define CRYPTO_AES_CBC_128   (0U)
 AES CBC 128 bit MODE and Key size should be 128 bits. More...
 
#define CRYPTO_AES_CBC_192   (1U)
 AES CBC 192 bit MODE and Key size should be 192 bits. More...
 
#define CRYPTO_AES_CBC_256   (2U)
 AES CBC 256 bit MODE and Key size should be 256 bits. More...
 
#define CRYPTO_AES_CMAC_128   (3U)
 AES CMAC with 128-bit ECB mode. More...
 
#define CRYPTO_AES_CMAC_192   (4U)
 AES CMAC with 192-bit ECB mode. More...
 
#define CRYPTO_AES_CMAC_256   (5U)
 AES CMAC with 256-bit ECB mode. More...
 

Macro Definition Documentation

◆ CRYPTO_AES_DECRYPT

#define CRYPTO_AES_DECRYPT   (0U)

AES decryption algorithm.

◆ CRYPTO_AES_ENCRYPT

#define CRYPTO_AES_ENCRYPT   (1U)

AES encryption algorithm.

◆ CRYPTO_AES_CMAC

#define CRYPTO_AES_CMAC   (2U)

AES CMAC algorithm.

◆ CRYPTO_AES_CBC_128

#define CRYPTO_AES_CBC_128   (0U)

AES CBC 128 bit MODE and Key size should be 128 bits.

◆ CRYPTO_AES_CBC_192

#define CRYPTO_AES_CBC_192   (1U)

AES CBC 192 bit MODE and Key size should be 192 bits.

◆ CRYPTO_AES_CBC_256

#define CRYPTO_AES_CBC_256   (2U)

AES CBC 256 bit MODE and Key size should be 256 bits.

◆ CRYPTO_AES_CMAC_128

#define CRYPTO_AES_CMAC_128   (3U)

AES CMAC with 128-bit ECB mode.

◆ CRYPTO_AES_CMAC_192

#define CRYPTO_AES_CMAC_192   (4U)

AES CMAC with 192-bit ECB mode.

◆ CRYPTO_AES_CMAC_256

#define CRYPTO_AES_CMAC_256   (5U)

AES CMAC with 256-bit ECB mode.

◆ CRYPTO_AES_IV_LENGTH

#define CRYPTO_AES_IV_LENGTH   (16U)

IV buffer length should be 16 bytes.

◆ CRYPTO_AES_KEY_LENGTH

#define CRYPTO_AES_KEY_LENGTH   (32U)

key buffer length, min 16 bytes and max 32 bytes

Typedef Documentation

◆ Crypto_AesHandle

typedef void* Crypto_AesHandle

Handle to the Crypto AES driver returned by Crypto_aesOpen()

◆ Crypto_AesOpenFxn

typedef int32_t(* Crypto_AesOpenFxn) (Crypto_AesContext *ctx, const Crypto_AesParams *params)

common callback functions declarations

◆ Crypto_AesCloseFxn

typedef int32_t(* Crypto_AesCloseFxn) (Crypto_AesContext *ctx)

◆ Crypto_AesSetKeyEncFxn

typedef int32_t(* Crypto_AesSetKeyEncFxn) (Crypto_AesContext *ctx)

aes cbc callback functions declarations

◆ Crypto_AesSetKeyDecFxn

typedef int32_t(* Crypto_AesSetKeyDecFxn) (Crypto_AesContext *ctx)

◆ Crypto_AesCbcFxn

typedef int32_t(* Crypto_AesCbcFxn) (Crypto_AesContext *ctx, const uint8_t *input, uint32_t inputLength, uint8_t *output)

◆ Crypto_CmacSetUpFxn

typedef int32_t(* Crypto_CmacSetUpFxn) (Crypto_AesContext *ctx)

aes cmac callback functions declarations

◆ Crypto_CmacStartFxn

typedef int32_t(* Crypto_CmacStartFxn) (Crypto_AesContext *ctx)

◆ Crypto_CmacUpdateFxn

typedef int32_t(* Crypto_CmacUpdateFxn) (Crypto_AesContext *ctx, const uint8_t *input, uint32_t ilen)

◆ Crypto_CmacFinishFxn

typedef int32_t(* Crypto_CmacFinishFxn) (Crypto_AesContext *ctx, uint8_t *output)

◆ Crypto_CmacSingleShotFxn

typedef int32_t(* Crypto_CmacSingleShotFxn) (Crypto_AesContext *ctx, const uint8_t *input, uint32_t ilen, uint8_t *output)

Function Documentation

◆ Crypto_AesParams_init()

void Crypto_AesParams_init ( Crypto_AesParams params)

Set default parameters in the Crypto_AesParams structure.

Call this API to set defaults and then override the fields as needed before calling Crypto_aesOpen.

Parameters
params[OUT] Initialized parameters

◆ Crypto_aesOpen()

Crypto_AesHandle Crypto_aesOpen ( Crypto_AesContext *  ctx,
const Crypto_AesParams params 
)

This function gives the configuration based on type.

Parameters
ctxThe AES context to initialize. This must not be NULL.
paramsType to which to assign the context

◆ Crypto_aesClose()

int32_t Crypto_aesClose ( Crypto_AesHandle  handle)

This function clears a Advance Encryption Standard (AES) context.

Parameters
handleThe AES context to clear. This may be NULL, in which case this function does nothing. If it is not NULL, it must point to an initialized AES context.

◆ Crypto_aesSetKeyEnc()

int32_t Crypto_aesSetKeyEnc ( Crypto_AesHandle  handle)

This function sets the Advance Encryption Standard (AES) encryption key.

Parameters
handleAES driver handle from Crypto_aesOpen.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_aesSetKeyDec()

int32_t Crypto_aesSetKeyDec ( Crypto_AesHandle  handle)

This function sets the Advance Encryption Standard (AES) decryption key.

Parameters
handleAES driver handle from Crypto_aesOpen.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_aesCbc()

int32_t Crypto_aesCbc ( Crypto_AesHandle  handle,
const uint8_t *  input,
uint32_t  ilen,
uint8_t *  output 
)

This function finishes the Advance Encryption Standard Cipher Block Chaining (AES-CBC) operation, and writes the result to the output buffer.

Parameters
handleAES driver handle from Crypto_aesOpen
inputThe buffer holding the input data. This must be a readable buffer of length ilen Bytes.
ilenThe length of the input data in Bytes.
outputThe AES algorithm result.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_cmacSetup()

int32_t Crypto_cmacSetup ( Crypto_AesHandle  handle)

This function prepares a cipher context for use with the given cipher primitive.

Parameters
handleAES driver handle from Crypto_aesOpen.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_cmacStarts()

int32_t Crypto_cmacStarts ( Crypto_AesHandle  handle)

This function sets the CMAC key, and prepares to authenticate the input data.

Parameters
handleAES driver handle from Crypto_aesOpen.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_cmacUpdate()

int32_t Crypto_cmacUpdate ( Crypto_AesHandle  handle,
const uint8_t *  input,
uint32_t  ilen 
)

This function feeds an input buffer into an ongoing CMAC computation.

Parameters
handleAES driver handle from Crypto_aesOpen.
inputThe buffer holding the input data. This must be a readable buffer of length ilen Bytes.
ilenThe length of the input data in Bytes.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_cmacFinish()

int32_t Crypto_cmacFinish ( Crypto_AesHandle  handle,
uint8_t *  output 
)

This function finishes the CMAC operation, and writes the result to the output buffer.

Parameters
handleAES driver handle from Crypto_aesOpen.
outputThe AES cmac algorithm result.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_cmacSingleShot()

int32_t Crypto_cmacSingleShot ( Crypto_AesHandle  handle,
const uint8_t *  input,
uint32_t  ilen,
uint8_t *  output 
)

This function calculates the Advance Encryption Standard Cipher-based Message Authentication Code (AES-CMAC) of a buffer.

Parameters
handleAES driver handle from Crypto_aesOpen.
inputThe buffer holding the input data. This must be a readable buffer of length ilen Bytes.
ilenThe length of the input data in Bytes.
outputThe AES cmac algorithm result.
Returns
status 0 on success. A negative error code on failure.

Variable Documentation

◆ gCryptoAesConfig

Crypto_AesConfig gCryptoAesConfig[CRYPTO_NUM_TYPE]
extern

Externally defined AES driver configuration array.