All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Memory-Mapped Cryptographic Acceleration Unit (MMCAU)

## Overview

The Kinetis mmCAU software library uses the mmCAU co-processor that is connected to the Kinetis ARM Cortex-M4/M0+ Private Peripheral Bus (PPB). In this chapter, CAU refers to both CAU and mmCAU unless explicitly noted.

# Purpose

The following chapter describes how to use the mmCAU software library in any application to integrate a cryptographic algorithm or hashing function supported by the software library. Freescale products supported by the software library are Kinetis MCU/MPUs. Check the specific Freescale product for CAU availability.

# Library Features

The library is as compact and generic as possible to simplify the integration with existing cryptographic software. The library has a standard header file with ANSI C prototypes for all functions: "cau_api.h". This software library is thread safe only if CAU registers are saved on a context switch. The Kinetis mmCAU software library is also compatible to ARM C compiler conventions (EABI). All pointers passed to mmCAU API functions (input and output data blocks, keys, key schedules, and so on) are aligned to 0-modulo-4 addresses.
For applications that don't need to deal with the aligned addresses, a simple wrapper layer is provided. The wrapper layer consists of the "fsl_mmcau.h" header file and "fsl_mmcau.c" source code file. The only function of the wrapper layer is that it supports unaligned addresses
. The CAU library supports the following encryption/decryption algorithms and hashing functions:

- AES128
- AES192
- AES256
- DES
- MD5
- SHA1
- SHA256

Note: 3DES crypto algorithms are supported by calling the corresponding DES crypto function three times. Hardware support for SHA256 is only present in the CAU version 2. See the appropriate MCU/MPU reference manual for details about availability. Additionally, the cau_sha256_initialize_output() function checks the hardware revision and returns a (-1) value if the CAU lacks SHA256 support.

# CAU and mmCAU software library overview

Table 1 shows the crypto algorithms and hashing functions included in the software library:

Crypto Algorithms | AES128 AES192 AES256 | cau_aes_set_key
cau_aes_encrypt
cau_aes_decrypt
DES/3DES | cau_des_chk_parity
cau_des_encrypt
cau_des_decrypt
Hashing Functions | MD5 | cau_md5_initialize_output
cau_md5_hash_n
cau_md5_update
cau_md5_hash
SHA1 | cau_sha1_initialize_output
cau_sha1_hash_n
cau_sha1_update
cau_sha1_hash
SHA256 | cau_sha256_initialize_output
cau_sha256_hash_n
cau_sha256_update
cau_sha256_hash

Table 1: Library Overview

# mmCAU software library usage

The software library contains the following files:

File | Description
cau_api.h | CAU and mmCAU header file
lib_mmcau.a | mmCAU library: Kinetis

Table 2: File Description

The header file and lib_mmcau.a must always be included in the project.

## Functions

