This section describes the programming interface of the CAU3 HASH driver.
|
status_t | CAU3_HASH_Init (CAU3_Type *base, cau3_hash_ctx_t *ctx, cau3_hash_algo_t algo) |
| Initialize HASH context. More...
|
|
status_t | CAU3_HASH_Update (CAU3_Type *base, cau3_hash_ctx_t *ctx, const uint8_t *input, size_t inputSize) |
| Add data to current HASH. More...
|
|
status_t | CAU3_HASH_Finish (CAU3_Type *base, cau3_hash_ctx_t *ctx, uint8_t *output, size_t *outputSize) |
| Finalize hashing. More...
|
|
status_t | CAU3_HASH (CAU3_Type *base, cau3_hash_algo_t algo, const uint8_t *input, size_t inputSize, uint8_t *output, size_t *outputSize) |
| Create HASH on given data. More...
|
|
#define CAU3_SHA_BLOCK_SIZE 128 |
internal buffer block size
#define CAU3_HASH_CTX_SIZE 58 |
Enumerator |
---|
kCAU3_Sha1 |
SHA_1.
|
kCAU3_Sha256 |
SHA_256.
|
This function initializes the HASH.
For blocking CAU3 HASH API, the HASH context contains all information required for context switch, such as running hash.
- Parameters
-
| base | CAU3 peripheral base address |
[out] | ctx | Output hash context |
| algo | Underlaying algorithm to use for hash computation. |
- Returns
- Status of initialization
Add data to current HASH. This can be called repeatedly with an arbitrary amount of data to be hashed. The functions blocks. If it returns kStatus_Success, the running hash or mac has been updated (CAU3 has processed the input data), so the memory at input pointer can be released back to system. The context is updated with the running hash or mac and with all necessary information to support possible context switch.
- Parameters
-
| base | CAU3 peripheral base address |
[in,out] | ctx | HASH context |
| input | Input data |
| inputSize | Size of input data in bytes |
- Returns
- Status of the hash update operation
Outputs the final hash (computed by CAU3_HASH_Update()) and erases the context.
- Parameters
-
[in,out] | ctx | Input hash context |
[out] | output | Output hash data |
[out] | outputSize | Output parameter storing the size of the output hash in bytes |
- Returns
- Status of the hash finish operation
status_t CAU3_HASH |
( |
CAU3_Type * |
base, |
|
|
cau3_hash_algo_t |
algo, |
|
|
const uint8_t * |
input, |
|
|
size_t |
inputSize, |
|
|
uint8_t * |
output, |
|
|
size_t * |
outputSize |
|
) |
| |
Perform the full SHA in one function call. The function is blocking.
- Parameters
-
| base | CAU3 peripheral base address |
| algo | Underlaying algorithm to use for hash computation. |
| input | Input data |
| inputSize | Size of input data in bytes |
[out] | output | Output hash data |
[out] | outputSize | Output parameter storing the size of the output hash in bytes |
- Returns
- Status of the one call hash operation.