crypto: rng - Zero seed in crypto_rng_reset
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 21 Apr 2015 02:46:49 +0000 (10:46 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 22 Apr 2015 01:30:21 +0000 (09:30 +0800)
If we allocate a seed on behalf ot the user in crypto_rng_reset,
we must ensure that it is zeroed afterwards or the RNG may be
compromised.

Reported-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/rng.c

index 055e276427b120ed48c2acb6314c2e9d922c36ea..13155058b19317282c36b2a56261d74d28f8ab6a 100644 (file)
@@ -53,7 +53,7 @@ int crypto_rng_reset(struct crypto_rng *tfm, const u8 *seed, unsigned int slen)
 
        err = crypto_rng_alg(tfm)->seed(tfm, seed, slen);
 
-       kfree(buf);
+       kzfree(buf);
        return err;
 }
 EXPORT_SYMBOL_GPL(crypto_rng_reset);