void | cau_aes_set_key (const unsigned char *key, const int key_size, unsigned char *key_sch)
| AES: Performs an AES key expansion. More...
void | cau_aes_encrypt (const unsigned char *in, const unsigned char *key_sch, const int nr, unsigned char *out)
| AES: Encrypts a single 16 byte block. More...
void | cau_aes_decrypt (const unsigned char *in, const unsigned char *key_sch, const int nr, unsigned char *out)
| AES: Decrypts a single 16-byte block. More...
int | cau_des_chk_parity (const unsigned char *key)
| DES: Checks key parity. More...
void | cau_des_encrypt (const unsigned char *in, const unsigned char *key, unsigned char *out)
| DES: Encrypts a single 8-byte block. More...
void | cau_des_decrypt (const unsigned char *in, const unsigned char *key, unsigned char *out)
| DES: Decrypts a single 8-byte block. More...
void | cau_md5_initialize_output (const unsigned char *md5_state)
| MD5: Initializes the MD5 state variables. More...
void | cau_md5_hash_n (const unsigned char *msg_data, const int num_blks, unsigned char *md5_state)
| MD5: Updates MD5 state variables with n message blocks. More...
void | cau_md5_update (const unsigned char *msg_data, const int num_blks, unsigned char *md5_state)
| MD5: Updates MD5 state variables. More...
void | cau_md5_hash (const unsigned char *msg_data, unsigned char *md5_state)
| MD5: Updates MD5 state variables with one message block. More...
void | cau_sha1_initialize_output (const unsigned int *sha1_state)
| SHA1: Initializes the SHA1 state variables. More...
void | cau_sha1_hash_n (const unsigned char *msg_data, const int num_blks, unsigned int *sha1_state)
| SHA1: Updates SHA1 state variables with n message blocks. More...
void | cau_sha1_update (const unsigned char *msg_data, const int num_blks, unsigned int *sha1_state)
| SHA1: Updates SHA1 state variables. More...
void | cau_sha1_hash (const unsigned char *msg_data, unsigned int *sha1_state)
| SHA1: Updates SHA1 state variables with one message block. More...
int | cau_sha256_initialize_output (const unsigned int *output)
| SHA256: Initializes the SHA256 state variables. More...
void | cau_sha256_hash_n (const unsigned char *input, const int num_blks, unsigned int *output)
| SHA256: Updates SHA256 state variables with n message blocks. More...
void | cau_sha256_update (const unsigned char *input, const int num_blks, unsigned int *output)
| SHA256: Updates SHA256 state variables. More...
void | cau_sha256_hash (const unsigned char *input, unsigned int *output)
| SHA256: Updates SHA256 state variables with one message block. More...
status_t | MMCAU_AES_SetKey (const uint8_t *key, const size_t keySize, uint8_t *keySch)
| AES: Performs an AES key expansion. More...
status_t | MMCAU_AES_EncryptEcb (const uint8_t *in, const uint8_t *keySch, uint32_t aesRounds, uint8_t *out)
| AES: Encrypts a single 16 byte block. More...
status_t | MMCAU_AES_DecryptEcb (const uint8_t *in, const uint8_t *keySch, uint32_t aesRounds, uint8_t *out)
| AES: Decrypts a single 16-byte block. More...
status_t | MMCAU_DES_ChkParity (const uint8_t *key)
| DES: Checks the key parity. More...
status_t | MMCAU_DES_EncryptEcb (const uint8_t *in, const uint8_t *key, uint8_t *out)
| DES: Encrypts a single 8-byte block. More...
status_t | MMCAU_DES_DecryptEcb (const uint8_t *in, const uint8_t *key, uint8_t *out)
| DES: Decrypts a single 8-byte block. More...
status_t | MMCAU_MD5_InitializeOutput (uint32_t *md5State)
| MD5: Initializes the MD5 state variables. More...
status_t | MMCAU_MD5_HashN (const uint8_t *msgData, uint32_t numBlocks, uint32_t *md5State)
| MD5: Updates the MD5 state variables with n message blocks. More...
status_t | MMCAU_MD5_Update (const uint8_t *msgData, uint32_t numBlocks, uint32_t *md5State)
| MD5: Updates the MD5 state variables. More...
status_t | MMCAU_SHA1_InitializeOutput (uint32_t *sha1State)
| SHA1: Initializes the SHA1 state variables. More...
status_t | MMCAU_SHA1_HashN (const uint8_t *msgData, uint32_t numBlocks, uint32_t *sha1State)
| SHA1: Updates the SHA1 state variables with n message blocks. More...
status_t | MMCAU_SHA1_Update (const uint8_t *msgData, uint32_t numBlocks, uint32_t *sha1State)
| SHA1: Updates the SHA1 state variables. More...
status_t | MMCAU_SHA256_InitializeOutput (uint32_t *sha256State)
| SHA256: Initializes the SHA256 state variables. More...
status_t | MMCAU_SHA256_HashN (const uint8_t *input, uint32_t numBlocks, uint32_t *sha256State)
| SHA256: Updates the SHA256 state variables with n message blocks. More...
status_t | MMCAU_SHA256_Update (const uint8_t *input, uint32_t numBlocks, uint32_t *sha256State)
| SHA256: Updates SHA256 state variables. More...

