Explorar o código

cryoto: drbg - clear all temporary memory

The buffer uses for temporary data must be cleared entirely. In AES192
the used buffer is drbg_statelen(drbg) + drbg_blocklen(drbg) as
documented in the comment above drbg_ctr_df.

This patch ensures that the temp buffer is completely wiped.

Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Stephan Mueller %!s(int64=10) %!d(string=hai) anos
pai
achega
8e0498d99f
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      crypto/drbg.c

+ 1 - 1
crypto/drbg.c

@@ -487,7 +487,7 @@ static int drbg_ctr_df(struct drbg_state *drbg,
 
 
 out:
 out:
 	memset(iv, 0, drbg_blocklen(drbg));
 	memset(iv, 0, drbg_blocklen(drbg));
-	memset(temp, 0, drbg_statelen(drbg));
+	memset(temp, 0, drbg_statelen(drbg) + drbg_blocklen(drbg));
 	memset(pad, 0, drbg_blocklen(drbg));
 	memset(pad, 0, drbg_blocklen(drbg));
 	return ret;
 	return ret;
 }
 }