AM64x MCU+ SDK  08.01.00
APIs for CRYPTO SHA

Introduction

Data Structures

struct  Crypto_ShaParams
 Parameters passed during Crypto_shaOpen() More...
 
struct  Crypto_ShaFxns
 Driver implementation callbacks. More...
 
struct  Crypto_ShaContext
 CRYPTO SHA driver context. More...
 
struct  Crypto_ShaConfig
 CRYPTO SHA global configuration array. More...
 

Functions

void Crypto_ShaParams_init (Crypto_ShaParams *params)
 Set default parameters in the Crypto_ShaParams structure. More...
 
Crypto_ShaHandle Crypto_shaOpen (Crypto_ShaContext *ctx, const Crypto_ShaParams *params)
 This function gives the configuration based on type. More...
 
int32_t Crypto_shaClose (Crypto_ShaHandle handle)
 This function clears a Secure Hash Algorithm (SHA ) context. More...
 
int32_t Crypto_shaStarts (Crypto_ShaHandle handle)
 This function starts a Secure Hash Algorithm (SHA ) checksum calculation. More...
 
int32_t Crypto_shaUpdate (Crypto_ShaHandle handle, const uint8_t *input, uint32_t ilen)
 This function feeds an input buffer into an ongoing Secure Hash Algorithm (SHA ) checksum calculation. More...
 
int32_t Crypto_shaFinish (Crypto_ShaHandle handle, uint8_t *output)
 This function finishes the Secure Hash Algorithm (SHA ) operation, and writes the result to the output buffer. More...
 
int32_t Crypto_shaSingleShot (Crypto_ShaHandle handle, const uint8_t *input, uint32_t ilen, uint8_t *output)
 This function calculates the Secure Hash Algorithm (SHA) checksum of a buffer. More...
 
int32_t Crypto_hmacSha (Crypto_ShaHandle handle, const uint8_t *input, uint32_t ilen, uint8_t *output)
 This function calculates the Keyed-Hash Message Authentication Code Secure Hash Algorithm (HMAC-SHA) checksum of a buffer. More...
 

Typedefs

typedef void * Crypto_ShaHandle
 Handle to the Crypto SHA driver returned by Crypto_shaOpen() More...
 
typedef int32_t(* Crypto_ShaOpenFxn) (Crypto_ShaContext *ctx, const Crypto_ShaParams *params)
 callback functions declarations More...
 
typedef int32_t(* Crypto_ShaCloseFxn) (Crypto_ShaContext *ctx)
 
typedef int32_t(* Crypto_ShaStartFxn) (Crypto_ShaContext *ctx)
 
typedef int32_t(* Crypto_ShaUpdateFxn) (Crypto_ShaContext *ctx, const uint8_t *input, uint32_t ilen)
 
typedef int32_t(* Crypto_ShaFinishFxn) (Crypto_ShaContext *ctx, uint8_t *output)
 
typedef int32_t(* Crypto_ShaSingleShotFxn) (Crypto_ShaContext *ctx, const uint8_t *input, uint32_t ilen, uint8_t *output)
 
typedef int32_t(* Crypto_hmacShaFxn) (Crypto_ShaContext *ctx, const uint8_t *input, uint32_t ilen, uint8_t *output)
 

SHA authentication mode

#define CRYPTO_SHA_AUTHMODE_NULL   (0U)
 No individual Authentication. More...
 
#define CRYPTO_SHA_AUTHMODE_SHA1   (1U)
 SHA1 mode. More...
 
#define CRYPTO_SHA_AUTHMODE_SHA2_224   (2U)
 224-bit SHA2 mode More...
 
#define CRYPTO_SHA_AUTHMODE_SHA2_256   (3U)
 256-bit SHA2 mode More...
 
#define CRYPTO_SHA_AUTHMODE_SHA2_384   (4U)
 384-bit SHA2 mode. Note: This mode is used at Data Mode only for SA2_UL More...
 
