MSP432E4 DriverLib API Guide
1.11.00.03
|
Functions | |
void | SHAMD5Reset (uint32_t ui32Base) |
void | SHAMD5DMAEnable (uint32_t ui32Base) |
void | SHAMD5DMADisable (uint32_t ui32Base) |
uint32_t | SHAMD5IntStatus (uint32_t ui32Base, bool bMasked) |
void | SHAMD5IntEnable (uint32_t ui32Base, uint32_t ui32IntFlags) |
void | SHAMD5IntDisable (uint32_t ui32Base, uint32_t ui32IntFlags) |
void | SHAMD5IntClear (uint32_t ui32Base, uint32_t ui32IntFlags) |
void | SHAMD5IntRegister (uint32_t ui32Base, void(*pfnHandler)(void)) |
void | SHAMD5IntUnregister (uint32_t ui32Base) |
void | SHAMD5HashLengthSet (uint32_t ui32Base, uint32_t ui32Length) |
void | SHAMD5ConfigSet (uint32_t ui32Base, uint32_t ui32Mode) |
bool | SHAMD5DataWriteNonBlocking (uint32_t ui32Base, uint32_t *pui32Src) |
void | SHAMD5DataWrite (uint32_t ui32Base, uint32_t *pui32Src) |
void | SHAMD5ResultRead (uint32_t ui32Base, uint32_t *pui32Dest) |
void | SHAMD5DataProcess (uint32_t ui32Base, uint32_t *pui32DataSrc, uint32_t ui32DataLength, uint32_t *pui32HashResult) |
void | SHAMD5HMACProcess (uint32_t ui32Base, uint32_t *pui32DataSrc, uint32_t ui32DataLength, uint32_t *pui32HashResult) |
void | SHAMD5HMACPPKeyGenerate (uint32_t ui32Base, uint32_t *pui32Key, uint32_t *pui32PPKey) |
void | SHAMD5HMACKeySet (uint32_t ui32Base, uint32_t *pui32Src) |
void | SHAMD5HMACPPKeySet (uint32_t ui32Base, uint32_t *pui32Src) |
The SHA/MD% module driver provides a method for generating hash values and hash-based message authentication codes. The configuration and feature highlights are:
The SHA/MD5 API consists of functions for configuring the SHA/MD5 module, processing data, and reading the resultant hash.
The following example generates a hash using the SHA-1 algorithm.
void SHAMD5Reset | ( | uint32_t | ui32Base | ) |
Resets the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
This function performs a soft-reset of the SHA/MD5 module using the SYSCONFIG register.
References ASSERT, HWREG, SHAMD5_O_SYSCONFIG, SHAMD5_O_SYSSTATUS, SHAMD5_SYSCONFIG_SIDLE_FORCE, SHAMD5_SYSCONFIG_SIDLE_M, SHAMD5_SYSCONFIG_SOFTRESET, and SHAMD5_SYSSTATUS_RESETDONE.
void SHAMD5DMAEnable | ( | uint32_t | ui32Base | ) |
Enables the uDMA requests in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
This function configures the DMA options of the SHA/MD5 module.
References ASSERT, HWREG, SHAMD5_O_SYSCONFIG, SHAMD5_SYSCONFIG_DMA_EN, and SHAMD5_SYSCONFIG_SADVANCED.
void SHAMD5DMADisable | ( | uint32_t | ui32Base | ) |
Disables the uDMA requests in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
This function configures the DMA options of the SHA/MD5 module.
References ASSERT, HWREG, SHAMD5_O_SYSCONFIG, SHAMD5_SYSCONFIG_DMA_EN, and SHAMD5_SYSCONFIG_SADVANCED.
uint32_t SHAMD5IntStatus | ( | uint32_t | ui32Base, |
bool | bMasked | ||
) |
Get the interrupt status of the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
bMasked | is false if the raw interrupt status is required and true if the masked interrupt status is required. |
This function returns the current value of the IRQSTATUS register. The value will be a logical OR of the following:
References ASSERT, HWREG, SHAMD5_O_DMAMIS, SHAMD5_O_DMARIS, SHAMD5_O_IRQENABLE, and SHAMD5_O_IRQSTATUS.
void SHAMD5IntEnable | ( | uint32_t | ui32Base, |
uint32_t | ui32IntFlags | ||
) |
Enable interrupt sources in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
ui32IntFlags | contains desired interrupts to enable. |
This function enables interrupt sources in the SHA/MD5 module. ui32IntFlags must be a logical OR of one or more of the following values:
References ASSERT, HWREG, SHAMD5_INT_CONTEXT_READY, SHAMD5_INT_INPUT_READY, SHAMD5_INT_OUTPUT_READY, SHAMD5_INT_PARTHASH_READY, SHAMD5_O_DMAIM, SHAMD5_O_IRQENABLE, SHAMD5_O_SYSCONFIG, and SHAMD5_SYSCONFIG_IT_EN.
void SHAMD5IntDisable | ( | uint32_t | ui32Base, |
uint32_t | ui32IntFlags | ||
) |
Disable interrupt sources in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
ui32IntFlags | contains desired interrupts to disable. |
ui32IntFlags must be a logical OR of one or more of the following values:
References ASSERT, HWREG, SHAMD5_INT_CONTEXT_READY, SHAMD5_INT_INPUT_READY, SHAMD5_INT_OUTPUT_READY, SHAMD5_INT_PARTHASH_READY, SHAMD5_O_DMAIM, SHAMD5_O_IRQENABLE, SHAMD5_O_SYSCONFIG, and SHAMD5_SYSCONFIG_IT_EN.
void SHAMD5IntClear | ( | uint32_t | ui32Base, |
uint32_t | ui32IntFlags | ||
) |
Clears interrupt sources in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
ui32IntFlags | contains desired interrupts to disable. |
ui32IntFlags must be a logical OR of one or more of the following values:
References ASSERT, HWREG, SHAMD5_INT_CONTEXT_READY, SHAMD5_INT_INPUT_READY, SHAMD5_INT_OUTPUT_READY, SHAMD5_INT_PARTHASH_READY, and SHAMD5_O_DMAIC.
void SHAMD5IntRegister | ( | uint32_t | ui32Base, |
void(*)(void) | pfnHandler | ||
) |
Registers an interrupt handler for the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pfnHandler | is a pointer to the function to be called when the enabled SHA/MD5 interrupts occur. |
This function registers the interrupt handler in the interrupt vector table, and enables SHA/MD5 interrupts on the interrupt controller; specific SHA/MD5 interrupt sources must be enabled using SHAMD5IntEnable(). The interrupt handler being registered must clear the source of the interrupt using SHAMD5IntClear().
If the application is using a static interrupt vector table stored in flash, then it is not necessary to register the interrupt handler this way. Instead, IntEnable() should be used to enable SHA/MD5 interrupts on the interrupt controller.
References ASSERT, INT_SHA0, IntEnable(), and IntRegister().
void SHAMD5IntUnregister | ( | uint32_t | ui32Base | ) |
Unregisters an interrupt handler for the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
This function unregisters the previously registered interrupt handler and disables the interrupt in the interrupt controller.
References ASSERT, INT_SHA0, IntDisable(), and IntUnregister().
void SHAMD5HashLengthSet | ( | uint32_t | ui32Base, |
uint32_t | ui32Length | ||
) |
Write the hash length to the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
ui32Length | is the hash length in bytes. |
This function writes the length of the hash data of the current operation to the SHA/MD5 module. The value must be a multiple of 64 if the close hash is not set in the mode register.
References ASSERT, HWREG, and SHAMD5_O_LENGTH.
Referenced by SHAMD5DataProcess(), and SHAMD5HMACProcess().
void SHAMD5ConfigSet | ( | uint32_t | ui32Base, |
uint32_t | ui32Mode | ||
) |
Writes the mode in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
ui32Mode | is the mode of the SHA/MD5 module. |
This function writes the mode register configuring the SHA/MD5 module.
The ui32Mode parameter is a bit-wise OR of values:
References ASSERT, HWREG, SHAMD5_ALGO_HMAC_MD5, SHAMD5_ALGO_HMAC_SHA1, SHAMD5_ALGO_HMAC_SHA224, SHAMD5_ALGO_HMAC_SHA256, SHAMD5_ALGO_MD5, SHAMD5_ALGO_SHA1, SHAMD5_ALGO_SHA224, SHAMD5_ALGO_SHA256, and SHAMD5_O_MODE.
bool SHAMD5DataWriteNonBlocking | ( | uint32_t | ui32Base, |
uint32_t * | pui32Src | ||
) |
Perform a non-blocking write of 16 words of data to the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pui32Src | is the pointer to the 16-word array of data that will be written. |
This function writes 16 words of data into the data register regardless of whether or not the module is ready to accept the data.
References ASSERT, HWREG, SHAMD5_INT_INPUT_READY, SHAMD5_O_DATA_0_IN, and SHAMD5_O_IRQSTATUS.
void SHAMD5DataWrite | ( | uint32_t | ui32Base, |
uint32_t * | pui32Src | ||
) |
Perform a blocking write of 16 words of data to the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pui32Src | is the pointer to the 16-word array of data that will be written. |
This function does not return until the module is ready to accept data and the data has been written.
References ASSERT, HWREG, SHAMD5_INT_INPUT_READY, SHAMD5_O_DATA_0_IN, and SHAMD5_O_IRQSTATUS.
void SHAMD5ResultRead | ( | uint32_t | ui32Base, |
uint32_t * | pui32Dest | ||
) |
Reads the result of a hashing operation.
ui32Base | is the base address of the SHA/MD5 module. |
pui32Dest | is the pointer to the 16-word array of data that will be written. |
This function does not return until the module is ready to accept data and the data has been written.
References ASSERT, HWREG, SHAMD5_MODE_ALGO_M, SHAMD5_MODE_ALGO_MD5, SHAMD5_MODE_ALGO_SHA1, SHAMD5_MODE_ALGO_SHA224, SHAMD5_MODE_ALGO_SHA256, SHAMD5_O_IDIGEST_A, and SHAMD5_O_MODE.
void SHAMD5DataProcess | ( | uint32_t | ui32Base, |
uint32_t * | pui32DataSrc, | ||
uint32_t | ui32DataLength, | ||
uint32_t * | pui32HashResult | ||
) |
Compute a hash using the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pui32DataSrc | is a pointer to an array of data that contains the data that will be hashed. |
ui32DataLength | specifies the length of the data to be hashed in bytes. |
pui32HashResult | is a pointer to an array that holds the result of the hashing operation. |
This function computes the hash of an array of data using the SHA/MD5 module.
The length of the hash result is dependent on the algorithm that is in use. The following table shows the correct array size for each algorithm:
| MD5 | 4 Words (128 bits) | | SHA-1 | 5 Words (160 bits) | | SHA-224 | 7 Words (224 bits) |
References ASSERT, HWREG, SHAMD5_INT_CONTEXT_READY, SHAMD5_O_IRQSTATUS, and SHAMD5HashLengthSet().
void SHAMD5HMACProcess | ( | uint32_t | ui32Base, |
uint32_t * | pui32DataSrc, | ||
uint32_t | ui32DataLength, | ||
uint32_t * | pui32HashResult | ||
) |
Compute a HMAC with key pre-processing using the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pui32DataSrc | is a pointer to an array of data that contains the data that is to be hashed. |
ui32DataLength | specifies the length of the data to be hashed in bytes. |
pui32HashResult | is a pointer to an array that holds the result of the hashing operation. |
This function computes a HMAC with the given data using the SHA/MD5 module with a preprocessed key.
The length of the hash result is dependent on the algorithm that is selected with the ui32Algo argument. The following table shows the correct array size for each algorithm:
| MD5 | 4 Words (128 bits) | | SHA-1 | 5 Words (160 bits) | | SHA-224 | 7 Words (224 bits) |
References ASSERT, HWREG, SHAMD5_INT_CONTEXT_READY, SHAMD5_O_IRQSTATUS, and SHAMD5HashLengthSet().
void SHAMD5HMACPPKeyGenerate | ( | uint32_t | ui32Base, |
uint32_t * | pui32Key, | ||
uint32_t * | pui32PPKey | ||
) |
Process an HMAC key using the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pui32Key | is a pointer to an array that contains the key to be processed. |
pui32PPKey | is the pointer to the array that contains the pre-processed key. |
This function processes an HMAC key using the SHA/MD5. The resultant pre-processed key can then be used with later HMAC operations to speed processing time.
The pui32Key array must be 16 words (512 bits) long. If the key is less than 512 bits, it must be padded with zeros. The pui32PPKey array must each be 16 words (512 bits) long.
References ASSERT, HWREG, SHAMD5_INT_CONTEXT_READY, SHAMD5_INT_OUTPUT_READY, SHAMD5_MODE_HMAC_KEY_PROC, SHAMD5_O_IRQSTATUS, SHAMD5_O_LENGTH, SHAMD5_O_MODE, and SHAMD5_O_ODIGEST_A.
void SHAMD5HMACKeySet | ( | uint32_t | ui32Base, |
uint32_t * | pui32Src | ||
) |
Writes an HMAC key to the digest registers in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pui32Src | is the pointer to the 16-word array of the HMAC key. |
This function is used to write HMAC key to the digest registers for key preprocessing. The size of pui32Src must be 512 bytes. If the key is less than 512 bytes, then it must be padded with zeros.
References ASSERT, HWREG, SHAMD5_MODE_CLOSE_HASH, SHAMD5_MODE_HMAC_KEY_PROC, SHAMD5_MODE_HMAC_OUTER_HASH, SHAMD5_O_MODE, and SHAMD5_O_ODIGEST_A.
void SHAMD5HMACPPKeySet | ( | uint32_t | ui32Base, |
uint32_t * | pui32Src | ||
) |
Writes a pre-processed HMAC key to the digest registers in the SHA/MD5 module.
ui32Base | is the base address of the SHA/MD5 module. |
pui32Src | is the pointer to the 16-word array of the HMAC key. |
This function is used to write HMAC key to the digest registers for key preprocessing. The size of pui32Src must be 512 bytes. If the key is less than 512 bytes, then it must be padded with zeros.
References ASSERT, HWREG, SHAMD5_MODE_CLOSE_HASH, SHAMD5_MODE_HMAC_OUTER_HASH, SHAMD5_O_DIGEST_COUNT, SHAMD5_O_MODE, and SHAMD5_O_ODIGEST_A.