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

NRF_ERROR_CRYPTO_INTERNAL with arm-oe-linux-gnueabi-g++ -mthumb

Hi,

I am writing C/C++ programs running on open-embedded boards to talk through pc-ble-driver (v4.1.1) to bond (Security mode 1 level 4) with PCA10040 or PCA10056.

I found an interesting bug which I cannot understand:

If I compile the C++11 program with '-mthumb' option using arm-oe-linux-gnueabi-g++, both PCA10040 (oberon backend) and PCA10056 (CC310 backend) will fail (NRF_ERROR_CRYPTO_INTERNAL) on nrf_crypto_ecdh_compute() in nrf_ble_lesc. But if I remove '-mthumb' option, then everything is fine.

Counterpart C program compiled with arm-oe-linux-gnueabi-gcc does not have the same bug even '-mthumb' option is given.

Any idea why Thumb instruction can impact the nRF crypto libs?

Thanks & Best regards,

Chencheng

Parents Reply Children
  • No, I am not porting crypto module to host.

    My setup is:

    1. ble central program on host based on openembedded linux, with integrated pc-ble-driver running via PCA10059.

    2. ble peripherals program running on PCA10040 with oberon backend and PCA10056 with CC310 backend. They are just minor modification from Nordic SDK 15, but with Security mode 1 Level 4.

    So the bug happens on the central side programs. I have two versions of the program doing the same thing, one in C, one in C++11.

    The C program compiled by openembedded gcc compiler with thumb instruction option. No bug.

    The C++11 program compiled by openembedded g++ compiler with thumb instruction option. Bug shows as on peripheral devices as NRF_ERROR_CRYPTO_INTERNAL.

    The C++11 program compiled by openembedded g++ compiler without thumb instruction option. No bug.

    I hardly has clue how thumb instruction is impacting peripheral behavior.

    BR/Chencheng

  • Thanks for the clarification. Unfortunately, I'm not sure what causes the bug to occur when you set the thumb option. To find out I think you will have to debug the app and see which step of the key exchange is different.

    It's recommended to use the  'gcc-arm-none-eabi-' releases specified in the SDK release notes.

  • Thanks for your concern.

    Unfortunately, something wrong intermittently happened with my setup that caused this bug.

    Now I have no problem with using thumb instruction.

    Sorry for the trouble. I will close the ticket for now.

    BR/Chencheng

Related