2019-01-29 07:57 AM
Hello,
I'm trying to integrate latest crypto lib (v. 3.1.2, FW implementation) into my TrueSTUDIO project but encryption with AES-CBC-128 fails.
Example project in Fw_Crypto\STM32L0\Projects\STM32L053R8-Nucleo\AES\AES192_CBC fails both encryption and decryption phases.
Digging into the issue I reduced key size to 128bits and set Key, IV and Plaintext as all 0's (16B long): encryption works correctly (according to various online AES calculators).
Changing a single bit in Plaintext will break encryption: it looks like some data are ignored and some other are read multiple times (always comparing result with online calculators).
If I split the 16B of plaintext into 4 groups (4B each - let's call them p1 p2 p3 p4), library behaves as if plaintext was p2 p1 p1 p1: changing bits in p3 and p4 does not change ciphertext (!).
What am I missing?
Alessandro
Solved! Go to Solution.
2019-01-31 05:19 AM
Hi Alessandro,
You can find in the below link the cryptolib user manual it detail about the cryptolib and clearly mention that you have to activate the CRC peripheral. (As you mention)
Please mark this ticket as answered to allow communities getting benefits about your ticket.
Thank you in advance.
Regards,
Amir
2019-01-30 12:45 AM
Ok, I found the problem: CRC peripheral was not enabled.
Adding __CRC_CLK_ENABLE() before encryption solved the issue.
2019-01-31 05:19 AM
Hi Alessandro,
You can find in the below link the cryptolib user manual it detail about the cryptolib and clearly mention that you have to activate the CRC peripheral. (As you mention)
Please mark this ticket as answered to allow communities getting benefits about your ticket.
Thank you in advance.
Regards,
Amir