## Function Documentation

void cau_aes_set_key | ( | const unsigned char * | key,
|  | const int | key_size,
|  | unsigned char * | key_sch
| ) |  |

This function performs an AES key expansion

Parameters

  | key | Pointer to input key (128, 192, 256 bits in length).
  | key_size | Key size in bits (128, 192, 256)
  [out] | key_sch | Pointer to key schedule output (44, 52, 60 longwords)

Note
  All pointers must have word (4 bytes) alignment
  Table below shows the requirements for the cau_aes_set_key() function when using AES128, AES192 or AES256.
  | [in] Key Size (bits) | [out] Key Schedule Size (32 bit data values) |
  | :------------------—: | :-----------------------------------------—: |
  | 128 | 44 |
  | 192 | 52 |
  | 256 | 60 |

void cau_aes_encrypt | ( | const unsigned char * | in,
|  | const unsigned char * | key_sch,
|  | const int | nr,
|  | unsigned char * | out
| ) |  |

This function encrypts a single 16-byte block for AES128, AES192 and AES256

Parameters

  | in | Pointer to 16-byte block of input plaintext
  | key_sch | Pointer to key schedule (44, 52, 60 longwords)
  | nr | Number of AES rounds (10, 12, 14 = f(key_schedule))
  [out] | out | Pointer to 16-byte block of output ciphertext

Note
  All pointers must have word (4 bytes) alignment
  Input and output blocks may overlap.
  Table below shows the requirements for the cau_aes_encrypt()/cau_aes_decrypt() function when using AES128, AES192 or AES256.
  | Block Cipher | [in] Key Schedule Size (longwords) | [in] Number of AES rounds |
  | :-------—: | :-----------------------------—: | :--------------------—: |
  | AES128 | 44 | 10 |
  | AES192 | 52 | 12 |
  | AES256 | 60 | 14 |

void cau_aes_decrypt | ( | const unsigned char * | in,
|  | const unsigned char * | key_sch,
|  | const int | nr,
|  | unsigned char * | out
| ) |  |

This function decrypts a single 16-byte block for AES128, AES192 and AES256

Parameters

  | in | Pointer to 16-byte block of input ciphertext
  | key_sch | Pointer to key schedule (44, 52, 60 longwords)
  | nr | Number of AES rounds (10, 12, 14 = f(key_schedule))
  [out] | out | Pointer to 16-byte block of output plaintext

Note
  All pointers must have word (4 bytes) alignment
  Input and output blocks may overlap.
  Table below shows the requirements for the cau_aes_encrypt()/cau_aes_decrypt() function when using AES128, AES192 or AES256.
  | Block Cipher | [in] Key Schedule Size (longwords) | [in] Number of AES rounds |
  | :-------—: | :-----------------------------—: | :--------------------—: |
  | AES128 | 44 | 10 |
  | AES192 | 52 | 12 |
  | AES256 | 60 | 14 |

int cau_des_chk_parity | ( | const unsigned char * | key | ) |

This function checks the parity of a DES key

Parameters

  key | 64-bit DES key with parity bits. Must have word (4 bytes) alignment.

Returns
  0 no error
  -1 parity error

void cau_des_encrypt | ( | const unsigned char * | in,
|  | const unsigned char * | key,
|  | unsigned char * | out
| ) |  |

This function encrypts a single 8-byte block with DES algorithm.

Parameters

  | in | Pointer to 8-byte block of input plaintext
  | key | Pointer to 64-bit DES key with parity bits
  [out] | out | Pointer to 8-byte block of output ciphertext

Note
  All pointers must have word (4 bytes) alignment
  Input and output blocks may overlap.

void cau_des_decrypt | ( | const unsigned char * | in,
|  | const unsigned char * | key,
|  | unsigned char * | out
| ) |  |

This function decrypts a single 8-byte block with DES algorithm.

Parameters

  | in | Pointer to 8-byte block of input ciphertext
  | key | Pointer to 64-bit DES key with parity bits
  [out] | out | Pointer to 8-byte block of output plaintext

