Sorry, the comment in the provided patch was bad. Here is a
better patch, listing where it came from.


Regards

Harri

#! /bin/sh /usr/share/dpatch/dpatch-run
## 20_crypto.dpatch. Original patch was provided by Lars Ellenberg, 
## see http://lists.linbit.com/pipermail/drbd-user/2009-April/011869.html .
## dpatch created by Harald Dunkel.
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix build with older kernels

@DPATCH@
--- drbd8/drbd/drbd_nl.c
+++ drbd8/drbd/drbd_nl.c
@@ -1199,6 +1199,12 @@ STATIC int drbd_nl_detach(struct drbd_conf *mdev, struct 
drbd_nl_cfg_req *nlp,
        return 0;
 }
 
+static int drbd_crypto_is_hash(struct crypto_tfm *tfm)
+{
+       return (crypto_tfm_alg_type(tfm) & CRYPTO_ALG_TYPE_HASH_MASK)
+               == CRYPTO_ALG_TYPE_HASH;
+}
+
 STATIC int drbd_nl_net_conf(struct drbd_conf *mdev, struct drbd_nl_cfg_req 
*nlp,
                            struct drbd_nl_cfg_reply *reply)
 {
@@ -1319,7 +1325,7 @@ STATIC int drbd_nl_net_conf(struct drbd_conf *mdev, 
struct drbd_nl_cfg_req *nlp,
                        goto fail;
                }
 
-               if (crypto_tfm_alg_type(crypto_hash_tfm(integrity_w_tfm)) != 
CRYPTO_ALG_TYPE_DIGEST) {
+               if (!drbd_crypto_is_hash(crypto_hash_tfm(integrity_w_tfm))) {
                        retcode=IntegrityAlgNotDigest;
                        goto fail;
                }
@@ -1639,7 +1645,7 @@ STATIC int drbd_nl_syncer_conf(struct drbd_conf *mdev, 
struct drbd_nl_cfg_req *n
                        goto fail;
                }
 
-               if (crypto_tfm_alg_type(crypto_hash_tfm(csums_tfm)) != 
CRYPTO_ALG_TYPE_DIGEST) {
+               if (!drbd_crypto_is_hash(crypto_hash_tfm(csums_tfm))) {
                        retcode = CSUMSAlgNotDigest;
                        goto fail;
                }
@@ -1663,7 +1669,7 @@ STATIC int drbd_nl_syncer_conf(struct drbd_conf *mdev, 
struct drbd_nl_cfg_req *n
                        goto fail;
                }
 
-               if (crypto_tfm_alg_type(crypto_hash_tfm(verify_tfm)) != 
CRYPTO_ALG_TYPE_DIGEST) {
+               if (!drbd_crypto_is_hash(crypto_hash_tfm(verify_tfm))) {
                        retcode = VERIFYAlgNotDigest;
                        goto fail;
                }


Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to