aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/crypto/drbg.c
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2015-04-17 14:54:08 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2015-04-21 09:14:38 +0800
commit8e0498d99f182dd06c012dfc62768e8ca0450adf (patch)
treef0fcc1eab2958f309989812113c56cf8c74728e4 /crypto/drbg.c
parentcrypto: mv_cesa - ensure backlog is initialised (diff)
downloadwireguard-linux-8e0498d99f182dd06c012dfc62768e8ca0450adf.tar.xz
wireguard-linux-8e0498d99f182dd06c012dfc62768e8ca0450adf.zip
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>
Diffstat (limited to 'crypto/drbg.c')
-rw-r--r--crypto/drbg.c2
1 files changed, 1 insertions, 1 deletions
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;
}