cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f417 cryptography

Yuktheshwar Bhat
Associate II
Posted on June 06, 2018 at 07:43

Hi am a beginner in the stm32f417 micro controller programming.Can anybody help me regarding how to implement cryptography in stm32f417vg micro controller.

8 REPLIES 8
Posted on June 06, 2018 at 13:46

ST has a Crypto library available.

http://www.st.com/en/embedded-software/stm32-cryp-lib.html

 

http://www.st.com/en/embedded-software/x-cube-cryptolib.html

 

Both the SPL and HAL software trees have example code

STM32F4xx_DSP_StdPeriph_Lib_V1.8.0\Project\STM32F4xx_StdPeriph_Examples\CRYP\CRYP_AES_CCM

STM32Cube_FW_F4_V1.21.0\Projects\STM324xG_EVAL\Examples\CRYP\CRYP_AES_DMA

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 06, 2018 at 16:07

thank you...

Posted on June 07, 2018 at 11:21

https://community.st.com/0D50X00009bMM5DSAW

 
Yuktheshwar Bhat
Associate II
Posted on June 12, 2018 at 12:07

Hi all..

In stm32f4XX,  whether CRYP periferal have any dependencies on RTOS

Posted on June 12, 2018 at 15:44

Well you'd need to serialize access to the hardware, I'd assume.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Yuktheshwar Bhat
Associate II
Posted on June 13, 2018 at 11:42

#include 'main.h'

#include 'stm32f4xx_hal.h'

CRYP_HandleTypeDef hcryp;

void SystemClock_Config(void);

static void MX_GPIO_Init(void);

static void MX_CRYP_Init(void);

int main(void)

{

    uint8_t Plain_Data[1] = {10};

    uint8_t AEC_ECB_Encrypted_Data[1] = {0};

    uint8_t AEC_ECB_Decrypted_Data[1] = {0};

    HAL_Init();

    SystemClock_Config();

    MX_GPIO_Init();

    MX_CRYP_Init();

while (1)

    {

        // encrypt the data

        if(HAL_CRYP_AESECB_Encrypt(&hcryp,Plain_Data,sizeof(Plain_Data),AEC_ECB_Encrypted_Data,1000) != HAL_OK)

        HAL_NVIC_SystemReset();

        // decrypt the encrypted data5

        if(HAL_CRYP_AESECB_Decrypt(&hcryp,AEC_ECB_Encrypted_Data,sizeof(AEC_ECB_Encrypted_Data),AEC_ECB_Decrypted_Data,10) != HAL_OK)

           HAL_NVIC_SystemReset();

    }

}

am using the above code to encrypt and decrypt the data but when i do decryption of encrypted data am not getting original data.

Posted on June 13, 2018 at 15:32

I don't think working with one byte buffers is how this functions.

ST has AES examples, work with those.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on June 14, 2018 at 08:51

yes,I tried with the example given by the ST but the encrypted data is not matching with expected result.