2021-10-13 08:48 AM
Hi, I am going through the firmware protection hands on in Part 4 of the STM32 Security MOOCs located here :
https://www.youtube.com/watch?v=RahlfYJ1gDs&list=PLnMKNibPkDnF0wt-ZI74SflnsBV4yKzkO&index=5&t=782s
The instructor in this hands on asks to specifically download "PATCH CRYPTOLIB" v 3.1.3 or higher and gives a URL for the downloadin the video, however , this URL only provides access to a package called en.STM32CubeExpansion_Crypto_V4.0.1. When I use the CryptoLib from this download in the hands on, I get the following compilation error -
../Src/hashcheck.c:23:10: fatal error: crypto.h: No such file or directory
23 | #include "crypto.h"
This header file (crypto.h) does not exist in:
en.STM32CubeExpansion_Crypto_v4.0.1\STM32CubeExpansion_Crypto_V4.0.1\Middlewares\ST\STM32_Cryptographic\include
rather, it exists in a "legacy" folder:
C:\Users\rkhera\workspace\en.STM32CubeExpansion_Crypto_V4.0.0_v4.0.0\STM32CubeExpansion_Crypto_V4.0.0\Middlewares\ST\STM32_Cryptographic\legacy_v3\include
Any tips on what I'm doing wrong here? The CryptoLib package I downloaded (en.STM32CubeExpansion_Crypto_V4.0.1) has a directory structure that is a little different from the "Patch CryptoLib" used in the hands on (for eg., there is not STM32G0 folder in the one I downloaded, but there is such a folder in the version of this package used in the hands-on).
Most likely explanation for what's going on:
The hand- on has simply not been updated to reflect the new structure of the CryptoLib package. In that case, what modifications need to be made in order for this to work with the most recent package en.STM32CubeExpansion_Crypto_V4.0.1? Thanks!
Update:
I resolved the issue with the header file crypto.h not being found by adding the -I..\STM32_Cryptographic\legacy_v3\include to the list of include dirs. After that, the issue arose where the linker in this hands-on project was trying to link against the old lib STM32CryptographicV3.1.3_CM0PLUS_GCC.a. So I changed this to STM32_Cryptographic\lib\libSTM32Cryptographic_CM0_CM0PLUS which seems to be the newer version of the lib. Now getting the following unresolved symbols SHA256_Init, SHA256_Append and SHA256_Finish. Would appreciate any pointers if anyone has ported this hands-on lab to the latest version of the CryptoLib.
2021-10-19 08:42 AM
hello, I recall that the SHA256 API has changed recently, this may be the cause of the incompatibility. You need to have the Cryptolib and HAL versions that are interoperable. Please check the readme files of the SW packages to align the versions correctly.
J
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-08-15 02:03 AM
Good day everyone...
I am having the similar issue using the latest crypto library.
Are there any solutions or workaround to this?
Best Regards,
Sam