static bool is_init = false;
static uint8_t out_buf[16];
bool aesTest(void) {
uint32_t retval;
uint8_t test_key[16] = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
uint8_t test_data[16] = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00 };
if(!is_init) {
retval = Chip_AES_Init();
if(retval == 0)
is_init = true;
else
return false;
}
Chip_AES_LoadKeySW(test_key);
retval = Chip_AES_SetMode(CHIP_AES_API_CMD_ENCODE_ECB);
if(retval != 0)
return false;
retval = Chip_AES_Operate(out_buf, test_data, 1);
if(retval != 0)
return false;
return true;
}
|