This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

mbedtls_aes error

Hi all,

I tried to merge a mesh application into the nRF5 SDK BLE example.

But, I have encountered the errors below:

"Output/........... Debug/Obj/ctr_drbg.o: In function `mbedtls_ctr_drbg_seed_entropy_len':
undefined reference to `mbedtls_aes_init'
undefined reference to `mbedtls_aes_setkey_enc'
Output/........... Debug/Obj/ctr_drbg.o: In function `mbedtls_ctr_drbg_free':
undefined reference to `mbedtls_aes_free'
Output/........... Debug/Obj/ctr_drbg.o: In function `block_cipher_df':
undefined reference to `mbedtls_aes_init'
undefined reference to `mbedtls_aes_setkey_enc'
undefined reference to `mbedtls_aes_crypt_ecb'
undefined reference to `mbedtls_aes_setkey_enc'
undefined reference to `mbedtls_aes_crypt_ecb'
undefined reference to `mbedtls_aes_free'
Output/........... Debug/Obj/ctr_drbg.o: In function `ctr_drbg_update_internal':
undefined reference to `mbedtls_aes_crypt_ecb'
undefined reference to `mbedtls_aes_setkey_enc'
Output/........... Debug/Obj/ctr_drbg.o: In function `mbedtls_ctr_drbg_random_with_add':
undefined reference to `mbedtls_aes_crypt_ecb' "

I would like to know where it comes and how to fix it.

Many thanks in advance.

  • I think I understand the problem, but I do not know how to resolve.

    There are two files "aes.c", one in mesh/core and the other in nrF_TLS. I removed the file "aes.c" in nrF_TLS. and the file "ctr_drbg.c" in nrF_TLS is not compatible with the file "aes.c" in mesh/core.

  • Hi,

    Yes, two source files with the same name may be a problem, at least with some toolchains.

    No, taking one of the files out of the project is not a solution. The reason is those two files have different contents, and the contents from both may be needed when combining nRF5 SDK and nRF5 SDK for Mesh.

    What versions of the nRF5 SDK and the nRF5 SDK for Mesh are you merging?

    What toolchain are you using?

    For nRF5 SDK v15.2.0 and nRF5 SDK for Mesh v3.1.0 I can find one occurence of aes.c in each, at ./external/mbedtls/library/aes.c and at ./mesh/core/src/aes.c respectively.

    Please check that you use a set of nRF5 SDK and nRF5 SDK for Mesh that are compatible. Then instead of deleting the file from the nRF5 SDK, can you try renaming the file in the nRF5 SDK for Mesh and update the project file or makefile to use the new name, then see if that solves the issue?

    Regards,
    Terje

  • Hi Terje,

    I am using nRF5 SDK and nRF5 SDK for Mesh. I have realized the same way as SDK Proximity coexistence
    and SDK UART coexistence example.

    Yesterday, I have copied and renamed the "aes.c" file in mesh/core, I can build solution. But after that when flashing on the chip, it does not work and notifies error message from the first line: <error> app: ASSERTION FAILED at :0

  • Hi,

    The most common reason for an assertion of a newly programmed mesh example is that an area separate from the application area is used by the mesh stack to store the current configuration, and that area may still have data in it from previous use of the board. Make sure to erase flash on the board before programming it with the application, for instance with "nrfjprog -e".

    Regards,
    Terje

Related