Note
  All pointers must have word (4 bytes) alignment
  Input and output blocks may overlap.

void cau_md5_initialize_output | ( | const unsigned char * | md5_state | ) |

This function initializes the MD5 state variables. The output can be used as input to cau_md5_hash() and cau_md5_hash_n().

Parameters

  [out] | md5_state | Pointer to 128-bit block of md5 state variables: a,b,c,d

Note
  All pointers must have word (4 bytes) alignment

void cau_md5_hash_n | ( | const unsigned char * | msg_data,
|  | const int | num_blks,
|  | unsigned char * | md5_state
| ) |  |

This function updates MD5 state variables for one or more input message blocks

Parameters

  | msg_data | Pointer to start of input message data
  | num_blks | Number of 512-bit blocks to process
  [in,out] | md5_state | Pointer to 128-bit block of MD5 state variables: a,b,c,d

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_md5_initialize_output() function must be called when starting a new hash. Useful when handling non-contiguous input message blocks.

void cau_md5_update | ( | const unsigned char * | msg_data,
|  | const int | num_blks,
|  | unsigned char * | md5_state
| ) |  |

This function updates MD5 state variables for one or more input message blocks. It starts a new hash as it internally calls cau_md5_initialize_output() first.

Parameters

  | msg_data | Pointer to start of input message data
  | num_blks | Number of 512-bit blocks to process
  [out] | md5_state | Pointer to 128-bit block of MD5 state variables: a,b,c,d

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_md5_initialize_output() function is not required to be called as it is called internally to start a new hash. All input message blocks must be contiguous.

void cau_md5_hash | ( | const unsigned char * | msg_data,
|  | unsigned char * | md5_state
| ) |  |

This function updates MD5 state variables for one input message block

Parameters

  | msg_data | Pointer to start of 512-bits of input message data
  [in,out] | md5_state | Pointer to 128-bit block of MD5 state variables: a,b,c,d

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_md5_initialize_output() function must be called when starting a new hash.

void cau_sha1_initialize_output | ( | const unsigned int * | sha1_state | ) |

This function initializes the SHA1 state variables. The output can be used as input to cau_sha1_hash() and cau_sha1_hash_n().

Parameters

  [out] | sha1_state | Pointer to 160-bit block of SHA1 state variables: a,b,c,d,e

Note
  All pointers must have word (4 bytes) alignment

void cau_sha1_hash_n | ( | const unsigned char * | msg_data,
|  | const int | num_blks,
|  | unsigned int * | sha1_state
| ) |  |

This function updates SHA1 state variables for one or more input message blocks

Parameters

  | msg_data | Pointer to start of input message data
  | num_blks | Number of 512-bit blocks to process
  [in,out] | sha1_state | Pointer to 160-bit block of SHA1 state variables: a,b,c,d,e

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_sha1_initialize_output() function must be called when starting a new hash. Useful when handling non-contiguous input message blocks.

void cau_sha1_update | ( | const unsigned char * | msg_data,
|  | const int | num_blks,
|  | unsigned int * | sha1_state
| ) |  |

This function updates SHA1 state variables for one or more input message blocks. It starts a new hash as it internally calls cau_sha1_initialize_output() first.

Parameters

  | msg_data | Pointer to start of input message data
  | num_blks | Number of 512-bit blocks to process
  [out] | sha1_state | Pointer to 160-bit block of SHA1 state variables: a,b,c,d,e

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_sha1_initialize_output() function is not required to be called as it is called internally to start a new hash. All input message blocks must be contiguous.

void cau_sha1_hash | ( | const unsigned char * | msg_data,
|  | unsigned int * | sha1_state
| ) |  |

This function updates SHA1 state variables for one input message block

Parameters

  | msg_data | Pointer to start of 512-bits of input message data
  [in,out] | sha1_state | Pointer to 160-bit block of SHA1 state variables: a,b,c,d,e

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_sha1_initialize_output() function must be called when starting a new hash.

int cau_sha256_initialize_output | ( | const unsigned int * | output | ) |

This function initializes the SHA256 state variables. The output can be used as input to cau_sha256_hash() and cau_sha256_hash_n().

Parameters

  [out] | sha256_state | Pointer to 256-bit block of SHA2 state variables a,b,c,d,e,f,g,h

Note
  All pointers must have word (4 bytes) alignment

Returns
  0 No error. CAU hardware support for SHA256 is present.
  -1 Error. CAU hardware support for SHA256 is not present.

void cau_sha256_hash_n | ( | const unsigned char * | input,
|  | const int | num_blks,
|  | unsigned int * | output
| ) |  |

This function updates SHA256 state variables for one or more input message blocks

Parameters

  | msg_data | Pointer to start of input message data
  | num_blks | Number of 512-bit blocks to process
  [in,out] | sha256_state | Pointer to 256-bit block of SHA2 state variables: a,b,c,d,e,f,g,h

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_sha256_initialize_output() function must be called when starting a new hash. Useful when handling non-contiguous input message blocks.

void cau_sha256_update | ( | const unsigned char * | input,
|  | const int | num_blks,
|  | unsigned int * | output
| ) |  |

This function updates SHA256 state variables for one or more input message blocks. It starts a new hash as it internally calls cau_sha256_initialize_output() first.

Parameters

  | msg_data | Pointer to start of input message data
  | num_blks | Number of 512-bit blocks to process
  [out] | sha256_state | Pointer to 256-bit block of SHA2 state variables: a,b,c,d,e,f,g,h

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_sha256_initialize_output() function is not required to be called as it is called internally to start a new hash. All input message blocks must be contiguous.

void cau_sha256_hash | ( | const unsigned char * | input,
|  | unsigned int * | output
| ) |  |

This function updates SHA256 state variables for one input message block

Parameters

  | msg_data | Pointer to start of 512-bits of input message data
  [in,out] | sha256_state | Pointer to 256-bit block of SHA2 state variables: a,b,c,d,e,f,g,h

Note
  All pointers must have word (4 bytes) alignment
  Input message and digest output blocks must not overlap. The cau_sha256_initialize_output() function must be called when starting a new hash.

status_t MMCAU_AES_SetKey | ( | const uint8_t * | key,
|  | const size_t | keySize,
|  | uint8_t * | keySch
| ) |  |

This function performs an AES key expansion.

Parameters

  | key | Pointer to input key (128, 192, 256 bits in length).
  | keySize | Key size in bytes (16, 24, 32)
  [out] | keySch | Pointer to key schedule output (44, 52, 60 longwords)

Note
  Table below shows the requirements for the MMCAU_AES_SetKey() function when using AES128, AES192, or AES256.
  | [in] Key Size (bits) | [out] Key Schedule Size (32 bit data values) |
  | :------------------—: | :-----------------------------------------—: |
  | 128 | 44 |
  | 192 | 52 |
  | 256 | 60 |

Returns
  Status of the operation. (kStatus_Success, kStatus_InvalidArgument, kStatus_Fail)

status_t MMCAU_AES_EncryptEcb | ( | const uint8_t * | in,
|  | const uint8_t * | keySch,
|  | uint32_t | aesRounds,
|  | uint8_t * | out
| ) |  |

This function encrypts a single 16-byte block for AES128, AES192, and AES256.

Parameters

  | in | Pointer to 16-byte block of input plaintext.
  | keySch | Pointer to key schedule (44, 52, 60 longwords).
  | aesRounds | Number of AES rounds (10, 12, 14 = f(key_schedule)).
  [out] | out | Pointer to 16-byte block of output ciphertext.

Note
  Input and output blocks may overlap.
  Table below shows the requirements for the MMCAU_AES_EncryptEcb()/MMCAU_AES_DecryptEcb() function when using AES128, AES192 or AES256.
  | Block Cipher | [in] Key Schedule Size (longwords) | [in] Number of AES rounds |
  | :-------—: | :-----------------------------—: | :--------------------—: |
  | AES128 | 44 | 10 |
  | AES192 | 52 | 12 |
  | AES256 | 60 | 14 |

