Hi
I have been using openssl-fips-2.0.2 to call the the drbg random generator.
But getting the following errors:
1077246192:error:2D07406D:FIPS routines:FIPS_drbg_instantiate:error
retrieving entropy:fips_drbg_lib.c:286:
1077246192:error:2D07107B:FIPS routines:FIPS_drbg_generate:in error
state:fips_drbg_lib.c:459:
The code I did are as follows:
if ( (urand = fopen ( "/dev/urandom", "r" )) == NULL ) {
fprintf (stderr, "fopen /dev/urandom error." );
free(cbuf);
return 0;// failure
}
elements = fread ( cbuf, 16, 1, urand );
if ( elements != 1 ) {
fprintf (stderr, "fread error." );
free(cbuf);
return 0;
}
fclose ( urand );
/* End initialize PRNG */
DRBG_CTX *dctx;
//dctx = FIPS_drbg_new(NID_aes_256_ctr, DRBG_FLAG_CTR_USE_DF);
dctx = FIPS_drbg_new(NID_sha256, 0);
if (!FIPS_drbg_instantiate(dctx, cbuf, 10))
{
ERR_load_crypto_strings();
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
}
/*
if (!FIPS_drbg_reseed(dctx, cbuf, 16)) {
ERR_load_crypto_strings();
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
}
*/
// if (!FIPS_rand_bytes((unsigned char *)cbuf, arraylength)) {
// fprintf(stderr, "The PRNG is not seeded!\n");
// }
if (FIPS_drbg_generate(dctx, (unsigned char *)cbuf, arraylength, 0, cbuf,
16))
{
ERR_load_crypto_strings();
ERR_print_errors(BIO_new_fp(stderr,BIO_NOCLOSE));
}
Any ideas?
thanks much in advance.
voryl
--
View this message in context:
http://openssl.6102.n7.nabble.com/error-retrieving-entropy-tp44435.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]