cancel
Showing results for 
Search instead for 
Did you mean: 

How to add STM32CryptographicV4.0.1 in the STM32CubeExpansion_SBSFU_V2.6.1 middleware

Ikbal
Associate II

Hello,

How can I add STM32CryptographicV4.0.1 in the STM32CubeExpansion_SBSFU_V2.6.1 middleware for SBSFU application ?

The current STM32CubeExpansion_SBSFU_V2.6.1 is used libSTM32CryptographicV3.1.1_STM32H7_GCC ST crypto library for STM32H7 boards. I want to used STM32CryptographicV4.0.1 library in the SBSFU.

What is the process to implement the above.

Look forward for your support.

Thanks & Regards,

Ikbal

1 ACCEPTED SOLUTION

Accepted Solutions
Jocelyn RICARD
ST Employee

hello @Ikbal,

the crypto library V4 provides an implementation of legacy API here:

STM32CubeExpansion_Crypto_V4.0.1\Middlewares\ST\STM32_Cryptographic\legacy_v3\

I guess the simplest way would be to include the needed files in your project, change include path and library used. No need to change any original secure engine files as V3 crypto API calls will be transformed into V4 calls.

Best regards

Jocelyn

View solution in original post

3 REPLIES 3
Jocelyn RICARD
ST Employee

hello @Ikbal,

the crypto library V4 provides an implementation of legacy API here:

STM32CubeExpansion_Crypto_V4.0.1\Middlewares\ST\STM32_Cryptographic\legacy_v3\

I guess the simplest way would be to include the needed files in your project, change include path and library used. No need to change any original secure engine files as V3 crypto API calls will be transformed into V4 calls.

Best regards

Jocelyn

Ikbal
Associate II

Hello @Jocelyn RICARD​,

I have added the STM32CubeExpansion_Crypto_V4.0.1 library in the SBSFU application for STM32H7B3I-DK example application.  

I have change the Image header verification API from ECDSA verification to RSA 2048 verification. I have successfully tested the RSA verification API using example application of STM32CubeExpansion_Crypto_V4.0.1 for STM32H7B3I-DK.

After adding the STM32CubeExpansion_Crypto_V4.0.1 in the SBSFU, I am getting the below compilation error during SE_CoreBin application compilation.

arm-none-eabi-gcc "C:/ST/STM32CubeExpansion_SBSFU_V2.6.1/Projects/STM32H7B3I-DK/Applications/1_Image/1_Image_SECoreBin/Src/se_low_level.c" -mcpu=cortex-m7 -std=gnu11 -g3 -DUSE_HAL_DRIVER -DSTM32H7B3xxQ -DUSE_STM32H7B3I_DISCOVERY -c -I../../Inc -I"C:/ST/STM32CubeExpansion_SBSFU_V2.6.1/Middlewares/ST/STM32_Cryptographic/Fw_Crypto/STM32H7A3/Inc" -I../../../../../../../Drivers/BSP/STM32H7B3I-DK -I../../../../../../../Drivers/CMSIS/Include -I../../../../../../../Drivers/CMSIS/Device/ST/STM32H7xx/Include -I../../../../../../../Drivers/STM32H7xx_HAL_Driver/Inc -I../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../Middlewares/ST/STM32_Secure_Engine/Core -I../../../../../../../Middlewares/ST/STM32_Secure_Engine/Key -I../../../1_Image_SBSFU/SBSFU/App -I../../../1_Image_SBSFU/SBSFU/Target -I../../../Linker_Common/STM32CubeIDE -I"C:/ST/STM32CubeExpansion_SBSFU_V2.6.1/Middlewares/ST/STM32CubeExpansion_Crypto_V4.0.1/Middlewares/ST/STM32_Cryptographic/include" -Os -ffunction-sections -Wall -fstack-usage -MMD -MP -MF"Application/User/se_low_level.d" -MT"Application/User/se_low_level.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=softfp -mthumb -o "Application/User/se_low_level.o"
arm-none-eabi-gcc -mcpu=cortex-m7 -g3 -c -I../../../1_Image/1_Image_SBSFU/Core/Inc -x assembler-with-cpp -MMD -MP -MF"Application/Startup/se_key.d" -MT"Application/Startup/se_key.o" --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=softfp -mthumb -o "Application/Startup/se_key.o" "../Application/Startup/se_key.s"
arm-none-eabi-gcc -o "SECoreBin.elf" @"objects.list"  -l:libSTM32Cryptographic_CM7.a -l:STM32CryptographicV3.1.3_CM7_GCC.a -mcpu=cortex-m7 -T"../STM32H7B3LIHxQ.ld" --specs=nosys.specs -Wl,-Map="SECoreBin.map" -Wl,--gc-sections -static -L"C:\ST\STM32CubeExpansion_SBSFU_V2.6.1\Middlewares\ST\STM32CubeExpansion_Crypto_V4.0.1\Middlewares\ST\STM32_Cryptographic\lib" -L"C:\ST\STM32CubeExpansion_SBSFU_V2.6.1\Middlewares\ST\STM32_Cryptographic\Fw_Crypto\STM32H7A3\Lib" -L ../../../Linker_Common/STM32CubeIDE --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=softfp -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: SECoreBin.elf section `.bss' will not fit in region `SE_RAM_region'
c:\st\stm32cubeide_1.10.1\stm32cubeide\plugins\com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.10.3-2021.10.win32_1.0.0.202111181127\tools\arm-none-eabi\bin\ld.exe: region `SE_RAM_region' overflowed by 4256 bytes
collect2.exe: error: ld returned 1 exit status
make[1]: *** [makefile:69: SECoreBin.elf] Error 1
make: *** [makefile:62: all] Error 2
"make all" terminated with exit code 2. Build might be incomplete.

I have attached the SBSFU LD file for RAM memory definition:

0693W00000Y73geQAB.png

Please help to fix this error.

Thanks,

Ikbal

Jocelyn RICARD
ST Employee

Hello @Ikbal​,

as error message says: "`.bss' will not fit in region `SE_RAM_region'"

In your implementation, you seem to have created new non initialised buffer, that do not fit any more to the RAM allocated to the SE.

So, you first need to check if this all this new memory is necessary (maybe you left old unused buffers).

Then, when you are sure about your implementation, you can increase the RAM allocated to SE in the linker file that is the SE_RAM_Region.

Best regards

Jocelyn