aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorStephan Mueller <smueller@chronox.de>2014-08-17 11:37:59 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2014-08-25 08:34:09 -0400
commit46f64f6ef978dc1f36ebaa50ed79c7c8386711ee (patch)
tree1d34983e22472a6f362f33cd61dadbe392279cb8 /crypto
parent72f3e00dd67ec449199a8844bc012a4fa1e0340a (diff)
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.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c
index d86c67792e61..910e18831916 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,
1153 drbg->reseed_ctr = 1; 1153 drbg->reseed_ctr = 1;
1154 1154
1155out: 1155out:
1156 if (entropy) 1156 kzfree(entropy);
1157 kzfree(entropy);
1158 return ret; 1157 return ret;
1159} 1158}
1160 1159
@@ -1163,19 +1162,15 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)
1163{ 1162{
1164 if (!drbg) 1163 if (!drbg)
1165 return; 1164 return;
1166 if (drbg->V) 1165 kzfree(drbg->V);
1167 kzfree(drbg->V);
1168 drbg->V = NULL; 1166 drbg->V = NULL;
1169 if (drbg->C) 1167 kzfree(drbg->C);
1170 kzfree(drbg->C);
1171 drbg->C = NULL; 1168 drbg->C = NULL;
1172 if (drbg->scratchpad) 1169 kzfree(drbg->scratchpad);
1173 kzfree(drbg->scratchpad);
1174 drbg->scratchpad = NULL; 1170 drbg->scratchpad = NULL;
1175 drbg->reseed_ctr = 0; 1171 drbg->reseed_ctr = 0;
1176#ifdef CONFIG_CRYPTO_FIPS 1172#ifdef CONFIG_CRYPTO_FIPS
1177 if (drbg->prev) 1173 kzfree(drbg->prev);
1178 kzfree(drbg->prev);
1179 drbg->prev = NULL; 1174 drbg->prev = NULL;
1180 drbg->fips_primed = false; 1175 drbg->fips_primed = false;
1181#endif 1176#endif
@@ -1295,8 +1290,7 @@ static int drbg_make_shadow(struct drbg_state *drbg, struct drbg_state **shadow)
1295 return 0; 1290 return 0;
1296 1291
1297err: 1292err:
1298 if (tmp) 1293 kzfree(tmp);
1299 kzfree(tmp);
1300 return ret; 1294 return ret;
1301} 1295}
1302 1296