cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 cryptolib issue.

SwastiK
Associate

Hi guys i am trying to use stm32cryptolib library's encryption function. the main problem i am facing when i am trying to call the  cmox_initialize function it is giving the error 

cmox_init.c:(.text+0x1a): undefined reference to `cmox_ll_init'

collect2.exe: error: ld returned 1 exit status

make: *** [makefile:64: crypto.elf] Error 1

"make -j8 all" terminated with exit code 2. Build might be incomplete.

but it is strange although i have included the include file to path under which it's .h comes.

The other err which i am facing that is this function written below is not returning CMOX_HASH_SUCCESS

cmox_mac_retval_t ret_val = cmox_mac_compute(

CMOX_HMAC_SHA256_ALGO, // Algorithm

message, sizeof(message)-1, // Message and its length

(const uint8_t *)key, strlen(key), // Key and its length

NULL, 0, // No custom data

hmac_bin, sizeof(hmac_bin), // Output tag and expected size

&tag_len // Output tag length pointer

);

 

5 REPLIES 5
Enihr90
Associate

Any solution suggestions? We are facing the same issue.

Include files typically don't pull in code, they define the interface expectations. It's not complaining it can't find the include file.. The linker is complaining it can't find the function in the object files it's been passed.

So missing the source file, or library file, containing the actual code for the function. So add that into the project build tree.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Imen.D
ST Employee

Hello @SwastiK 

Which STM32CubeIDE and package versions are you using ? Please make sure to use the latest release.

Check the include paths and make sure that you have added all required CMOX library files.

This article may help you to integrate the CRYPTOLIB library in STM32CubeIDE: How to add external libraries in STM32CubeIDE.

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Hi

We have been able to get the library running with the new version of the IDE. However, bumping into a new issue now. The HMAC SHA256 signature that is being generated by the library is not matching with the ones that we are checking online. We have tried generating the signature with the same string and key on different platforms available on the internet, and the signatures all match. However the one being generated using the library.

 

I have attached the code snippet for reference 

 

Received Output : aee0ab2b6302b529b7873bac798718f3a17bce27a0c0906b3e299942b9262bff                                 

Required Output : b2793ffb929310a28134164a5ef650bdeb422fb34233f493fe323a60fbede10c