I'm trying to run some code that uses libsodium on an Mbed board.
While just including the library and running sodium_init()
the following error is thrown on mbed sterm
:
++ MbedOS Error Info ++
Error Status: 0x80010133 Code: 307 Module: 1
Error Message: Mutex: 0x200027EC, Not allowed in ISR context
Location: 0x80026B5
Error Value: 0x200027EC
Current Thread: main Id: 0x20000EF0 Entry: 0x800257F StackSize: 0x1000 StackMem: 0x200017B8 SP: 0x100004C8
For more info, visit: https://mbed.com/s/error?error=0x80010133&tgt=NUCLEO_L476RG
-- MbedOS Error Info --
It seems that libsodium tries to use some sort of mutex which isn't allowed. Not being an expert on either libsodium or Mbed OS, what could be causing this issue? The libsodium docs state that
cross-compiling to ARM using the GNU tools for ARM embedded processors
is possible. However, they also note that
using libsodium on ARM Cortex M0, M3 and M4 CPUs is not recommended if side-channels are a concern.
Is this related? Is there a way to compile libsodium which will work for Nucleo boards?
First, check that you are running a recent version of the compiler toolchain. Looks like this is a bug fixed in current versions.
If that doesn't work, or if it isn't a option, you can try adding --without-pthreads
to the compilation flags.
That CPU is a Cortex M4, so the warning regarding side-channels still apply if physical security is part of your thread model.
For that platform, libhydrogen may be better a choice than libsodium.
User contributions licensed under CC BY-SA 3.0