Dear Nordic,
Is there any documentation available,how the random pool works and where is expected that SoftDevice offers something and when it is blocked? And if there are no bytes available, it is sure that will be in future? I am working on very sensitive application and I have found this code in this thread:
devzone.nordicsemi.com/.../sd_rand_application_vector_get-crashes-system
However without any deep knowledge I can say, that this can end up with infinity loop. Let us say that I will add ERORR checking at this function, can I be sure that at next event I will have new values in pool for sure?
If I get the available bytes, how long do they keep available?
Do you consider this code will not state in finite loop if soft device will working correctly?
void get_rnd_buf(uint8_t *buf, uint8_t len)
{
uint8_t bytes_available;
uint32_t err_code;
do
{
sd_rand_application_bytes_available_get(&bytes_available);
if(bytes_available >= len)
{
err_code=sd_rand_application_vector_get(buf, len);
if (err_code==NRF_SUCCESS) len = 0;
}
else
{
err_code=sd_rand_application_vector_get(buf, bytes_available);
if (err_code==NRF_SUCCESS)
{
buf += bytes_available;
len -= bytes_available;
}
sd_app_event_wait();
}
}while(len > 0);
}
Are there any cases where would I need to count number of tries? And exit at some limit?
Thx very much.
Jan