I'm working on stm32f469 doing some bare metal code to try to use the libtomcrypt / libtomfastmath libraries. The code I'm trying to debug has been checked by valgrind and is working on many platforms like macos, raspberrypi, ios, android.
To keep things simple, I am doing the following which is calling this function int register_hash(const struct ltc_hash_descriptor *hash)
with a const static variable by giving it's adress : register_hash(&sha256_desc)
. The problem is, once I am inside the function, the hash
pointer is NULL
and I cannot figure out why.
I was thinking It would be a stack overflow so I pre-filled the stack with the constant value 0xdeadbeef
and I checked if all these values were erased or not and the result is the stack is not overflowed.
When debugging, I can verify the value at the address returned by &sha256_desc
and the memory is not corrupted there either.
I am not doing dynamic allocations nor buffer filling that could be overflowing and corrupting the memory.
I'm compiling with arm-none-eabi-gcc
, version 7-2017-q4-major.
I am mainly looking for some possible sources of issue as I am running out of ideas.