Check we recognise DRBG type in fips_drbgvs.c initialised DRBG_CTX if we
don't set type in FIPS_drbg_new().
This commit is contained in:
parent
543dfa9f0e
commit
9e56c99e1a
@ -115,8 +115,14 @@ DRBG_CTX *FIPS_drbg_new(int type, unsigned int flags)
|
|||||||
FIPSerr(FIPS_F_FIPS_DRBG_NEW, ERR_R_MALLOC_FAILURE);
|
FIPSerr(FIPS_F_FIPS_DRBG_NEW, ERR_R_MALLOC_FAILURE);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 0)
|
if (type == 0)
|
||||||
|
{
|
||||||
|
memset(dctx, 0, sizeof(DRBG_CTX));
|
||||||
|
dctx->type = 0;
|
||||||
|
dctx->status = DRBG_STATUS_UNINITIALISED;
|
||||||
return dctx;
|
return dctx;
|
||||||
|
}
|
||||||
|
|
||||||
if (FIPS_drbg_init(dctx, type, flags) <= 0)
|
if (FIPS_drbg_init(dctx, type, flags) <= 0)
|
||||||
{
|
{
|
||||||
|
@ -314,6 +314,11 @@ int main(int argc,char **argv)
|
|||||||
if (!strcmp(keyword, "PersonalizationString"))
|
if (!strcmp(keyword, "PersonalizationString"))
|
||||||
{
|
{
|
||||||
pers = hex2bin_m(value, &perslen);
|
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);
|
dctx = FIPS_drbg_new(nid, df | DRBG_FLAG_TEST);
|
||||||
if (!dctx)
|
if (!dctx)
|
||||||
exit (1);
|
exit (1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user