From: Stephan Mueller Date: Fri, 17 Apr 2015 12:54:08 +0000 (+0200) Subject: cryoto: drbg - clear all temporary memory X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8e0498d99f182dd06c012dfc62768e8ca0450adf;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Herbert Xu --- diff --git a/crypto/drbg.c b/crypto/drbg.c index b69409cb7e6a..8d2944fab8e8 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -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; }