I am tasked with making a random number generator for an embedded system. As of now, the entropy sources am using are keypad input, and other variables such as signal strength and battery strength.
I have been using PolarSSL which has an amazing portable SSL Library for embedded systems. However, save for the documentation, there is very little on the internets about it!
I think am not adding the entropy sources to my entropy accumulator the right way. This is causing trouble with the CTR-DRBG module which returns an error on Init. (Source Error -52) Since the RNG is for an embedded system, there is no initial entropy from the system hence the error. (LINK) I get no errors when I try out the same RNG on other standard OS's like Windows. Here is some of the code pertinent to it.
// Global Variables.
ctr_drbg_context ctx;
entropy_context etx;
// Inside Main
entropy_init( &etx );
// Add entropy sources
// Initializing CTR_DRBG
printf("Before ctrdrbg: %d", err);
err = ctr_drbg_init( &ctx, entropy_func, &etx, (const unsigned char *) "RANDOM_GEN", 10 );
if( err != 0 )
{
printf("Failed in ctr_drbg init!: %d", err);
}
Output:
Error on Ctr_drbg init: -52
I have pored over this for about a week now with no headway. Almost giving up!! Anybody out there willing to help?