forked from wolfSSL/wolfssl
If the RNG seeding callback is missing or returns an error, the RNG instantiate fails.
This commit is contained in:
committed by
Daniel Pouzzner
parent
c6486d7392
commit
0c6d8cfc22
@ -819,18 +819,19 @@ static int _InitRng(WC_RNG* rng, byte* nonce, word32 nonceSz,
|
||||
rng->drbg = (struct DRBG*)&rng->drbg_data;
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
ret = -1;
|
||||
|
||||
#ifdef WC_RNG_SEED_CB
|
||||
if (seedCb != NULL) {
|
||||
if (seedCb == NULL) {
|
||||
ret = DRBG_FAILURE;
|
||||
}
|
||||
else {
|
||||
ret = seedCb(seed, seedSz);
|
||||
if (ret != 0) {
|
||||
ret = DRBG_FAILURE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ret < 0) {
|
||||
}
|
||||
#else
|
||||
ret = wc_GenerateSeed(&rng->seed, seed, seedSz);
|
||||
}
|
||||
|
||||
#endif
|
||||
if (ret == 0)
|
||||
ret = wc_RNG_TestSeed(seed, seedSz);
|
||||
else {
|
||||
|
Reference in New Issue
Block a user