#define CRYPTO_SHA_AUTHMODE_SHA2_512   (5U)
 512-bit SHA2 mode. Note: This mode is used at Data Mode only for SA2_UL More...
 
#define CRYPTO_SHA_AUTHMODE_HMAC_SHA1   (6U)
 HMAC with SHA1 mode. More...
 
#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_224   (7U)
 HMAC with 224-bit SHA2 mode. More...
 
#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_256   (8U)
 HMAC with 256-bit SHA2 mode. More...
 
#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_384   (9U)
 HMAC with 224-bit SHA mode. Note: This mode is used at Data Mode only for SA2_UL. More...
 
#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_512   (10U)
 HMAC with 256-bit SHA mode. Note: This mode is used at Data Mode only for SA2_UL. More...
 

HMAC SHA Max key lenght

#define CRYPTO_HMAC_SHA_SW_MAX_KEYLEN_BYTES   (128U)
 

Macro Definition Documentation

◆ CRYPTO_SHA_AUTHMODE_NULL

#define CRYPTO_SHA_AUTHMODE_NULL   (0U)

No individual Authentication.

◆ CRYPTO_SHA_AUTHMODE_SHA1

#define CRYPTO_SHA_AUTHMODE_SHA1   (1U)

SHA1 mode.

◆ CRYPTO_SHA_AUTHMODE_SHA2_224

#define CRYPTO_SHA_AUTHMODE_SHA2_224   (2U)

224-bit SHA2 mode

◆ CRYPTO_SHA_AUTHMODE_SHA2_256

#define CRYPTO_SHA_AUTHMODE_SHA2_256   (3U)

256-bit SHA2 mode

◆ CRYPTO_SHA_AUTHMODE_SHA2_384

#define CRYPTO_SHA_AUTHMODE_SHA2_384   (4U)

384-bit SHA2 mode. Note: This mode is used at Data Mode only for SA2_UL

◆ CRYPTO_SHA_AUTHMODE_SHA2_512

#define CRYPTO_SHA_AUTHMODE_SHA2_512   (5U)

512-bit SHA2 mode. Note: This mode is used at Data Mode only for SA2_UL

◆ CRYPTO_SHA_AUTHMODE_HMAC_SHA1

#define CRYPTO_SHA_AUTHMODE_HMAC_SHA1   (6U)

HMAC with SHA1 mode.

◆ CRYPTO_SHA_AUTHMODE_HMAC_SHA2_224

#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_224   (7U)

HMAC with 224-bit SHA2 mode.

◆ CRYPTO_SHA_AUTHMODE_HMAC_SHA2_256

#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_256   (8U)

HMAC with 256-bit SHA2 mode.

◆ CRYPTO_SHA_AUTHMODE_HMAC_SHA2_384

#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_384   (9U)

HMAC with 224-bit SHA mode. Note: This mode is used at Data Mode only for SA2_UL.

◆ CRYPTO_SHA_AUTHMODE_HMAC_SHA2_512

#define CRYPTO_SHA_AUTHMODE_HMAC_SHA2_512   (10U)

HMAC with 256-bit SHA mode. Note: This mode is used at Data Mode only for SA2_UL.

◆ CRYPTO_HMAC_SHA_SW_MAX_KEYLEN_BYTES

#define CRYPTO_HMAC_SHA_SW_MAX_KEYLEN_BYTES   (128U)

Typedef Documentation

◆ Crypto_ShaHandle

typedef void* Crypto_ShaHandle

Handle to the Crypto SHA driver returned by Crypto_shaOpen()

◆ Crypto_ShaOpenFxn

typedef int32_t(* Crypto_ShaOpenFxn) (Crypto_ShaContext *ctx, const Crypto_ShaParams *params)

callback functions declarations

◆ Crypto_ShaCloseFxn

typedef int32_t(* Crypto_ShaCloseFxn) (Crypto_ShaContext *ctx)

