2020-02-25 02:24 AM
I wants to encrypt 8bits of data using AES256 Security with STM32L442KC . And sending Encrypted data through UART. I am confused in code that code is correct or not....please let me know any correction in this code. I am using Atolic true studio.
uint8_t plaintext[]={0x01};
uint8_t ciphertext[16];
uint32_t retval;
MX_AES_Init();
main()
{
uint32_t rerval = HAL_CRYP_AESECB_Encrypt(&hcryp, plaintext, 1, ciphertext, 5);
if(retval == 0)
{
HAL_UART_Transmit(&huart1,(uint8_t *)ciphertext,sizeof(ciphertext),5);
}
}
Thanks & Regards
Ashok