diff options
author | Stephan Mueller <smueller@chronox.de> | 2014-08-17 11:38:29 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-08-25 08:34:09 -0400 |
commit | 45943a58df46b912685af26000e4dbacddd9c567 (patch) | |
tree | aab609057b65af3ce214081d5e9ec0d6c23cecb7 | |
parent | 46f64f6ef978dc1f36ebaa50ed79c7c8386711ee (diff) |
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>
-rw-r--r-- | crypto/drbg.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c index 910e18831916..212d260220e3 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c | |||
@@ -1381,11 +1381,9 @@ static int drbg_generate(struct drbg_state *drbg, | |||
1381 | shadow->seeded = false; | 1381 | shadow->seeded = false; |
1382 | 1382 | ||
1383 | /* allocate cipher handle */ | 1383 | /* allocate cipher handle */ |
1384 | if (shadow->d_ops->crypto_init) { | 1384 | len = shadow->d_ops->crypto_init(shadow); |
1385 | len = shadow->d_ops->crypto_init(shadow); | 1385 | if (len) |
1386 | if (len) | 1386 | goto err; |
1387 | goto err; | ||
1388 | } | ||
1389 | 1387 | ||
1390 | if (shadow->pr || !shadow->seeded) { | 1388 | if (shadow->pr || !shadow->seeded) { |
1391 | pr_devel("DRBG: reseeding before generation (prediction " | 1389 | pr_devel("DRBG: reseeding before generation (prediction " |
@@ -1467,8 +1465,7 @@ static int drbg_generate(struct drbg_state *drbg, | |||
1467 | #endif | 1465 | #endif |
1468 | 1466 | ||
1469 | err: | 1467 | err: |
1470 | if (shadow->d_ops->crypto_fini) | 1468 | shadow->d_ops->crypto_fini(shadow); |
1471 | shadow->d_ops->crypto_fini(shadow); | ||
1472 | drbg_restore_shadow(drbg, &shadow); | 1469 | drbg_restore_shadow(drbg, &shadow); |
1473 | return len; | 1470 | return len; |
1474 | } | 1471 | } |
@@ -1562,11 +1559,10 @@ static int drbg_instantiate(struct drbg_state *drbg, struct drbg_string *pers, | |||
1562 | return ret; | 1559 | return ret; |
1563 | 1560 | ||
1564 | ret = -EFAULT; | 1561 | ret = -EFAULT; |
1565 | if (drbg->d_ops->crypto_init && drbg->d_ops->crypto_init(drbg)) | 1562 | if (drbg->d_ops->crypto_init(drbg)) |
1566 | goto err; | 1563 | goto err; |
1567 | ret = drbg_seed(drbg, pers, false); | 1564 | ret = drbg_seed(drbg, pers, false); |
1568 | if (drbg->d_ops->crypto_fini) | 1565 | drbg->d_ops->crypto_fini(drbg); |
1569 | drbg->d_ops->crypto_fini(drbg); | ||
1570 | if (ret) | 1566 | if (ret) |
1571 | goto err; | 1567 | goto err; |
1572 | 1568 | ||