Page 1 of 1

mbedcrypto lib unable to resolve external function

Posted: Fri Dec 02, 2022 6:37 pm
by gc-wesd
ESP-IDF v4.1.3
CPU: ESP32 Rev 3

I'm porting an application that builds in Linux using makefiles to Windows using cmake. The build almost succeeds except for the inability to coax the ESP-IDF mbedcrypto library to find a function located in our cryptoauthlib component.

The application CMakeLists.txt file includes this switch: add_compile_definitions(MBEDTLS_ECDSA_SIGN_ALT)
telling mbedtls to use the alternative signing function which is provided by cryptoauthlib. Using objdump I verify the function 'mbedtls_ecdsa_sign' is present in cryptoauthlib.

The build ends with this failure:

Code: Select all

cmd.exe /C "cd . && C:\Users\wesd\.espressif\tools\xtensa-esp32-elf\esp-2020r3-8.4.0\xtensa-esp32-elf\bin\xtensa-esp32-elf-g++.exe  -mlongcalls -Wno-frame-address   @CMakeFiles\ww-halo.elf.rsp  -o ww-halo.elf  && cd ."
c:/users/wesd/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a(ecdsa.c.obj):(.literal.ecdsa_sign_det_restartable+0x8): undefined reference to `mbedtls_ecdsa_sign'
c:/users/wesd/.espressif/tools/xtensa-esp32-elf/esp-2020r3-8.4.0/xtensa-esp32-elf/bin/../lib/gcc/xtensa-esp32-elf/8.4.0/../../../../xtensa-esp32-elf/bin/ld.exe: esp-idf/mbedtls/mbedtls/library/libmbedcrypto.a(ecdsa.c.obj): in function `ecdsa_sign_det_restartable':
C:/Users/wesd/dev/ww_halo/halo_fw/esp-idf/components/mbedtls/mbedtls/library/ecdsa.c:489: undefined reference to `mbedtls_ecdsa_sign'
collect2.exe: error: ld returned 1 exit status
I'm fairly new working with cmake - is there something I need to do to induce the ESP mbedcrypto library to seach cryptoauthlib? I'm trying to avoid changing any CMakeLists.txt files in the IDF, tree but maybe it's necessary?