diff options
author | Stephan Mueller <smueller@chronox.de> | 2014-08-17 17:37:59 +0200 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-08-25 20:34:09 +0800 |
commit | 46f64f6ef978dc1f36ebaa50ed79c7c8386711ee (patch) | |
tree | 1d34983e22472a6f362f33cd61dadbe392279cb8 /crypto | |
parent | 72f3e00dd67ec449199a8844bc012a4fa1e0340a (diff) | |
download | op-kernel-dev-46f64f6ef978dc1f36ebaa50ed79c7c8386711ee.zip op-kernel-dev-46f64f6ef978dc1f36ebaa50ed79c7c8386711ee.tar.gz |
crypto: drbg - kzfree does not need a check for NULL pointer
The kzfree function already performs the NULL pointer check. Therefore,
the DRBG code does not need to implement such check.
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/drbg.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c index d86c677..910e188 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -1153,8 +1153,7 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers, drbg->reseed_ctr = 1; out: - if (entropy) - kzfree(entropy); + kzfree(entropy); return ret; } @@ -1163,19 +1162,15 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg) { if (!drbg) return; - if (drbg->V) - kzfree(drbg->V); + kzfree(drbg->V); drbg->V = NULL; - if (drbg->C) - kzfree(drbg->C); + kzfree(drbg->C); drbg->C = NULL; - if (drbg->scratchpad) - kzfree(drbg->scratchpad); + kzfree(drbg->scratchpad); drbg->scratchpad = NULL; drbg->reseed_ctr = 0; #ifdef CONFIG_CRYPTO_FIPS - if (drbg->prev) - kzfree(drbg->prev); + kzfree(drbg->prev); drbg->prev = NULL; drbg->fips_primed = false; #endif @@ -1295,8 +1290,7 @@ static int drbg_make_shadow(struct drbg_state *drbg, struct drbg_state **shadow) return 0; err: - if (tmp) - kzfree(tmp); + kzfree(tmp); return ret; } |