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>
This commit is contained in:
parent
72f3e00dd6
commit
46f64f6ef9
|
@ -1153,8 +1153,7 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers,
|
||||||
drbg->reseed_ctr = 1;
|
drbg->reseed_ctr = 1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (entropy)
|
kzfree(entropy);
|
||||||
kzfree(entropy);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1163,19 +1162,15 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)
|
||||||
{
|
{
|
||||||
if (!drbg)
|
if (!drbg)
|
||||||
return;
|
return;
|
||||||
if (drbg->V)
|
kzfree(drbg->V);
|
||||||
kzfree(drbg->V);
|
|
||||||
drbg->V = NULL;
|
drbg->V = NULL;
|
||||||
if (drbg->C)
|
kzfree(drbg->C);
|
||||||
kzfree(drbg->C);
|
|
||||||
drbg->C = NULL;
|
drbg->C = NULL;
|
||||||
if (drbg->scratchpad)
|
kzfree(drbg->scratchpad);
|
||||||
kzfree(drbg->scratchpad);
|
|
||||||
drbg->scratchpad = NULL;
|
drbg->scratchpad = NULL;
|
||||||
drbg->reseed_ctr = 0;
|
drbg->reseed_ctr = 0;
|
||||||
#ifdef CONFIG_CRYPTO_FIPS
|
#ifdef CONFIG_CRYPTO_FIPS
|
||||||
if (drbg->prev)
|
kzfree(drbg->prev);
|
||||||
kzfree(drbg->prev);
|
|
||||||
drbg->prev = NULL;
|
drbg->prev = NULL;
|
||||||
drbg->fips_primed = false;
|
drbg->fips_primed = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1295,8 +1290,7 @@ static int drbg_make_shadow(struct drbg_state *drbg, struct drbg_state **shadow)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
if (tmp)
|
kzfree(tmp);
|
||||||
kzfree(tmp);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue