How to use Crypto Acceleration Unit (CAU) on K64 for AES and SHA

Showing results for 
Search instead for 
Did you mean: 

How to use Crypto Acceleration Unit (CAU) on K64 for AES and SHA

Contributor III


I am using the CAU on the K64 in the multi-threaded environment. I am using these function through the MCUXpresso SDK 2.4.0. 

If I am using the CAU for AES encrypt/decrypt can I concurrently use CAU to do SHA256. Before the AES encrypt/decrypt has finished.

For example consider the following call order from a single thread for simplicity.

(The function names are provided by the SDK driver)

  1. MMCAU_AES_SetKey()
    • Sets the AES encryption key in the CAU 
  2. MMCAU_SHA256_HashN()
    • User the CAU unit for SHA256, before I encrypted the data
  3. MMCAU_AES_EncryptEcb()
    • I now encrypt the data, with what I assume to be the correct key even though I called SHA256 method above.

Will the AES encryption still work correctly though I called the API to do a SHA256 hash before I called the encrypt.

Labels (1)
Tags (5)
2 Replies

NXP TechSupport
NXP TechSupport


I'm afraid you can't calculate AES and SHA concurrently. Although they have different core module, but they share some of circuit.



Contributor III

Hi Jing, 

When MMCAU_AES_SetKey() is called it just perform the key expansion and stores the key schedule in the variable "keySch".

Does this method also setup anything in hardware registers which need to keep there state for an encryption/decryption to be successful?

The reason I am asking this is because MMCAU_AES_EncryptEcb() takes the "keySch" as an input. The  "keySch" is generated by MMCAU_AES_SetKey(), therefore there nothing in the hardware register that should matter for the encryption/decryption to be successful

If the CAU does not store anything in the hardware registers that are required to successfully encrypt/decrypt then the answer you proposed is not correct.

For Example

  1. MMCAU_AES_SetKey()
    • This returns the key schedule. Lets call the variable "keySch" 
  2. Do something else with the CAU for example  MMCAU_SHA256_HashN()
  3. Call MMCAU_AES_EncryptEcb() with the input variable "keySch"

After the 3rd calls shouldn't encryption be successful?

0 Kudos