Modules | Functions
Crypto Driver Internal Functions

The section has a list of all the internal functions used by the driver. More...

Modules

 Crypto Driver AES Register Level Functions
 The section has a list of all the AES functions used internally by the driver.
 
 Crypto Driver HMAC Register Level Functions
 The section has a list of all the HMAC functions used internally by the driver.
 

Functions

void AES_processData (AESRegs *baseAddress, const uint8_t *ptrInput, uint8_t *ptrOutput, uint32_t dataLen)
 
void AES_generateDataMAC (AESRegs *baseAddress, const uint8_t *ptrInput, uint8_t *ptrTag, uint32_t dataLen)
 
void AES_processDataAE (AESRegs *baseAddress, const uint8_t *ptrInput, uint8_t *ptrOutput, uint32_t dataLen, const uint8_t *ptrAuthInput, uint8_t *ptrTag, uint32_t authDataLen)
 
static uint32_t Crypto_getAesConfig (Crypto_AESMode mode, Crypto_EncryptParams *ptrParams)
 
static int32_t Crypto_aesProcess (Crypto_Config *ptrCryptoConfig, Crypto_AESMode mode, uint32_t cryptoDirection, uint8_t *ptrInput, uint32_t dataLength, uint8_t *ptrOutput, Crypto_EncryptParams *ptrParams)
 
static int32_t Crypto_hmacProcess (Crypto_Config *ptrCryptoConfig, uint32_t cryptoConfig, uint8_t *ptrInput, uint32_t dataLength, uint8_t *ptrSignature, Crypto_HmacParams *ptrParams)
 
void HMAC_writeDataMultiple (SHARegs *hmacBaseAddress, const uint8_t *ptrData, uint32_t dataLength)
 
void HMAC_computeHash (SHARegs *hmacBaseAddress, const uint8_t *ptrData, uint32_t dataLength, uint8_t *ptrHashResult)
 
void HMAC_generateHMACPPKey (SHARegs *hmacBaseAddress, const uint8_t *ptrKey, uint32_t keySize, uint8_t *ptrPPKey)
 

Detailed Description

The section has a list of all the internal functions used by the driver.

Function Documentation

void AES_generateDataMAC ( AESRegs baseAddress,
const uint8_t *  ptrInput,
uint8_t *  ptrTag,
uint32_t  dataLen 
)

Description
The function generates the MAC(message authentication code) using CBC-MAC and F9 mode. Note: The AES module must be configured for mode(CBC-MAC or F9), keys etc. before calling this function.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrInputPointer to the input data buffer.
[out]ptrTagPointer to the 16 byte tag data buffer.
[in]dataLenData length of the input buffer in bytes.
Return values
Notapplicable
void AES_processData ( AESRegs baseAddress,
const uint8_t *  ptrInput,
uint8_t *  ptrOutput,
uint32_t  dataLen 
)

Description
The function processes(encrypt or decrypt) a block of input data and stores the output data into a user specified output buffer. The function chunks the block of data into 16 byte chunks for processing. Note: The AES module must be configured for mode, keys etc. before calling this function.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrInputPointer to the input data buffer.
[out]ptrOutputPointer to the output data buffer.
[in]dataLenData length in bytes. Valid values are 1 to less than 2^32.
Return values
Notapplicable
void AES_processDataAE ( AESRegs baseAddress,
const uint8_t *  ptrInput,
uint8_t *  ptrOutput,
uint32_t  dataLen,
const uint8_t *  ptrAuthInput,
uint8_t *  ptrTag,
uint32_t  authDataLen 
)

Description
The function processes(encrypt or decrypt) and authenticates a block of input data and stores the output data into a user specified output buffer. It also generates the MAC(message authentication code). Note: The AES module MUST be configured for mode(Only CCM and GCM modes should be used), keys etc. before calling this function. Note: The input data, output data and authentication data MUST be padded to the 16-byte boundary.

