#define CRYA_AES_ENC_ADDRESS      0x02001904
#define CRYA_AES_DEC_ADDRESS      0x02001908

/** Type definition for CRYA function. */
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 ) (CRYA_AES_ENC_ADDRESS | 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 ) (CRYA_AES_DEC_ADDRESS | 0x1))

/*** AES TEST ***/
 *** AES_KEY : 128 bits = 16 bytes / 192 bits = 24 bytes / 256 bits = 32 bytes
 *** AES_CHUNK_SIZE = 128 bits = 16 bytes
 ***/
#define AES_KEY_SIZE 16
#define AES_KEY_LEN 4
#define AES_CHUNK_SIZE  16

/*** Contants to AES Key example  ***/
const uint8_t aes_key[AES_KEY_SIZE] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};

/*** AES Plain Text Example ***/
const uint8_t aes_plaintext[AES_CHUNK_SIZE] = {0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,0x88,0x99,0xaa,0xbb,0xcc,0xdd,0xee,0xff};

/*** output buffers ***/
uint8_t aes_encrypted[AES_CHUNK_SIZE];
uint8_t aes_decrypted[AES_CHUNK_SIZE];

/*** Cypher text ***/
secure_crya_aes_encrypt( aes_key, AES_KEY_LEN, aes_plaintext, aes_encrypted);

/*** Decrypt cyphered text ***/
secure_crya_aes_decrypt( aes_key, AES_KEY_LEN, aes_encrypted, aes_decrypted);