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

undefined reference to AES oberon implementation when integrate oberon back end in samples/hello_world board nrf9160dk_nrf9160

Hi,

I am a new comer and I try to customize  samples/hello word projet

I am using nrf Connect v3.4.2 on Windows. 

I try to perform a basic AES operation in main.c (based on mbedtls_aes_init, mbedtls_aes_setkey_enc, mbedtls_aes_crypt_cbc, mbedtls_aes_free)

On first building,  I had an issue with MBEDTLS_CONFIG_FILE which only contains a relative path and so with all "#include MBEDTLS_CONFIG_FILE" lines in mbedtls files (aes.c...)

I manually replace #include MBEDTLS_CONFIG_FILE by #include "absolutPath/nrfxlib\nrf_security\include\nrf-config.h"

and I successfully build a project with only Vanilla as back end for Nordic Security module

Here an subset of successful obtained .config:

CONFIG_NRFXLIB_CRYPTO=y
CONFIG_NRF_OBERON=y
# CONFIG_HW_CC310_INTERRUPT is not set
CONFIG_NRF_CC310_PLATFORM=y
# end of Crypto libraries for nRF5x SOCs.

#
# Nordic Security
#
CONFIG_NORDIC_SECURITY_BACKEND=y

#
# mbed TLS Configuration File
#
CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h"
CONFIG_GENERATE_MBEDTLS_CFG_FILE=y
# CONFIG_MBEDTLS_X509_LIBRARY is not set
# CONFIG_MBEDTLS_TLS_LIBRARY is not set

#
# mbed TLS memory configuration
#
# CONFIG_MBEDTLS_ENABLE_HEAP is not set
# end of mbed TLS memory configuration

#
# Backend Selection
#
# CONFIG_CC310_BACKEND is not set
# CONFIG_OBERON_BACKEND is not set
CONFIG_MBEDTLS_VANILLA_BACKEND=y
CONFIG_MBEDTLS_CIPHER_AES_256_ECB_C=y
CONFIG_MBEDTLS_CIPHER_AES_256_CBC_C=y

#
# Configuration section
#
# CONFIG_NRF_SECURITY_RNG is not set
CONFIG_MBEDTLS_AES_C=y

But, if I try to use AES oberon implementation, the link fails:

1> ...\zephyr\samples\hello_world\build_nrf9160dk_nrf9160/../src/main.c:22: undefined reference to `mbedtls_aes_init'
1> ...../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ...\zephyr\samples\hello_world\build_nrf9160dk_nrf9160/../src/main.c:24: undefined reference to `mbedtls_aes_setkey_enc'
1> ...../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ...\zephyr\samples\hello_world\build_nrf9160dk_nrf9160/../src/main.c:33: undefined reference to `mbedtls_aes_crypt_cbc'
1> ...../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: ...\zephyr\samples\hello_world\build_nrf9160dk_nrf9160/../src/main.c:45: undefined reference to `mbedtls_aes_free'
1> collect2.exe: error: ld returned 1 exit status

(I also need to update absolute path to new mebdts config file: nrf_security\include\nrf-config-noglue-oberon.h")

Here an subset of updated .config:

CONFIG_NRFXLIB_CRYPTO=y
CONFIG_NRF_OBERON=y
# CONFIG_HW_CC310_INTERRUPT is not set
CONFIG_NRF_CC310_PLATFORM=y
# end of Crypto libraries for nRF5x SOCs.

#
# Nordic Security
#
CONFIG_NORDIC_SECURITY_BACKEND=y

#
# mbed TLS Configuration File
#
CONFIG_MBEDTLS_CFG_FILE="config-tls-generic.h"
CONFIG_GENERATE_MBEDTLS_CFG_FILE=y
# CONFIG_MBEDTLS_X509_LIBRARY is not set
# CONFIG_MBEDTLS_TLS_LIBRARY is not set

#
# mbed TLS memory configuration
#
# CONFIG_MBEDTLS_ENABLE_HEAP is not set
# end of mbed TLS memory configuration

#
# Backend Selection
#
# CONFIG_CC310_BACKEND is not set
CONFIG_OBERON_BACKEND=y
CONFIG_MBEDTLS_VANILLA_BACKEND=y
CONFIG_NRF_CRYPTO_BACKEND_COMBINATION_0=y
CONFIG_MBEDTLS_CIPHER_AES_256_ECB_C=y
CONFIG_MBEDTLS_CIPHER_AES_256_CBC_C=y

#
# Configuration section
#
# CONFIG_NRF_SECURITY_RNG is not set
CONFIG_OBERON_ALTERNATE_AES_KEY_ENC=y
CONFIG_MBEDTLS_AES_C=y

#
# General AES Backend Selection
#
CONFIG_OBERON_MBEDTLS_AES_C=y
# CONFIG_VANILLA_MBEDTLS_AES_C is not set

#
# Cipher Selection
#
CONFIG_OBERON_MBEDTLS_CIPHER_MODE_CBC=y
CONFIG_MBEDTLS_CIPHER_MODE_CBC=y

Is there something wrong or something missing in my .config file?

Thanks in advance for your help.

JeanFi

Parents Reply Children
No Data
Related