Hi!
I'm using the RNG to encrypt data that I must send via SPI to another module. I'm using the function "sd_rand_application_vector_get", because I'm working with Soft Device 132.
In my first steps, I used the functions of the RNG without SD, and all was working ok, but, when I include SD and I use this function, my application returns to the first line of the code.
To get a 32 bytes random vector, I make this:
for(ii=0; ii<32; ii++){
length = random_vector_generate(&clave_compartida[ii], RANDOM_BUFF_SIZE);
dat[ii+1] = clave_compartida[ii];
}
and the function that gets one random byte from the pool:
uint8_t random_vector_generate(uint8_t * p_buff, uint8_t size){
do{
err_code = sd_rand_application_vector_get(p_buff, size);
}while(err_code != NRF_ERROR_SOC_RAND_NOT_ENOUGH_VALUES);
return size;}
The code returns to the first line when
err_code = sd_rand_application_vector_get(p_buff, size);
is executed. The error code returned, "err_code", is 0x00, but the code breaks anyway.
Do I need to consider something else? Do I skip something in my code, variables, functions...?
Thank you all! Bye!