don't set type in FIPS_drbg_new().
FIPSerr(FIPS_F_FIPS_DRBG_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
+
if (type == 0)
+ {
+ memset(dctx, 0, sizeof(DRBG_CTX));
+ dctx->type = 0;
+ dctx->status = DRBG_STATUS_UNINITIALISED;
return dctx;
+ }
if (FIPS_drbg_init(dctx, type, flags) <= 0)
{
if (!strcmp(keyword, "PersonalizationString"))
{
pers = hex2bin_m(value, &perslen);
+ if (nid == 0)
+ {
+ fprintf(stderr, "DRBG type not recognised!\n");
+ exit (1);
+ }
dctx = FIPS_drbg_new(nid, df | DRBG_FLAG_TEST);
if (!dctx)
exit (1);