13.3.3.1 AES API

The AES software has two function routines to do encryption and decryption on a 128 bit block of input data.

The AES encryption function entry point is located at the Boot ROM address 0x02001904 and the encryption function parameters are:

  • Src[in] : a pointer to a 128-bit data block to be encrypted
  • Dst[out]:  a pointer to 128 bit encrypted data
  • Keys[in]: a pointer to 128 bit key
  • Length[in]: Number of 32-bit words comprising the Key, 4 for 128 bits key

The AES decryption function entry point is located at the Boot ROM address 0x02001908 and the decryption function parameters are:

  • Src[in] : a pointer to a 128-bit data block to be decrypted
  • Dst[out]:  a pointer to 128 bit decrypted data
  • Keys[in]: a pointer to 128 bit key
  • Length[in]: Number of 32-bit words comprising the Key, 4 for 128 bits key

The APIs are:

/* Type definition for CRYA AES functions. */
typedef void (*crya_aes_encrypt_t) (const uint8_t *keys, uint32_t key_len, const uint8_t *src, uint8_t *dst);
typedef void (*crya_aes_decrypt_t) (const uint8_t *keys, uint32_t key_len, const uint8_t *src, uint8_t *dst);
/* AES encrypt function 
* \param keys[in]: A pointer to 128-bit key
* \param key_len[in]: Number of 32-bit words comprising the key, 4 for 128-bit key
* \param src[in]: A pointer to a 128-bit data block to be encrypted
* \param dst[out]: A pointer to a 128-bit encrypted data
*/
#define secure_crya_aes_encrypt ((crya_aes_encrypt_t ) (0x02001904 | 0x1))
/* AES decrypt function 
* \param keys[in]: A pointer to 128-bit key
* \param key_len[in]: Number of 32-bit words comprising the key, 4 for 128-bit key
* \param src[in]: A pointer to a 128-bit data block to be decrypted
* \param dst[out]: A pointer to a 128-bit decrypted data
*/
#define secure_crya_aes_decrypt ((crya_aes_decrypt_t ) (0x02001908 | 0x1))