@@ -584,7 +584,6 @@ static int Hash_DRBG_Reseed(DRBG_internal* drbg, const byte* seed, word32 seedSz
584584 additional , additionalSz );
585585 if (ret == DRBG_SUCCESS ) {
586586 XMEMCPY (drbg -> V , newV , sizeof (drbg -> V ));
587- ForceZero (newV , DRBG_SEED_LEN );
588587
589588 ret = Hash_df (drbg , drbg -> C , sizeof (drbg -> C ), drbgInitC , drbg -> V ,
590589 sizeof (drbg -> V ), NULL , 0 , NULL , 0 );
@@ -593,6 +592,8 @@ static int Hash_DRBG_Reseed(DRBG_internal* drbg, const byte* seed, word32 seedSz
593592 drbg -> reseedCtr = 1 ;
594593 }
595594
595+ ForceZero (newV , DRBG_SEED_LEN );
596+
596597#ifndef WOLFSSL_SMALL_STACK_CACHE
597598 WC_FREE_VAR_EX (newV , drbg -> heap , DYNAMIC_TYPE_TMP_BUFFER );
598599#endif
@@ -1177,7 +1178,6 @@ static int Hash512_DRBG_Reseed(DRBG_SHA512_internal* drbg, const byte* seed,
11771178 additional , additionalSz );
11781179 if (ret == DRBG_SUCCESS ) {
11791180 XMEMCPY (drbg -> V , newV , sizeof (drbg -> V ));
1180- ForceZero (newV , DRBG_SHA512_SEED_LEN );
11811181
11821182 ret = Hash512_df (drbg , drbg -> C , sizeof (drbg -> C ), drbgInitC , drbg -> V ,
11831183 sizeof (drbg -> V ), NULL , 0 ,
@@ -1187,6 +1187,8 @@ static int Hash512_DRBG_Reseed(DRBG_SHA512_internal* drbg, const byte* seed,
11871187 drbg -> reseedCtr = 1 ;
11881188 }
11891189
1190+ ForceZero (newV , DRBG_SHA512_SEED_LEN );
1191+
11901192#ifndef WOLFSSL_SMALL_STACK_CACHE
11911193 WC_FREE_VAR_EX (newV , drbg -> heap , DYNAMIC_TYPE_TMP_BUFFER );
11921194#endif
0 commit comments