This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

random number pool size & refresh

Is there a way to increase the size of the random number pool, and does the pool refresh periodically, or is there a way to manually trigger a refresh of the pool. Our application is requesting a 16 byte block of random data, immediately followed by a 64 byte block. The pool is currently saying 32 bytes available. We will need several random number blocks to establish the a secure session.

I couldn't find anything in the documentation on increasing pool size or refreshing the pool.

  • Hi,

    The default pool size is 32 bytes. The setting is RNG_CONFIG_POOL_SIZE in sdk_config.h.

    Note that this setting must be 32 when using a SoftDevice. (Access to the RNG is restricted to using the SoftDevice API, and the 32 byte pool size seems to be an internal setting in the s132 SoftDevice. More specifically the call to sd_rand_application_vector_get() will return NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES for length > 32.)

    Refreshing is done automatically by the driver. Refresh rate depends on configuration, see the RNG electrical specification for typical generation speed.

    Depending on your use case you may consider filling a buffer of 80 random bytes in RAM in advance, i.e. operate with your own random buffer which is filled using the RNG driver.

    Regards, Terje

Related