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

I cannot build project for AES ECB based on M52840.

Hi,

I wish to use AES ECB based on M52840. I use ble_app_uart example as template.

I enabled NRF_CRYPTO_ENABLED, NRF_CRYPTO_BACKEND_CC310_ENABLED and NRF_CRYPTO_BACKEND_CC310_AES_ECB_ENABLED.

The following is snippet.

#include "nrf_crypto_aes.h"

EncryptAES128(uint8_t* AES_Key, uint8_t* Plaintext, uint8_t* Ciphertext)
{

...
uint32_t err_code;
size_t len_out = 16;
nrf_crypto_aes_context_t ecb_encr_ctx;

err_code = nrf_crypto_aes_crypt(&ecb_encr_ctx, &g_nrf_crypto_aes_ecb_128_info, NRF_CRYPTO_ENCRYPT,
AES_Key, NULL, Plaintext, 16, Ciphertext, &len_out);
APP_ERROR_CHECK(err_code);

...

}

SES said:

Output/ble_app_lock Debug/Obj/lock_crypto.o: In function `EncryptAES128':
undefined reference to `nrf_crypto_aes_crypt'
undefined reference to `g_nrf_crypto_aes_ecb_128_info'
Build failed

Could you help me?

Thanks,

Jianxuan

Parents
  • Hi Jianxuan,

    g_nrf_crypto_aes_ecb_128_info is defined in cc310_backend_aes.c, is this file included in your project? You may use the aes_all_cli (\examples\crypto\nrf_crypto\aes\aes_all_cli) example to find other dependencies you may have missed. Tip: open the *.emproject file in a text editor and copy&paste relevant dependencies to your project, I find it faster than doing it within the GUI. 

    Best regards,

    Vidar

  • Hi Vidar,

    Thanks for your reply!

    According to your advice, I copy c_user_include_directories from nrf_crypto_aes_pca10056.emProject and paste to my project. The same mistake is happened.

    I tried to build example of aes_all_cli, SES said:

    cannot find ../../../../../../../../external/micro-ecc/nrf52hf_armgcc/armgcc/micro_ecc_lib_nrf52.a: No such file or directory

     My SDK version is 15.2 and that of SES is 3.40.

    Thanks,

    Jianxuan

  • Hi Jianxuan,

    I have added nrf crypto/cc310 aes ecb to the ble_app_uart example in SDK 15.2.0 (ble_app_uart_cc310_aes.zip). You may "diff" sdk_config.h and the *emproject file against the original ble_app_uart example to see the changes I made. 

    uECC is an external dependency, you can follow the instructions provided in "micro ecc backend" if you want to install it. However, it is not needed since you intend to use the cc310 (the example include support for all backends). 

    Regards,

    Vidar

Reply Children
Related