Commit 45943a58 authored by Stephan Mueller's avatar Stephan Mueller Committed by Herbert Xu

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: default avatarStephan Mueller <smueller@chronox.de>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 46f64f6e
...@@ -1381,11 +1381,9 @@ static int drbg_generate(struct drbg_state *drbg, ...@@ -1381,11 +1381,9 @@ static int drbg_generate(struct drbg_state *drbg,
shadow->seeded = false; shadow->seeded = false;
/* allocate cipher handle */ /* allocate cipher handle */
if (shadow->d_ops->crypto_init) {
len = shadow->d_ops->crypto_init(shadow); len = shadow->d_ops->crypto_init(shadow);
if (len) if (len)
goto err; goto err;
}
if (shadow->pr || !shadow->seeded) { if (shadow->pr || !shadow->seeded) {
pr_devel("DRBG: reseeding before generation (prediction " pr_devel("DRBG: reseeding before generation (prediction "
...@@ -1467,7 +1465,6 @@ static int drbg_generate(struct drbg_state *drbg, ...@@ -1467,7 +1465,6 @@ static int drbg_generate(struct drbg_state *drbg,
#endif #endif
err: err:
if (shadow->d_ops->crypto_fini)
shadow->d_ops->crypto_fini(shadow); shadow->d_ops->crypto_fini(shadow);
drbg_restore_shadow(drbg, &shadow); drbg_restore_shadow(drbg, &shadow);
return len; return len;
...@@ -1562,10 +1559,9 @@ static int drbg_instantiate(struct drbg_state *drbg, struct drbg_string *pers, ...@@ -1562,10 +1559,9 @@ static int drbg_instantiate(struct drbg_state *drbg, struct drbg_string *pers,
return ret; return ret;
ret = -EFAULT; ret = -EFAULT;
if (drbg->d_ops->crypto_init && drbg->d_ops->crypto_init(drbg)) if (drbg->d_ops->crypto_init(drbg))
goto err; goto err;
ret = drbg_seed(drbg, pers, false); ret = drbg_seed(drbg, pers, false);
if (drbg->d_ops->crypto_fini)
drbg->d_ops->crypto_fini(drbg); drbg->d_ops->crypto_fini(drbg);
if (ret) if (ret)
goto err; goto err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment