Hi there,

I’m trying to port mbedTLS to my embedded system (TI CC3200) to generate an RSA private key.

Unfortunately this MCU doesn’t have an hardware RNG, so I found on github a library to generate random numbers.

I found this function into RSA module:

int mbedtls_rsa_gen_key( mbedtls_rsa_context *ctx,

int (*f_rng)(void *, unsigned char *, size_t),

void *p_rng,

unsigned int nbits, int exponent )

I also read the related documentation but I don’t understand the parameters meaning.

What are the meaning of the rng function parameters?

Could someone provide an example?

Thanks in advance for the help.

PS: please note that my application is not for commercial use, so I can use a weak random number generator.