Hi. I am working on a project and I need to encrypt, decrypt some data and also generate random numbers and diversified keys. I am using nrf52840 for my project and I use AES-CBC. I am using zephyr OS with ncs v2.5.0.
I have added following into my prj.conf file:
# Enable nordic security backend and PSA APIs CONFIG_NRF_SECURITY=y CONFIG_MBEDTLS_PSA_CRYPTO_C=y CONFIG_MBEDTLS_ENABLE_HEAP=y CONFIG_MBEDTLS_HEAP_SIZE=8192 CONFIG_PSA_WANT_GENERATE_RANDOM=y CONFIG_PSA_WANT_KEY_TYPE_AES=y CONFIG_PSA_WANT_ALG_CBC_NO_PADDING=y
But I am getting the following error:
[00:00:00.107,116] <err> crypto_drivers: psa_cipher_encrypt_setup failed! (Error: -134)
And, if I add the following in the prj.conf file in addition to the above configs:
CONFIG_PSA_CRYPTO_DRIVER_OBERON=n CONFIG_PSA_CRYPTO_DRIVER_CC3XX=y
then I get the following error:
[00:00:00.003,417] <err> os: ***** BUS FAULT ***** [00:00:00.003,417] <err> os: Precise data bus error [00:00:00.003,448] <err> os: BFAR Address: 0xfeccf804 [00:00:00.003,479] <err> os: r0/a1: 0xfeccf7f6 r1/a2: 0x00000000 r2/a3: 0x2000f398 [00:00:00.003,479] <err> os: r3/a4: 0xffffffff r12/ip: 0x00000cc2 r14/lr: 0x0003a867 [00:00:00.003,509] <err> os: xpsr: 0xa1000000 [00:00:00.003,540] <err> os: s[ 0]: 0x0000fff0 s[ 1]: 0x20019cc0 s[ 2]: 0x00000020 s[ 3]: 0x2000f548 [00:00:00.003,540] <err> os: s[ 4]: 0x2000f454 s[ 5]: 0x00000020 s[ 6]: 0x20019cc0 s[ 7]: 0x0001be07 [00:00:00.003,570] <err> os: s[ 8]: 0x0001bdc5 s[ 9]: 0x0004c69d s[10]: 0xaaaaaaaa s[11]: 0xaaaaaaaa [00:00:00.003,570] <err> os: s[12]: 0xaaaaaaaa s[13]: 0xaaaaaaaa s[14]: 0xaaaaaaaa s[15]: 0xaaaaaaaa [00:00:00.003,601] <err> os: fpscr: 0xaaaaaaaa [00:00:00.003,601] <err> os: Faulting instruction address (r15/pc): 0x0003a8d6 [00:00:00.003,662] <err> os: >>> ZEPHYR FATAL ERROR 25: Unknown error on CPU 0 [00:00:00.003,692] <err> os: Current thread: 0x20006028 (main) [00:00:00.460,723] <err> fatal_error: Resetting system
I tried their AES-CBC example and it is working. I copied the all the configs above mentioned from this example itself but I am not able to get it working in the multiprotocol example(openthread coap client).
EDIT:
I put my code in debug session because it is giving me bus fault and heres the callstack:
As you can see, I am getting this error even before my main function is getting executed. Any idea why this is happening?
Heres the result of link register(r14/lr):
ncs/v2.5.0/zephyr/kernel/mutex.c:107
Heres the code for that location:
and for program counter (r15/pc):
ncs/v2.5.0/zephyr/kernel/mutex.c:137
Which has the following code on this line: