How to get PSA random number generation working on nRF52832?

I'm working with an nRF52832 and am trying to get random number generation to work, having spent the better part of a day trying. I'm attempting to use the PSA library (psa_crypto_init() and psa_generate_random() functions) in the nRF Connect SDK.

I've tried many combinations of different config settings from various online sources but none have led to a working solution. I always get -134 (PSA_ERROR_NOT_SUPPORTED) returned.

I've also tried the crypto/rng example without modification, which returns the same error and has no chip-specific config file for the nRF52832 that I can use.

It would be greatly apreciated if someone could provide the correct config settings required to get this working.

Thanks.

  • Hi,

    The samples are not written to support device that does not have a HW crypto acceleration unit (Cryptocell). I'm checking if it is possible to configure the sample to run on devices without this unit present.

    Best regards,
    Jørgen

  • So, I had been referencing this datasheet, which is explicitly for the nRF52832 and states that it does have a CryptoCell-312 under "Application Core," which is why I have been confused as to why I couldn't get it working. After your response though, the actual datasheet for the chip does indeed not mention a CryptoCell.

    In that case then, what is the recommended/default way to generate random numbers on this chip without such hardware support? Using the RNG peripheral? Note that in this case I don't need them to be cryptographically secure.

  • Hi,

    That is unfortunate. The nRF52832 does not have Cryptocell, TrustZone SPU or KMU available, and ACL should be replaced by BPROT. It looks like the link to the nRF52832 product brief have been removed from the product page. I would recommend to reference the infocenter for supported features in the different chip variants.

    Regarding RNG support, this is described in the RNG support documentation in NCS:

    "For devices without a hardware-accelerated cryptographic engine, entropy is provided by the nRF RNG peripheral. PRNG support is provided by the Oberon PSA driver, which is implemented using software."

    Best regards,
    Jørgen

Related