Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46f64f6e authored by Stephan Mueller's avatar Stephan Mueller Committed by Herbert Xu
Browse files

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: default avatarStephan Mueller <smueller@chronox.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 72f3e00d
Loading
Loading
Loading
Loading
+6 −12
Original line number Diff line number Diff line
@@ -1153,7 +1153,6 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers,
	drbg->reseed_ctr = 1;

out:
	if (entropy)
	kzfree(entropy);
	return ret;
}
@@ -1163,18 +1162,14 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)
{
	if (!drbg)
		return;
	if (drbg->V)
	kzfree(drbg->V);
	drbg->V = NULL;
	if (drbg->C)
	kzfree(drbg->C);
	drbg->C = NULL;
	if (drbg->scratchpad)
	kzfree(drbg->scratchpad);
	drbg->scratchpad = NULL;
	drbg->reseed_ctr = 0;
#ifdef CONFIG_CRYPTO_FIPS
	if (drbg->prev)
	kzfree(drbg->prev);
	drbg->prev = NULL;
	drbg->fips_primed = false;
@@ -1295,7 +1290,6 @@ static int drbg_make_shadow(struct drbg_state *drbg, struct drbg_state **shadow)
	return 0;

err:
	if (tmp)
	kzfree(tmp);
	return ret;
}