Functions
Crypto Driver HMAC Register Level Functions

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

Functions

void HMAC_init (DTHERegs *dtheBaseAddress, SHARegs *hmacBaseAddress)
 
void HMAC_setConfig (SHARegs *hmacBaseAddress, uint32_t cryptoMode, uint8_t useAlgoConstant, uint8_t closeHash, uint8_t useHMACKey, uint8_t HMACOuterHash)
 
uint32_t HMAC_isReady (const SHARegs *hmacBaseAddress, uint32_t flag)
 
void HMAC_setDataLength (SHARegs *hmacBaseAddress, uint32_t dataLength)
 
void HMAC_writeData (SHARegs *hmacBaseAddress, const uint8_t *ptrData)
 
uint32_t HMAC_getDigestSize (uint32_t config)
 
void HMAC_readResult (SHARegs *hmacBaseAddress, uint8_t *ptrData)
 
void HMAC_writeResult (SHARegs *hmacBaseAddress, uint8_t *ptrData)
 
uint32_t HMAC_readDigestCount (SHARegs *hmacBaseAddress)
 
void HMAC_writeDigestCount (SHARegs *hmacBaseAddress, uint32_t digestCount)
 
void HMAC_setHMACKey (SHARegs *hmacBaseAddress, const uint8_t *ptrKey)
 
void HMAC_setHMACPPKey (SHARegs *hmacBaseAddress, const uint8_t *ptrKey)
 
void HMAC_enableInterrupt (DTHERegs *dtheBaseAddress, SHARegs *hmacBaseAddress, uint32_t intFlags)
 
void HMAC_disableInterrupt (DTHERegs *dtheBaseAddress, SHARegs *hmacBaseAddress, uint32_t intFlags)
 
void HMAC_clearInterrupt (DTHERegs *dtheBaseAddress, uint32_t intFlags)
 
uint32_t HMAC_getInterruptStatus (DTHERegs *dtheBaseAddress, SHARegs *hmacBaseAddress, uint8_t masked)
 

Detailed Description

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

Function Documentation

void HMAC_clearInterrupt ( DTHERegs dtheBaseAddress,
uint32_t  intFlags 
)

Description
The function clears the HMAC interrupts.

Note
The DMA done interrupts are the only interrupts that can be cleared using this function. The remaining interrupts can be disabled using the HMAC_disableInterrupt() function.
Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]intFlagsBit mask for the following interrupt sources. HMAC_INT_DMA_CONTEXT_IN - Context DMA done interrupt HMAC_INT_DMA_CONTEXT_OUT - Authentication tag (and IV) DMA done interrupt HMAC_INT_DMA_DATA_IN - Data input DMA done interrupt HMAC_INT_DMA_DATA_OUT - Data output DMA done interrupt
Return values
Notapplicable
void HMAC_disableInterrupt ( DTHERegs dtheBaseAddress,
SHARegs hmacBaseAddress,
uint32_t  intFlags 
)

Description
The function disables the HMAC interrupts.

Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]intFlagsBit mask for the following interrupt sources. HMAC_INT_CONTEXT_READY - Context input registers are ready. HMAC_INT_PARTHASH_READY - Context output registers are ready after a context switch. HMAC_INT_INPUT_READY - Data FIFO is ready to receive data. HMAC_INT_OUTPUT_READY - Context output registers are ready.
Return values
Notapplicable
void HMAC_enableInterrupt ( DTHERegs dtheBaseAddress,
SHARegs hmacBaseAddress,
uint32_t  intFlags 
)

Description
The function enables the HMAC interrupts.

Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]intFlagsBit mask for the following interrupt sources. HMAC_INT_CONTEXT_READY - Context input registers are ready. HMAC_INT_PARTHASH_READY - Context output registers are ready after a context switch. HMAC_INT_INPUT_READY - Data FIFO is ready to receive data. HMAC_INT_OUTPUT_READY - Context output registers are ready.
Return values
Notapplicable
uint32_t HMAC_getDigestSize ( uint32_t  config)

Description
This function returns the number of bytes of digest for the specified hash algorithm.

Parameters
[in]configBit values for the algorithm as specified in the mode register.
Return values
Numberof bytes in the digest.

Return without reading a result since the hardware appears to be misconfigured.

uint32_t HMAC_getInterruptStatus ( DTHERegs dtheBaseAddress,
SHARegs hmacBaseAddress,
uint8_t  masked 
)

Description
The function returns the interrupt status.

