我目前正在尝试将AES加密添加到使用TI cc2650 sensortag的现有信标演示中。我使用的是contiki在core/lib下提供的AES API。
static const uint8_t AES_key[16] = { 0xC0 , 0xC1 , 0xC2 , 0xC3 ,
0xC4 , 0xC5 , 0xC6 , 0xC7 ,
0xC8 , 0xC9 , 0xCA , 0xCB ,
0xCC , 0xCD , 0xCE , 0xCF };// AES Key
static uint8_t plain_text[16] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16}; // Plain-text to be encrypted.
const struct aes_128_driver AES_128;
.
.
.
printf("Plain_Text: %d \r\n", plain_text);
AES_128.set_key(AES_key);
AES_128.encrypt(plain_text);
printf("Encrypted_Text: %p\r\n", plain_text);
不幸的是,当我运行代码时,纯文本是不可更改的。使用一些额外的打印,我意识到加密功能正在工作,但输出仍然是不变的。谁能告诉我我做错了什么?
请注意,我已经在conf文件中添加了以下行:
#define AES_128_CONF aes_128_driver