Returns
  Status of the operation. (kStatus_Success, kStatus_InvalidArgument, kStatus_Fail)

status_t MMCAU_AES_DecryptEcb | ( | const uint8_t * | in,
|  | const uint8_t * | keySch,
|  | uint32_t | aesRounds,
|  | uint8_t * | out
| ) |  |

This function decrypts a single 16-byte block for AES128, AES192, and AES256.

Parameters

  | in | Pointer to 16-byte block of input ciphertext.
  | keySch | Pointer to key schedule (44, 52, 60 longwords).
  | aesRounds | Number of AES rounds (10, 12, 14 = f(key_schedule)).
  [out] | out | Pointer to 16-byte block of output plaintext.

Note
  Input and output blocks may overlap.
  Table below shows the requirements for the cau_aes_encrypt()/cau_aes_decrypt(). function when using AES128, AES192 or AES256.
  | Block Cipher | [in] Key Schedule Size (longwords) | [in] Number of AES rounds |
  | :-------—: | :-----------------------------—: | :--------------------—: |
  | AES128 | 44 | 10 |
  | AES192 | 52 | 12 |
  | AES256 | 60 | 14 |

Returns
  Status of the operation. (kStatus_Success, kStatus_InvalidArgument, kStatus_Fail)

status_t MMCAU_DES_ChkParity | ( | const uint8_t * | key | ) |

This function checks the parity of a DES key.

Parameters

  key | 64-bit DES key with parity bits.

Returns
  kStatus_Success No error.
  kStatus_Fail Parity error.
  kStatus_InvalidArgument Key argument is NULL.

status_t MMCAU_DES_EncryptEcb | ( | const uint8_t * | in,
|  | const uint8_t * | key,
|  | uint8_t * | out
| ) |  |

This function encrypts a single 8-byte block with the DES algorithm.

Parameters

  | in | Pointer to 8-byte block of input plaintext.
  | key | Pointer to 64-bit DES key with parity bits.
  [out] | out | Pointer to 8-byte block of output ciphertext.

Note
  Input and output blocks may overlap.

Returns
  Status of the operation. (kStatus_Success, kStatus_InvalidArgument, kStatus_Fail)

status_t MMCAU_DES_DecryptEcb | ( | const uint8_t * | in,
|  | const uint8_t * | key,
|  | uint8_t * | out
| ) |  |

This function decrypts a single 8-byte block with the DES algorithm.

Parameters

  | in | Pointer to 8-byte block of input ciphertext.
  | key | Pointer to 64-bit DES key with parity bits.
  [out] | out | Pointer to 8-byte block of output plaintext.

Note
  Input and output blocks may overlap.

Returns
  Status of the operation. (kStatus_Success, kStatus_InvalidArgument, kStatus_Fail)

status_t MMCAU_MD5_InitializeOutput | ( | uint32_t * | md5State | ) |

This function initializes the MD5 state variables. The output can be used as input to MMCAU_MD5_HashN().

Parameters

  [out] | md5State | Pointer to 128-bit block of md5 state variables: a,b,c,d

status_t MMCAU_MD5_HashN | ( | const uint8_t * | msgData,
|  | uint32_t | numBlocks,
|  | uint32_t * | md5State
| ) |  |

This function updates the MD5 state variables for one or more input message blocks.

Parameters

  | msgData | Pointer to start of input message data.
  | numBlocks | Number of 512-bit blocks to process.
  [in,out] | md5State | Pointer to 128-bit block of MD5 state variables: a, b, c, d.

Note
  Input message and digest output blocks must not overlap. The MMCAU_MD5_InitializeOutput() function must be called when starting a new hash. Useful when handling non-contiguous input message blocks.

status_t MMCAU_MD5_Update | ( | const uint8_t * | msgData,
|  | uint32_t | numBlocks,
|  | uint32_t * | md5State
| ) |  |

This function updates the MD5 state variables for one or more input message blocks. It starts a new hash as it internally calls MMCAU_MD5_InitializeOutput() first.

