diff options
author | Andreas Gruenbacher <agruen@linbit.com> | 2011-04-29 12:20:08 +0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-11-08 19:52:58 +0400 |
commit | 4b6ad6d4579908ff82a47ad9ba067a504b1e0882 (patch) | |
tree | 0b4c89f9e4d67aa3b815d7dd01d72f3d951fca6f | |
parent | 5b614abe30645c3a528d54ff01da94fde0770c43 (diff) | |
download | linux-4b6ad6d4579908ff82a47ad9ba067a504b1e0882.tar.xz |
drbd: Remove obsolete drbd_crypto_is_hash()
We allocate hash transformations with crypto_alloc_hash() which will
only return hash algorithms. It is not necessary to reconfirm that we
actually got a hash algorithm.
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_nl.c | 25 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_receiver.c | 5 | ||||
-rw-r--r-- | drivers/block/drbd/drbd_wrappers.h | 6 |
3 files changed, 11 insertions, 25 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index e84b1d755f07..dc5824b175aa 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -1799,7 +1799,7 @@ struct crypto { }; static int -alloc_tfm(struct crypto_hash **tfm, char *tfm_name, int err_alg, int err_nd) +alloc_hash(struct crypto_hash **tfm, char *tfm_name, int err_alg) { if (!tfm_name[0]) return NO_ERROR; @@ -1810,9 +1810,6 @@ alloc_tfm(struct crypto_hash **tfm, char *tfm_name, int err_alg, int err_nd) return err_alg; } - if (!drbd_crypto_is_hash(crypto_hash_tfm(*tfm))) - return err_nd; - return NO_ERROR; } @@ -1823,28 +1820,28 @@ alloc_crypto(struct crypto *crypto, struct net_conf *new_conf) enum drbd_ret_code rv; int hash_size; - rv = alloc_tfm(&crypto->csums_tfm, new_conf->csums_alg, - ERR_CSUMS_ALG, ERR_CSUMS_ALG_ND); + rv = alloc_hash(&crypto->csums_tfm, new_conf->csums_alg, + ERR_CSUMS_ALG); if (rv != NO_ERROR) return rv; - rv = alloc_tfm(&crypto->verify_tfm, new_conf->verify_alg, - ERR_VERIFY_ALG, ERR_VERIFY_ALG_ND); + rv = alloc_hash(&crypto->verify_tfm, new_conf->verify_alg, + ERR_VERIFY_ALG); if (rv != NO_ERROR) return rv; - rv = alloc_tfm(&crypto->integrity_tfm, new_conf->integrity_alg, - ERR_INTEGRITY_ALG, ERR_INTEGRITY_ALG_ND); + rv = alloc_hash(&crypto->integrity_tfm, new_conf->integrity_alg, + ERR_INTEGRITY_ALG); if (rv != NO_ERROR) return rv; - rv = alloc_tfm(&crypto->peer_integrity_tfm, new_conf->integrity_alg, - ERR_INTEGRITY_ALG, ERR_INTEGRITY_ALG_ND); + rv = alloc_hash(&crypto->peer_integrity_tfm, new_conf->integrity_alg, + ERR_INTEGRITY_ALG); if (rv != NO_ERROR) return rv; if (new_conf->cram_hmac_alg[0] != 0) { snprintf(hmac_name, CRYPTO_MAX_ALG_NAME, "hmac(%s)", new_conf->cram_hmac_alg); - rv = alloc_tfm(&crypto->cram_hmac_tfm, hmac_name, - ERR_AUTH_ALG, ERR_AUTH_ALG_ND); + rv = alloc_hash(&crypto->cram_hmac_tfm, hmac_name, + ERR_AUTH_ALG); } if (crypto->integrity_tfm) { hash_size = crypto_hash_digestsize(crypto->integrity_tfm); diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 36b846bcdda2..30b655644afd 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -3100,11 +3100,6 @@ struct crypto_hash *drbd_crypto_alloc_digest_safe(const struct drbd_conf *mdev, alg, name, PTR_ERR(tfm)); return tfm; } - if (!drbd_crypto_is_hash(crypto_hash_tfm(tfm))) { - crypto_free_hash(tfm); - dev_err(DEV, "\"%s\" is not a digest (%s)\n", alg, name); - return ERR_PTR(-EINVAL); - } return tfm; } diff --git a/drivers/block/drbd/drbd_wrappers.h b/drivers/block/drbd/drbd_wrappers.h index decf9b282e8b..46a6d99f7b61 100644 --- a/drivers/block/drbd/drbd_wrappers.h +++ b/drivers/block/drbd/drbd_wrappers.h @@ -45,12 +45,6 @@ static inline void drbd_generic_make_request(struct drbd_conf *mdev, generic_make_request(bio); } -static inline int drbd_crypto_is_hash(struct crypto_tfm *tfm) -{ - return (crypto_tfm_alg_type(tfm) & CRYPTO_ALG_TYPE_HASH_MASK) - == CRYPTO_ALG_TYPE_HASH; -} - #ifndef __CHECKER__ # undef __cond_lock # define __cond_lock(x,c) (c) |