Random crashes while calling spm_request_random_number()

Hi, im running the sdk version 1.3.2 and Im experencing a system crash after calling 

spm_request_random_number after the 4th or 5th time
I've already done some research, I saw that this is a pretty common problem
i already tried to call 
k_sched_lock();
and
 k_sched_unlock();
before and after calling the funcition, as this post says 
also I've tried inscreasing the SPM stack size as proposed here
Does anyone have an idea of what I can do to solve this problem? I have been stuck in this for almost a week 
  • Hi,

    First, do you still see the problem if you use a newer version of the SDK, e.g. 1.5.0?

    There has been several PRs that works around or reduces the likelyhood of this error happening.

    Do you need the numbers to be cryptographically secure, or would the pseudorandom numbers from sys_rand32_get() be enough?

    What else is happening in the system when you are requesting the random number?

    Best regards,

    Didrik

  • Hi Didrik, I hope you are having a great day

    I need the numbers to be Cryptographically Secure because, Im using them for an Initialization Vector to encrypt data using AES in CTR mode.

    I haven't tried upgrading the version of the SDK, I'm going to try and I let you know the results.

    About other things that are happening in the system while I request the random numbers, I have another thread that only turns on and off an onboard LED, and also an interrupt handler that triggers when I press an external button. I already tried simply removing them, because I have read that the problem happens when the scheduler switches between a Secure and a Non Secure function, but the results are the same, it still crashes and reboots the System.

    Best regards,

    Emilio

Related