Parameters

  | msgData | Pointer to start of input message data.
  | numBlocks | Number of 512-bit blocks to process.
  [out] | md5State | Pointer to 128-bit block of MD5 state variables: a, b, c, d.

Note
  Input message and digest output blocks must not overlap. The MMCAU_MD5_InitializeOutput() function is not required to be called as it is called internally to start a new hash. All input message blocks must be contiguous.

status_t MMCAU_SHA1_InitializeOutput | ( | uint32_t * | sha1State | ) |

This function initializes the SHA1 state variables. The output can be used as input to MMCAU_SHA1_HashN().

Parameters

  [out] | sha1State | Pointer to 160-bit block of SHA1 state variables: a, b, c, d, e.

status_t MMCAU_SHA1_HashN | ( | const uint8_t * | msgData,
|  | uint32_t | numBlocks,
|  | uint32_t * | sha1State
| ) |  |

This function updates the SHA1 state variables for one or more input message blocks.

Parameters

  | msgData | Pointer to start of input message data.
  | numBlocks | Number of 512-bit blocks to process.
  [in,out] | sha1State | Pointer to 160-bit block of SHA1 state variables: a, b, c, d, e.

Note
  Input message and digest output blocks must not overlap. The MMCAU_SHA1_InitializeOutput() function must be called when starting a new hash. Useful when handling non-contiguous input message blocks.

status_t MMCAU_SHA1_Update | ( | const uint8_t * | msgData,
|  | uint32_t | numBlocks,
|  | uint32_t * | sha1State
| ) |  |

This function updates the SHA1 state variables for one or more input message blocks. It starts a new hash as it internally calls MMCAU_SHA1_InitializeOutput() first.

Parameters

  | msgData | Pointer to start of input message data.
  | numBlocks | Number of 512-bit blocks to process.
  [out] | sha1State | Pointer to 160-bit block of SHA1 state variables: a, b, c, d, e.

Note
  Input message and digest output blocks must not overlap. The MMCAU_SHA1_InitializeOutput() function is not required to be called as it is called internally to start a new hash. All input message blocks must be contiguous.

status_t MMCAU_SHA256_InitializeOutput | ( | uint32_t * | sha256State | ) |

This function initializes the SHA256 state variables. The output can be used as input to MMCAU_SHA256_HashN().

Parameters

  [out] | sha256State | Pointer to 256-bit block of SHA2 state variables a, b, c, d, e, f, g, h.

Returns
  kStatus_Success No error. CAU hardware support for SHA256 is present.
  kStatus_Fail Error. CAU hardware support for SHA256 is not present.
  kStatus_InvalidArgument Error. sha256State is NULL.

status_t MMCAU_SHA256_HashN | ( | const uint8_t * | input,
|  | uint32_t | numBlocks,
|  | uint32_t * | sha256State
| ) |  |

This function updates SHA256 state variables for one or more input message blocks.

Parameters

  | msgData | Pointer to start of input message data.
  | numBlocks | Number of 512-bit blocks to process.
  [in,out] | sha256State | Pointer to 256-bit block of SHA2 state variables: a, b, c, d, e, f, g, h.

Note
  Input message and digest output blocks must not overlap. The MMCAU_SHA256_InitializeOutput() function must be called when starting a new hash. Useful when handling non-contiguous input message blocks.

status_t MMCAU_SHA256_Update | ( | const uint8_t * | input,
|  | uint32_t | numBlocks,
|  | uint32_t * | sha256State
| ) |  |

This function updates the SHA256 state variables for one or more input message blocks. It starts a new hash as it internally calls cau_sha256_initialize_output() first.

Parameters

  | msgData | Pointer to start of input message data.
  | numBlocks | Number of 512-bit blocks to process.
  [out] | sha256State | Pointer to 256-bit block of SHA2 state variables: a, b, c, d, e, f, g, h.

Note
  Input message and digest output blocks must not overlap. The MMCAU_SHA256_InitializeOutput() function is not required to be called. as it is called internally to start a new hash. All input message blocks must be contiguous.