mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 21:33:00 +00:00
crypto: drbg - remove superflowous checks
The crypto_init and crypto_fini functions are always implemented. Thus, there is no need for a protecting 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
46f64f6ef9
commit
45943a58df
@ -1381,11 +1381,9 @@ static int drbg_generate(struct drbg_state *drbg,
|
||||
shadow->seeded = false;
|
||||
|
||||
/* allocate cipher handle */
|
||||
if (shadow->d_ops->crypto_init) {
|
||||
len = shadow->d_ops->crypto_init(shadow);
|
||||
if (len)
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (shadow->pr || !shadow->seeded) {
|
||||
pr_devel("DRBG: reseeding before generation (prediction "
|
||||
@ -1467,7 +1465,6 @@ static int drbg_generate(struct drbg_state *drbg,
|
||||
#endif
|
||||
|
||||
err:
|
||||
if (shadow->d_ops->crypto_fini)
|
||||
shadow->d_ops->crypto_fini(shadow);
|
||||
drbg_restore_shadow(drbg, &shadow);
|
||||
return len;
|
||||
@ -1562,10 +1559,9 @@ static int drbg_instantiate(struct drbg_state *drbg, struct drbg_string *pers,
|
||||
return ret;
|
||||
|
||||
ret = -EFAULT;
|
||||
if (drbg->d_ops->crypto_init && drbg->d_ops->crypto_init(drbg))
|
||||
if (drbg->d_ops->crypto_init(drbg))
|
||||
goto err;
|
||||
ret = drbg_seed(drbg, pers, false);
|
||||
if (drbg->d_ops->crypto_fini)
|
||||
drbg->d_ops->crypto_fini(drbg);
|
||||
if (ret)
|
||||
goto err;
|
||||
|
Loading…
Reference in New Issue
Block a user