cryoto: drbg - clear all temporary memory
authorStephan Mueller <smueller@chronox.de>
Fri, 17 Apr 2015 12:54:08 +0000 (14:54 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Tue, 21 Apr 2015 01:14:38 +0000 (09:14 +0800)
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>
crypto/drbg.c

index b69409cb7e6ac70b6d9ae4c19c469ad7abb684e6..8d2944fab8e84f4e484a1478aac1c16206914938 100644 (file)
@@ -487,7 +487,7 @@ static int drbg_ctr_df(struct drbg_state *drbg,
 
 out:
        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));
        return ret;
 }