12.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.
/* Definitions for CRYA AES Key Length. */
#define AES_KEY_128_LEN 4
#define AES_KEY_192_LEN 6
#define AES_KEY_256_LEN 8
/* Type definitions 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);
The AES encryption function entry point is located at the Boot ROM address 0x02006804:
/* AES encrypt function
* \param keys[in]: A pointer to a 128-bit, 192-bit or 256-bit key
* \param key_len[in]: Number of 32-bit words comprising the key, 4/6/8 for 128-/192-/256-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 ) (0x02006804 | 0x1))
The AES decryption function entry point is located at the Boot ROM address 0x02006808:
/* AES decrypt function
* \param keys[in]: A pointer to a 128-bit, 192-bit or 256-bit key
* \param key_len[in]: Number of 32-bit words comprising the key, 4/6/8 for 128-/192-/256-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 ) (0x02006808 | 0x1))