◆ Crypto_ShaStartFxn

typedef int32_t(* Crypto_ShaStartFxn) (Crypto_ShaContext *ctx)

◆ Crypto_ShaUpdateFxn

typedef int32_t(* Crypto_ShaUpdateFxn) (Crypto_ShaContext *ctx, const uint8_t *input, uint32_t ilen)

◆ Crypto_ShaFinishFxn

typedef int32_t(* Crypto_ShaFinishFxn) (Crypto_ShaContext *ctx, uint8_t *output)

◆ Crypto_ShaSingleShotFxn

typedef int32_t(* Crypto_ShaSingleShotFxn) (Crypto_ShaContext *ctx, const uint8_t *input, uint32_t ilen, uint8_t *output)

◆ Crypto_hmacShaFxn

typedef int32_t(* Crypto_hmacShaFxn) (Crypto_ShaContext *ctx, const uint8_t *input, uint32_t ilen, uint8_t *output)

Function Documentation

◆ Crypto_ShaParams_init()

void Crypto_ShaParams_init ( Crypto_ShaParams params)

Set default parameters in the Crypto_ShaParams structure.

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

Parameters
params[OUT] Initialized parameters

◆ Crypto_shaOpen()

Crypto_ShaHandle Crypto_shaOpen ( Crypto_ShaContext *  ctx,
const Crypto_ShaParams params 
)

This function gives the configuration based on type.

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

◆ Crypto_shaClose()

int32_t Crypto_shaClose ( Crypto_ShaHandle  handle)

This function clears a Secure Hash Algorithm (SHA ) context.

Parameters
handleThe SHA 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 SHA context.

◆ Crypto_shaStarts()

int32_t Crypto_shaStarts ( Crypto_ShaHandle  handle)

This function starts a Secure Hash Algorithm (SHA ) checksum calculation.

Parameters
handleSHA driver handle from Crypto_shaOpen
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_shaUpdate()

int32_t Crypto_shaUpdate ( Crypto_ShaHandle  handle,
const uint8_t *  input,
uint32_t  ilen 
)

This function feeds an input buffer into an ongoing Secure Hash Algorithm (SHA ) checksum calculation.

Parameters
handleSHA driver handle from Crypto_shaOpen
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_shaFinish()

int32_t Crypto_shaFinish ( Crypto_ShaHandle  handle,
uint8_t *  output 
)

This function finishes the Secure Hash Algorithm (SHA ) operation, and writes the result to the output buffer.

Parameters
handleSHA driver handle from Crypto_shaOpen
outputThe SHA checksum result.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_shaSingleShot()

int32_t Crypto_shaSingleShot ( Crypto_ShaHandle  handle,
const uint8_t *  input,
uint32_t  ilen,
uint8_t *  output 
)

This function calculates the Secure Hash Algorithm (SHA) checksum of a buffer.

The function allocates the context, performs the calculation, and frees the context.

The SHA result is calculated as output = SHA(input buffer).

Parameters
handleSHA driver handle from Crypto_shaOpen
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 SHA checksum result.
Returns
status 0 on success. A negative error code on failure.

◆ Crypto_hmacSha()

int32_t Crypto_hmacSha ( Crypto_ShaHandle  handle,
const uint8_t *  input,
uint32_t  ilen,
uint8_t *  output 
)

This function calculates the Keyed-Hash Message Authentication Code Secure Hash Algorithm (HMAC-SHA) checksum of a buffer.

The function allocates the context, performs the calculation, and frees the context.

Parameters
handleSHA driver handle from Crypto_shaOpen
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 SHA checksum result.
Returns
status 0 on success. A negative error code on failure.

Variable Documentation

◆ gCryptoShaConfig

Crypto_ShaConfig gCryptoShaConfig[CRYPTO_NUM_TYPE]
extern

Externally defined SHA driver configuration array.