Arm Mbed and Pelion Device Management support forum

Errors in compiling Crypto Example Code on NUCLEO-L152RE

I am trying to run the crypto example code (https://github.com/ARMmbed/mbed-os-example-mbed-crypto) on NUCLEO-L152RE. The program is compiled correctly but I am getting error in linking as shown in the attached screenshots. Can someone please check it and let me know what is wrong? I think there is a problem in configuration.

Error Log

Compile [ 95.5%]: stm32l1xx_ll_i2c.c
Compile [ 95.7%]: stm32l1xx_ll_gpio.c
Compile [ 95.8%]: stm32l1xx_ll_opamp.c
Compile [ 95.9%]: stm32l1xx_ll_pwr.c
Compile [ 96.0%]: stm32l1xx_ll_rcc.c
Compile [ 96.1%]: stm32l1xx_ll_sdmmc.c
Compile [ 96.2%]: stm32l1xx_ll_spi.c
Compile [ 96.3%]: stm32l1xx_ll_rtc.c
Compile [ 96.5%]: stm32l1xx_ll_tim.c
Compile [ 96.6%]: system_stm32l1xx.c
Compile [ 96.7%]: stm32l1xx_ll_usart.c
Compile [ 96.8%]: stm32l1xx_ll_utils.c
Compile [ 96.9%]: USBPhy_STM32.cpp
Compile [ 97.0%]: flash_api.c
Compile [ 97.1%]: gpio_irq_device.c
Compile [ 97.3%]: pwmout_device.c
Compile [ 97.4%]: analogin_api.c
Compile [ 97.5%]: spi_api.c
Compile [ 97.6%]: analogout_api.c
Compile [ 97.7%]: can_api.c
Compile [ 97.8%]: serial_device.c
Compile [ 97.9%]: gpio_api.c
Compile [ 98.1%]: gpio_irq_api.c
Compile [ 98.2%]: hal_tick_overrides.c
Compile [ 98.3%]: qspi_api.c
Compile [ 98.4%]: mbed_crc_api.c
Compile [ 98.5%]: mbed_overrides.c
Compile [ 98.6%]: lp_ticker.c
Compile [ 98.7%]: pinmap.c
Compile [ 98.9%]: i2c_api.c
[Warning] i2c_api.c@565,19: unused variable ‘obj_s’ [-Wunused-variable]
Compile [ 99.0%]: port_api.c
Compile [ 99.1%]: trng_api.c
Compile [ 99.2%]: reset_reason.c
Compile [ 99.3%]: pwmout_api.c
Compile [ 99.4%]: sleep.c
Compile [ 99.5%]: rtc_api.c
Compile [ 99.7%]: serial_api.c
Compile [ 99.8%]: us_ticker.c
Compile [ 99.9%]: watchdog_api.c
Compile [100.0%]: stm_spi_api.c
[Warning] stm_spi_api.c@108,13: unused variable ‘pin’ [-Wunused-variable]
Link: getting-started
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_import_key_into_slot': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:743: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_sign_hash': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3333: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5548: more undefined references to mbedtls_ctr_drbg_random’ follow
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_free' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_func’
collect2.exe: error: ld returned 1 exit status
[ERROR] c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_import_key_into_slot': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:743: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_sign_hash': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3333: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5548: more undefined references to mbedtls_ctr_drbg_random’ follow
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_free' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5721: undefined reference to mbedtls_entropy_func’
collect2.exe: error: ld returned 1 exit status

[mbed] ERROR: “C:\Python27\python.exe” returned error.
Code: 1
Path: “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started”
Command: “C:\Python27\python.exe -u D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started\mbed-os\tools\make.py -t GCC_ARM -m NUCLEO_L152RE --source . --build .\BUILD\NUCLEO_L152RE\GCC_ARM”
Tip: You could retry the last command with “-v” flag for verbose output


Hi @aisha11,
Thank you for your question.

Do you have MBEDTLS_CTR_DRBG_C and MBEDTLS_ENTROPY_C defined in your configuration?
Regards,
Mbed TLS Support
Ron

Hi Ron,

In mbedtls_user_config.h file (which is on the root of getting-started directory), only 'MBEDTLS_PSA_CRYPTO_C 'is defined as follows:

/* Enable PSA APIs, which this example depends on. */
#if !defined(MBEDTLS_PSA_CRYPTO_C)

define MBEDTLS_PSA_CRYPTO_C

#endif

Where shall I define these two MBEDTLS_CTR_DRBG_C and MBEDTLS_ENTROPY_C and how?

Hi @aisha11

Please check if these are defined in getting-started/mbed-os/features/mbedtls/inc/mbedtls/config.h.
If not, you can define them in mbedtls_user_config.h as well.

If they are defined, please show symbols of ctr_drbg.o and entropy.o
Regards

MBEDTLS_CTR_DRBG_C and MBEDTLS_ENTROPY_C are defined in ‘getting-started/mbed-os/features/mbedtls/inc/mbedtls/config.h’ .

The symbols for ctr_drbg.o are as follows:

ctr_drbg.o

7f45 4c46 0101 0100 0000 0000 0000 0000
0100 2800 0100 0000 0000 0000 0000 0000
8005 0000 0000 0005 3400 0000 0000 2800
1000 0f00 6700 0000 0400 0000 0000 0401
4400 0000 0c4c 0100 0082 0100 0000 0000
0002 0106 db01 0000 0201 083e 0100 0002
0205 f301 0000 0202 07c8 0100 0002 0405
bf01 0000 0204 071b 0000 0002 0805 0000
0000 0208 072d 0000 0003 0405 696e 7400
0204 070e 0000 0002 0804 e701 0000 0001
1101 250e 130b 030e 1b0e 1017 0000 0224
000b 0b3e 0b03 0e00 0003 2400 0b0b 3e0b
0308 0000 0014 0000 0002 0000 0000 0004
0000 0000 0000 0000 0000 0000 0019 0000
0003 0013 0000 0002 01fb 0e0d 0001 0101
0100 0000 0100 0001 0000 6c6f 6e67 206c
6f6e 6720 696e 7400 756e 7369 676e 6564
2069 6e74 006c 6f6e 6720 756e 7369 676e
6564 2069 6e74 006c 6f6e 6720 6c6f 6e67
2075 6e73 6967 6e65 6420 696e 7400 474e
5520 4331 3120 392e 322e 3120 3230 3139
3130 3235 2028 7265 6c65 6173 6529 205b
4152 4d2f 6172 6d2d 392d 6272 616e 6368
2072 6576 6973 696f 6e20 3237 3735 3939
5d20 2d6d 6370 753d 636f 7274 6578 2d6d
3320 2d6d 7468 756d 6220 2d6d 666c 6f61
742d 6162 693d 736f 6674 202d 6d61 7263
683d 6172 6d76 372d 6d20 2d67 202d 4f73
202d 7374 643d 676e 7531 3120 2d66 6d65
7373 6167 652d 6c65 6e67 7468 3d30 202d
666e 6f2d 6578 6365 7074 696f 6e73 202d
6666 756e 6374 696f 6e2d 7365 6374 696f
6e73 202d 6664 6174 612d 7365 6374 696f
6e73 202d 6675 6e73 6967 6e65 642d 6368
6172 202d 666f 6d69 742d 6672 616d 652d
706f 696e 7465 7200 756e 7369 676e 6564
2063 6861 7200 2e5c 6d62 6564 2d6f 735c
6665 6174 7572 6573 5c6d 6265 6474 6c73
5c6d 6265 642d 6372 7970 746f 5c73 7263
5c63 7472 5f64 7262 672e 6300 443a 5c4d
6265 6457 6f72 6b53 7061 6365 5c6d 6265
642d 6f73 2d65 7861 6d70 6c65 2d6d 6265
642d 6372 7970 746f 5c67 6574 7469 6e67
2d73 7461 7274 6564 006c 6f6e 6720 696e
7400 7368 6f72 7420 756e 7369 676e 6564
2069 6e74 0073 6967 6e65 6420 6368 6172
006c 6f6e 6720 646f 7562 6c65 0073 686f
7274 2069 6e74 0000 4743 433a 2028 474e
5520 546f 6f6c 7320 666f 7220 4172 6d20
456d 6265 6464 6564 2050 726f 6365 7373
6f72 7320 392d 3230 3139 2d71 342d 6d61
6a6f 7229 2039 2e32 2e31 2032 3031 3931
3032 3520 2872 656c 6561 7365 2920 5b41
524d 2f61 726d 2d39 2d62 7261 6e63 6820
7265 7669 7369 6f6e 2032 3737 3539 395d
0041 3200 0000 6165 6162 6900 0128 0000
0005 436f 7274 6578 2d4d 3300 060a 074d
0902 1204 1401 1501 1703 1801 1901 1a01
1e04 2201 0000 0000 0000 0000 0000 0000
0000 0000 0100 0000 0000 0000 0000 0000
0400 f1ff 0000 0000 0000 0000 0000 0000
0300 0100 0000 0000 0000 0000 0000 0000
0300 0200 0000 0000 0000 0000 0000 0000
0300 0300 0000 0000 0000 0000 0000 0000
0300 0400 0000 0000 0000 0000 0000 0000
0300 0600 0000 0000 0000 0000 0000 0000
0300 0700 0000 0000 0000 0000 0000 0000
0300 0900 0000 0000 0000 0000 0000 0000
0300 0a00 0000 0000 0000 0000 0000 0000
0300 0b00 0000 0000 0000 0000 0000 0000
0300 0c00 0063 7472 5f64 7262 672e 6300
0600 0000 0206 0000 0c00 0000 0209 0000
1100 0000 0209 0000 1500 0000 0209 0000
1900 0000 0208 0000 2000 0000 0209 0000
2700 0000 0209 0000 2e00 0000 0209 0000
3500 0000 0209 0000 3c00 0000 0209 0000
4300 0000 0209 0000 4a00 0000 0209 0000
5100 0000 0209 0000 5f00 0000 0209 0000
6600 0000 0209 0000 0600 0000 0205 0000
002e 7379 6d74 6162 002e 7374 7274 6162
002e 7368 7374 7274 6162 002e 7465 7874
002e 6461 7461 002e 6273 7300 2e72 656c
2e64 6562 7567 5f69 6e66 6f00 2e64 6562
7567 5f61 6262 7265 7600 2e72 656c 2e64
6562 7567 5f61 7261 6e67 6573 002e 6465
6275 675f 6c69 6e65 002e 6465 6275 675f
7374 7200 2e63 6f6d 6d65 6e74 002e 4152
4d2e 6174 7472 6962 7574 6573 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 1b00 0000 0100 0000
0600 0000 0000 0000 3400 0000 0000 0000
0000 0000 0000 0000 0200 0000 0000 0000
2100 0000 0100 0000 0300 0000 0000 0000
3400 0000 0000 0000 0000 0000 0000 0000
0100 0000 0000 0000 2700 0000 0800 0000
0300 0000 0000 0000 3400 0000 0000 0000
0000 0000 0000 0000 0100 0000 0000 0000
3000 0000 0100 0000 0000 0000 0000 0000
3400 0000 6b00 0000 0000 0000 0000 0000
0100 0000 0000 0000 2c00 0000 0900 0000
4000 0000 0000 0000 7004 0000 7800 0000
0d00 0000 0400 0000 0400 0000 0800 0000
3c00 0000 0100 0000 0000 0000 0000 0000
9f00 0000 2600 0000 0000 0000 0000 0000
0100 0000 0000 0000 4e00 0000 0100 0000
0000 0000 0000 0000 c500 0000 1800 0000
0000 0000 0000 0000 0100 0000 0000 0000
4a00 0000 0900 0000 4000 0000 0000 0000
e804 0000 0800 0000 0d00 0000 0700 0000
0400 0000 0800 0000 5d00 0000 0100 0000
0000 0000 0000 0000 dd00 0000 1d00 0000
0000 0000 0000 0000 0100 0000 0000 0000
6900 0000 0100 0000 3000 0000 0000 0000
fa00 0000 fd01 0000 0000 0000 0000 0000
0100 0000 0100 0000 7400 0000 0100 0000
3000 0000 0000 0000 f702 0000 7a00 0000
0000 0000 0000 0000 0100 0000 0100 0000
7d00 0000 0300 0070 0000 0000 0000 0000
7103 0000 3300 0000 0000 0000 0000 0000
0100 0000 0000 0000 0100 0000 0200 0000
0000 0000 0000 0000 a403 0000 c000 0000
0e00 0000 0c00 0000 0400 0000 1000 0000
0900 0000 0300 0000 0000 0000 0000 0000
6404 0000 0c00 0000 0000 0000 0000 0000
0100 0000 0000 0000 1100 0000 0300 0000
0000 0000 0000 0000 f004 0000 8d00 0000
0000 0000 0000 0000 0100 0000 0000 0000

entropy.o

7f45 4c46 0101 0100 0000 0000 0000 0000
0100 2800 0100 0000 0000 0000 0000 0000
8005 0000 0000 0005 3400 0000 0000 2800
1000 0f00 6700 0000 0400 0000 0000 0401
4400 0000 0cc7 0100 0055 0100 0000 0000
0002 0106 a501 0000 0201 083e 0100 0002
0205 bd01 0000 0202 0792 0100 0002 0405
4c01 0000 0204 071b 0000 0002 0805 0000
0000 0208 072d 0000 0003 0405 696e 7400
0204 070e 0000 0002 0804 b101 0000 0001
1101 250e 130b 030e 1b0e 1017 0000 0224
000b 0b3e 0b03 0e00 0003 2400 0b0b 3e0b
0308 0000 0014 0000 0002 0000 0000 0004
0000 0000 0000 0000 0000 0000 0019 0000
0003 0013 0000 0002 01fb 0e0d 0001 0101
0100 0000 0100 0001 0000 6c6f 6e67 206c
6f6e 6720 696e 7400 756e 7369 676e 6564
2069 6e74 006c 6f6e 6720 756e 7369 676e
6564 2069 6e74 006c 6f6e 6720 6c6f 6e67
2075 6e73 6967 6e65 6420 696e 7400 474e
5520 4331 3120 392e 322e 3120 3230 3139
3130 3235 2028 7265 6c65 6173 6529 205b
4152 4d2f 6172 6d2d 392d 6272 616e 6368
2072 6576 6973 696f 6e20 3237 3735 3939
5d20 2d6d 6370 753d 636f 7274 6578 2d6d
3320 2d6d 7468 756d 6220 2d6d 666c 6f61
742d 6162 693d 736f 6674 202d 6d61 7263
683d 6172 6d76 372d 6d20 2d67 202d 4f73
202d 7374 643d 676e 7531 3120 2d66 6d65
7373 6167 652d 6c65 6e67 7468 3d30 202d
666e 6f2d 6578 6365 7074 696f 6e73 202d
6666 756e 6374 696f 6e2d 7365 6374 696f
6e73 202d 6664 6174 612d 7365 6374 696f
6e73 202d 6675 6e73 6967 6e65 642d 6368
6172 202d 666f 6d69 742d 6672 616d 652d
706f 696e 7465 7200 756e 7369 676e 6564
2063 6861 7200 6c6f 6e67 2069 6e74 0044
3a5c 4d62 6564 576f 726b 5370 6163 655c
6d62 6564 2d6f 732d 6578 616d 706c 652d
6d62 6564 2d63 7279 7074 6f5c 6765 7474
696e 672d 7374 6172 7465 6400 7368 6f72
7420 756e 7369 676e 6564 2069 6e74 0073
6967 6e65 6420 6368 6172 006c 6f6e 6720
646f 7562 6c65 0073 686f 7274 2069 6e74
002e 5c6d 6265 642d 6f73 5c66 6561 7475
7265 735c 6d62 6564 746c 735c 6d62 6564
2d63 7279 7074 6f5c 7372 635c 656e 7472
6f70 792e 6300 0047 4343 3a20 2847 4e55
2054 6f6f 6c73 2066 6f72 2041 726d 2045
6d62 6564 6465 6420 5072 6f63 6573 736f
7273 2039 2d32 3031 392d 7134 2d6d 616a
6f72 2920 392e 322e 3120 3230 3139 3130
3235 2028 7265 6c65 6173 6529 205b 4152
4d2f 6172 6d2d 392d 6272 616e 6368 2072
6576 6973 696f 6e20 3237 3735 3939 5d00
4132 0000 0061 6561 6269 0001 2800 0000
0543 6f72 7465 782d 4d33 0006 0a07 4d09
0212 0414 0115 0117 0318 0119 011a 011e
0422 0100 0000 0000 0000 0000 0000 0000
0000 0000 0100 0000 0000 0000 0000 0000
0400 f1ff 0000 0000 0000 0000 0000 0000
0300 0100 0000 0000 0000 0000 0000 0000
0300 0200 0000 0000 0000 0000 0000 0000
0300 0300 0000 0000 0000 0000 0000 0000
0300 0400 0000 0000 0000 0000 0000 0000
0300 0600 0000 0000 0000 0000 0000 0000
0300 0700 0000 0000 0000 0000 0000 0000
0300 0900 0000 0000 0000 0000 0000 0000
0300 0a00 0000 0000 0000 0000 0000 0000
0300 0b00 0000 0000 0000 0000 0000 0000
0300 0c00 0065 6e74 726f 7079 2e63 0000
0600 0000 0206 0000 0c00 0000 0209 0000
1100 0000 0209 0000 1500 0000 0209 0000
1900 0000 0208 0000 2000 0000 0209 0000
2700 0000 0209 0000 2e00 0000 0209 0000
3500 0000 0209 0000 3c00 0000 0209 0000
4300 0000 0209 0000 4a00 0000 0209 0000
5100 0000 0209 0000 5f00 0000 0209 0000
6600 0000 0209 0000 0600 0000 0205 0000
002e 7379 6d74 6162 002e 7374 7274 6162
002e 7368 7374 7274 6162 002e 7465 7874
002e 6461 7461 002e 6273 7300 2e72 656c
2e64 6562 7567 5f69 6e66 6f00 2e64 6562
7567 5f61 6262 7265 7600 2e72 656c 2e64
6562 7567 5f61 7261 6e67 6573 002e 6465
6275 675f 6c69 6e65 002e 6465 6275 675f
7374 7200 2e63 6f6d 6d65 6e74 002e 4152
4d2e 6174 7472 6962 7574 6573 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 1b00 0000 0100 0000
0600 0000 0000 0000 3400 0000 0000 0000
0000 0000 0000 0000 0200 0000 0000 0000
2100 0000 0100 0000 0300 0000 0000 0000
3400 0000 0000 0000 0000 0000 0000 0000
0100 0000 0000 0000 2700 0000 0800 0000
0300 0000 0000 0000 3400 0000 0000 0000
0000 0000 0000 0000 0100 0000 0000 0000
3000 0000 0100 0000 0000 0000 0000 0000
3400 0000 6b00 0000 0000 0000 0000 0000
0100 0000 0000 0000 2c00 0000 0900 0000
4000 0000 0000 0000 7004 0000 7800 0000
0d00 0000 0400 0000 0400 0000 0800 0000
3c00 0000 0100 0000 0000 0000 0000 0000
9f00 0000 2600 0000 0000 0000 0000 0000
0100 0000 0000 0000 4e00 0000 0100 0000
0000 0000 0000 0000 c500 0000 1800 0000
0000 0000 0000 0000 0100 0000 0000 0000
4a00 0000 0900 0000 4000 0000 0000 0000
e804 0000 0800 0000 0d00 0000 0700 0000
0400 0000 0800 0000 5d00 0000 0100 0000
0000 0000 0000 0000 dd00 0000 1d00 0000
0000 0000 0000 0000 0100 0000 0000 0000
6900 0000 0100 0000 3000 0000 0000 0000
fa00 0000 fc01 0000 0000 0000 0000 0000
0100 0000 0100 0000 7400 0000 0100 0000
3000 0000 0000 0000 f602 0000 7a00 0000
0000 0000 0000 0000 0100 0000 0100 0000
7d00 0000 0300 0070 0000 0000 0000 0000
7003 0000 3300 0000 0000 0000 0000 0000
0100 0000 0000 0000 0100 0000 0200 0000
0000 0000 0000 0000 a403 0000 c000 0000
0e00 0000 0c00 0000 0400 0000 1000 0000
0900 0000 0300 0000 0000 0000 0000 0000
6404 0000 0b00 0000 0000 0000 0000 0000
0100 0000 0000 0000 1100 0000 0300 0000
0000 0000 0000 0000 f004 0000 8d00 0000
0000 0000 0000 0000 0100 0000 0000 0000

Hi @aisha11

Please run arm-none-eabi-nm on these “.o” files to get the symbols.

Hi,

I do not know how to run this. I tried like this, ‘arm-none-eabi-nm ctr_drbg.o’, but there is no output.

There is no output

This is probably because the debug symbols were stripped.
Pleasae try building with debug profile.( add the parameter --profile=mbed-os/tools/profiles/debug.json to your build command), and run the arm-none-eabi-nm command as well.
Regards

Hi Ron, I just compiled again by using debug profile. I am getting the same errors in linking. Here is the error log.

D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started>mbed compile --target NUCLEO_L152RE --toolchain GCC_ARM --profile=mbed-os\tools\profiles\debug.json
[mbed] Working path “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started” (library)
[mbed] Program path “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started”
Building project getting-started (NUCLEO_L152RE, GCC_ARM)
Scan: getting-started
[Warning] stm_spi_api.c@108,13: unused variable ‘pin’ [-Wunused-variable]
Link: getting-started
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_import_ec_private_key': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:655: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_rsa_sign': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3149: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_ecdsa_sign': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3278: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: more undefined references to mbedtls_ctr_drbg_random' follow c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_func' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to `mbedtls_entropy_free’
collect2.exe: error: ld returned 1 exit status

[ERROR] c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function `psa_import_ec_private_key’:

D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:655: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_rsa_sign’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3149: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_ecdsa_sign’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3278: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_cipher_generate_iv’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:3811: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_generate_random’:
D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5376: undefined reference to mbedtls_ctr_drbg_random' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o:D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5385: more undefined references to mbedtls_ctr_drbg_random’ follow
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function mbedtls_psa_crypto_free': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5612: undefined reference to mbedtls_ctr_drbg_free’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: BUILD/NUCLEO_L152RE/GCC_ARM-DEBUG/mbed-os/features/mbedtls/mbed-crypto/platform/COMPONENT_PSA_SRV_IMPL/psa_crypto.o: in function psa_crypto_init': D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5679: undefined reference to mbedtls_ctr_drbg_init’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5681: undefined reference to mbedtls_ctr_drbg_seed' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_func’
c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/…/lib/gcc/arm-none-eabi/9.2.1/…/…/…/…/arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_init' c:/program files (x86)/gnu tools arm embedded/9 2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.exe: D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started/.\mbed-os\features\mbedtls\mbed-crypto\platform\COMPONENT_PSA_SRV_IMPL/psa_crypto.c:5659: undefined reference to mbedtls_entropy_free’

collect2.exe: error: ld returned 1 exit status

[mbed] ERROR: “C:\Python27\python.exe” returned error.
Code: 1
Path: “D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started”
Command: “C:\Python27\python.exe -u D:\MbedWorkSpace\mbed-os-example-mbed-crypto\getting-started\mbed-os\tools\make.py -t GCC_ARM -m NUCLEO_L152RE --profile mbed-os\tools\profiles\debug.json --source . --build .\BUILD\NUCLEO_L152RE\GCC_ARM-DEBUG”
Tip: You could retry the last command with “-v” flag for verbose output

After that I have also used ‘arm-none-eabi-nm’ on ctr_drbg.o and entropy.o

The generated symbols are as follows:

ctr_drbg.o

00000000 n wm4._default_types.h.15.247e5cd201eca3442cbf5404108c4935
00000000 n wm4._newlib_version.h.4.9ba035841e762c3308916a0ce96032e7
00000000 n wm4.0.13373c2a93e04b96ed7012d09ab0c769
00000000 n wm4.cdefs.h.49.6260d97adb8d27534cbdc0f868b8ea87
00000000 n wm4.confignoentropy.h.35.96eb0f6d7aaf3df1b8fc3fb7cd79a961
00000000 n wm4.features.h.22.fad1cec3bc7ff06488171438dbdcfd02
00000000 n wm4.limits.h.60.56a1ae353e2028a24298ec6463b8b593
00000000 n wm4.limits.h.9.70fb0ada6f71b16202a66baaa6d8ea70
00000000 n wm4.mbed_config.h.22.2ce16fc66137e8f33da69b29ea1c692f
00000000 n wm4.newlib.h.18.5e5ca3429233af402d406a202f1fc1ac
00000000 n wm4.platform_mbed.h.22.412e891783591d0749750919e850d197
00000000 n wm4.stddef.h.39.144cf5ddcd53cbfdac30259dc1a6c87f
00000000 n wm4.syslimits.h.38.a5cadcb164df32bfe95032c693331b67

entropy.o

00000000 n wm4._default_types.h.15.247e5cd201eca3442cbf5404108c4935
00000000 n wm4._newlib_version.h.4.9ba035841e762c3308916a0ce96032e7
00000000 n wm4.0.13373c2a93e04b96ed7012d09ab0c769
00000000 n wm4.cdefs.h.49.6260d97adb8d27534cbdc0f868b8ea87
00000000 n wm4.confignoentropy.h.35.96eb0f6d7aaf3df1b8fc3fb7cd79a961
00000000 n wm4.features.h.22.fad1cec3bc7ff06488171438dbdcfd02
00000000 n wm4.limits.h.60.56a1ae353e2028a24298ec6463b8b593
00000000 n wm4.limits.h.9.70fb0ada6f71b16202a66baaa6d8ea70
00000000 n wm4.mbed_config.h.22.2ce16fc66137e8f33da69b29ea1c692f
00000000 n wm4.newlib.h.18.5e5ca3429233af402d406a202f1fc1ac
00000000 n wm4.platform_mbed.h.22.412e891783591d0749750919e850d197
00000000 n wm4.stddef.h.39.144cf5ddcd53cbfdac30259dc1a6c87f
00000000 n wm4.syslimits.h.38.a5cadcb164df32bfe95032c693331b67

Hi @aisha11
As you can see from the symbols, the configuration file that is used is " confignoentropy.h"

This is because:

#if !defined(MBEDTLS_ENTROPY_HARDWARE_ALT) && !defined(MBEDTLS_TEST_NULL_ENTROPY) && \
    !defined(MBEDTLS_ENTROPY_NV_SEED)

And your target doesn’t have an existing entropy source ported.
Regards

1 Like

Hi Ron, thanks for your reply. So, how can I resolve it?

Hi @aisha,
If you need this for development and test purposes only, you could try adding MBEDTLS_TEST_NULL_ENTROPY in your mbedtls_user_config.h file. However, this is not secure.
Since the platform doesn’t have an entropy source, you could consider porting an NV seed
If this is not feasible, then you should consider using a different target.
Regards

Hi Ron, many thanks for your reply. Can you please recommend some targets which are suitable for running the Mbed Crypto and Mbed TLS. I want to work on a device with similar specs.

Hi @aisha11
Here you will find Mbed OS supported boards, which have TRNG enabled
Regards

1 Like

Thank you for your support