Skip to content

Commit 6f95a9c

Browse files
committed
wolfcrypt/src/random.c: in _InitRng(), remove "drbg_instantiated" conditional cleanup logic (Coverity true-benign-positive: DEADCODE because drbg_instantiated is always false when ret != DRBG_SUCCESS).
1 parent fb26b2d commit 6f95a9c

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

wolfcrypt/src/random.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ static int _InitRng(WC_RNG* rng, byte* nonce, word32 nonceSz,
813813
#ifdef HAVE_HASHDRBG
814814
word32 seedSz = SEED_SZ + SEED_BLOCK_SZ;
815815
WC_DECLARE_VAR(seed, byte, MAX_SEED_SZ, rng->heap);
816-
int drbg_instantiated = 0;
817816
#ifdef WOLFSSL_SMALL_STACK_CACHE
818817
int drbg_scratch_instantiated = 0;
819818
#endif
@@ -1020,8 +1019,6 @@ static int _InitRng(WC_RNG* rng, byte* nonce, word32 nonceSz,
10201019
ret = Hash_DRBG_Instantiate((DRBG_internal *)rng->drbg,
10211020
seed + SEED_BLOCK_SZ, seedSz - SEED_BLOCK_SZ,
10221021
nonce, nonceSz, rng->heap, devId);
1023-
if (ret == 0)
1024-
drbg_instantiated = 1;
10251022
} /* ret == 0 */
10261023

10271024
#ifdef WOLFSSL_SMALL_STACK
@@ -1033,8 +1030,6 @@ static int _InitRng(WC_RNG* rng, byte* nonce, word32 nonceSz,
10331030
WC_FREE_VAR_EX(seed, rng->heap, DYNAMIC_TYPE_SEED);
10341031

10351032
if (ret != DRBG_SUCCESS) {
1036-
if (drbg_instantiated)
1037-
(void)Hash_DRBG_Uninstantiate((DRBG_internal *)rng->drbg);
10381033
#if !defined(WOLFSSL_NO_MALLOC) || defined(WOLFSSL_STATIC_MEMORY)
10391034
XFREE(rng->drbg, rng->heap, DYNAMIC_TYPE_RNG);
10401035
#endif

0 commit comments

Comments
 (0)