int r, nid = 0;
int pr = 0;
char buf[2048], lbuf[2048];
- unsigned char randout[2048];
+ unsigned char *randout = NULL;
char *keyword = NULL, *value = NULL;
unsigned char *ent = NULL, *nonce = NULL, *pers = NULL, *adin = NULL;
else
exit(1);
}
+ if (!strcmp(keyword, "[ReturnedBitsLen"))
+ randoutlen = atoi(value) / 8;
if (!strcmp(keyword, "EntropyInput"))
{
FIPS_drbg_set_callbacks(dctx, test_entropy, 0, 0,
test_nonce, 0);
FIPS_drbg_set_app_data(dctx, &t);
- randoutlen = (int)FIPS_drbg_get_blocklength(dctx);
+ if (randoutlen == 0)
+ randoutlen = (int)FIPS_drbg_get_blocklength(dctx);
+ if (randout)
+ OPENSSL_free(randout);
+ randout = OPENSSL_malloc(randoutlen);
r = FIPS_drbg_instantiate(dctx, pers, perslen);
if (!r)
{
}
}
+ if (randout)
+ OPENSSL_free(randout);
if (in && in != stdin)
fclose(in);
if (out && out != stdout)