Parameters
[in]baseAddressBase address of AES module memory mapped registers.
[in]ptrInputPointer to the input data buffer.
[out]ptrOutputPointer to the output data buffer.
[in]dataLenData length of the input buffer in bytes.
[in]ptrAuthInputPointer to the authentication input data buffer.
[out]ptrTagPointer to the 16 byte hash tag data buffer.
[in]authDataLenData length of the authentication input data buffer in bytes.
Return values
Notapplicable
static int32_t Crypto_aesProcess ( Crypto_Config ptrCryptoConfig,
Crypto_AESMode  mode,
uint32_t  cryptoDirection,
uint8_t *  ptrInput,
uint32_t  dataLength,
uint8_t *  ptrOutput,
Crypto_EncryptParams ptrParams 
)
static

Description
The function is called to encrypt, decrypt or authenticate data based on a specified AES mode. The additional result is stored in the encrypt output parameters.

Parameters
[in]ptrCryptoConfigPointer to the Crypto Driver configuration
[in]modeAES encrypt mode.
[in]cryptoDirectionDirection of crypto - Encrypt or Decrypt.
[in]ptrInputPointer to the input data buffer.
[in]dataLengthData length in bytes. Valid values are 1 to less than 2^32.
[out]ptrOutputPointer to the output data buffer.
[in]ptrParamsPointer AES parameters. This structure contains both input and output parameters based on the mode.
Return values
Success- 0
Error- Crypto Error code
static uint32_t Crypto_getAesConfig ( Crypto_AESMode  mode,
Crypto_EncryptParams ptrParams 
)
static

Description
The function figures out the AES module configuration based on the crypto mode.

Parameters
[in]modeAES crypto mode.
[in]ptrParamsPointer AES encrypt parameters.
Return values
Success- AES module configuration values
Error- AES_CFG_MODE_INVALID
static int32_t Crypto_hmacProcess ( Crypto_Config ptrCryptoConfig,
uint32_t  cryptoConfig,
uint8_t *  ptrInput,
uint32_t  dataLength,
uint8_t *  ptrSignature,
Crypto_HmacParams ptrParams 
)
static

Description
The function is used to process the HMAC params and configure the HMAC engine. It sets the HMAC key, processes the input data and produces the hash.

Parameters
[in]handleHandle to the Crypto Driver
[in]cryptoConfigHMAC hash algorithm.
[in]ptrInputPointer to the input data buffer.
[in]dataLengthData length in bytes.
[in]ptrSignaturePointer to the HMAC Hash. input pointer - If HMAC flag was set, the ptrSignature pointer is used as the input HMAC Hash value. output pointer - For the generated Hash value.
[in]ptrParamsPointer HMAC parameters.
Return values
Success- 0
Error- Crypto Error code
void HMAC_computeHash ( SHARegs hmacBaseAddress,
const uint8_t *  ptrData,
uint32_t  dataLength,
uint8_t *  ptrHashResult 
)

Description
This function computes the hash using the algorithm and modes that are configured in the Mode register.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]ptrDataPointer to the data buffer.
[in]dataLenData length in bytes.
[out]ptrHashResultPointer to buffer where hash result is stored.
Return values
Notapplicable
void HMAC_generateHMACPPKey ( SHARegs hmacBaseAddress,
const uint8_t *  ptrKey,
uint32_t  keySize,
uint8_t *  ptrPPKey 
)

Description
This function is used to pre process a HMAC key. The pre-processed key can then be used with further HMAC operations to speed up processing time.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]ptrKeyPointer to the key.
[in]keySizeKey Size in bytes. If the key size is less than 512 bits(64 bytes), the function will be padded with zeros.
[out]ptrPPKeyPointer to the pre-processed key. Must be 64 bytes longs.
Return values
Notapplicable
void HMAC_writeDataMultiple ( SHARegs hmacBaseAddress,
const uint8_t *  ptrData,
uint32_t  dataLength 
)

Description
This function writes multiple words of data into the data register. The function waits for each block of data to be processed before another block is written.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]ptrDataPointer to the data buffer.
[in]dataLengthLength of the data in bytes.
Return values
Notapplicable

Loop through all the blocks and write them into the data registers.

If there are bytes that do not make up a whole block, then write them separately.


Copyright 2018, Texas Instruments Incorporated