Parameters
[in]dtheBaseAddressBase address of DTHE module memory mapped registers.
[in]hmacBaseAddressBase address of SHA module memory mapped registers.
[in]masked0 - Raw interrupt status is read. 1 - Masked interrupt status is read.
Return values
Bitmask for the following interrupt sources. HMAC_INT_CONTEXT_READY - Context input registers are ready. HMAC_INT_PARTHASH_READY - Context output registers are ready after a context switch. HMAC_INT_INPUT_READY - Data FIFO is ready to receive data. HMAC_INT_OUTPUT_READY - Context output registers are ready.
void HMAC_init ( DTHERegs dtheBaseAddress,
SHARegs hmacBaseAddress 
)

Description
The function Initialize the HMAC module.

Return values
Notapplicable
uint32_t HMAC_isReady ( const SHARegs hmacBaseAddress,
uint32_t  flag 
)

Description
The function checks if the interrupt register is ready for operation indicated by flag.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]flagIndicates the bit positions to check if ready.
Return values
0- Not ready for access >0 - Ready for access
uint32_t HMAC_readDigestCount ( SHARegs hmacBaseAddress)

Description
This function reads the byte count of the current hashing operation.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[out]ptrDigestCountPointer to a location to return the digest count.
Return values
DigestCount in bytes.
void HMAC_readResult ( SHARegs hmacBaseAddress,
uint8_t *  ptrData 
)

Description
This function reads the result of a hash operation.The length of hash or digest depends on the algorithm used for hashing.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]ptrDataPointer to a data buffer where the data is stored.
Return values
Notapplicable
void HMAC_setConfig ( SHARegs hmacBaseAddress,
uint32_t  cryptoMode,
uint8_t  useAlgoConstant,
uint8_t  closeHash,
uint8_t  useHMACKey,
uint8_t  HMACOuterHash 
)

Description
The function configures the HMAC module with input configuration parameters.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]cryptoModeSpecifies the Hash algorithm. Valid values are: HMAC_ALGO_MD5 HMAC_ALGO_SHA1 HMAC_ALGO_SHA224 HMAC_ALGO_SHA256
[in]useAlgoConstantIf set to 1, The initial digest register will be overwritten with the algorithm constants for the selected algorithm
[in]closeHashSpecifies if the hash is closed or not. 1 - hash/HMAC will be 'closed' at the end of the block and appropriate padding is added. 0 - hash/HMAC will not be closed and can be continued later.
[in]useHMACKeyThe hash core will perform HMAC key processing on the 512 bit HMAC key loaded in the digest registers.
[in]HMACOuterHash1 - The HMAC Outer Hash is performed on the hash digest when the inner hash hash finished.
Return values
Notapplicable
void HMAC_setDataLength ( SHARegs hmacBaseAddress,
uint32_t  dataLength 
)

Description
The function configures the data length of the the block to be processed.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]dataLengthLength of the block in bytes. Note: The value must be a multiple of 64 if the close hash is not set in the mode register.
Return values
Notapplicable
void HMAC_setHMACKey ( SHARegs hmacBaseAddress,
const uint8_t *  ptrKey 
)

Description
This function writes HMAC key to the inner or outer digest registers.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]ptrKeyPointer to the key. Note: Key MUST be 64 bytes long.
Return values
Notapplicable
void HMAC_setHMACPPKey ( SHARegs hmacBaseAddress,
const uint8_t *  ptrKey 
)

Description
This function writes a pre-processed HMAC key to the inner or outer digest registers.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]ptrKeyPointer to the key. Note: Key MUST be 64 bytes long.
Return values
Notapplicable
void HMAC_writeData ( SHARegs hmacBaseAddress,
const uint8_t *  ptrData 
)

Description
This function writes 16 words of data into the data register. If the data registers are not ready, the function will block the caller.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]ptrDataPointer to the data buffer.
Return values
Notapplicable
void HMAC_writeDigestCount ( SHARegs hmacBaseAddress,
uint32_t  digestCount 
)

Description
This function writes the byte count of the current hashing operation.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[in]digestCountNumber of bytes to write.
Return values
Notapplicable
void HMAC_writeResult ( SHARegs hmacBaseAddress,
uint8_t *  ptrData 
)

Description
This function writes the result of a hash operation.The length of hash or digest depends on the algorithm used for hashing.

Parameters
[in]hmacBaseAddressBase address of HMAC module memory mapped registers.
[out]ptrDataPointer to a data buffer where the data is stored.
Return values
Notapplicable

Copyright 2018, Texas Instruments Incorporated