Whamcloud - gitweb
LU-8602 gss: get rid of cfs_crypto_hash_desc 93/33493/4
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 16 Oct 2018 15:58:21 +0000 (00:58 +0900)
committerOleg Drokin <green@whamcloud.com>
Tue, 13 Nov 2018 06:17:22 +0000 (06:17 +0000)
Get rid of cfs_crypto_hash_desc, and use ahash_request instead.

Test-Parameters: testlist=sanity-sec envdefinitions=SHARED_KEY=true
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: If47f5e66846459e8951779f4c6db22a9e4cf23a8
Reviewed-on: https://review.whamcloud.com/33493
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_crypto.h
libcfs/libcfs/linux/linux-crypto.c
lustre/obdclass/integrity.c
lustre/osc/osc_request.c
lustre/ptlrpc/gss/gss_crypto.c
lustre/ptlrpc/gss/gss_crypto.h
lustre/ptlrpc/gss/gss_krb5_mech.c
lustre/ptlrpc/gss/gss_sk_mech.c
lustre/ptlrpc/sec_bulk.c
lustre/target/tgt_handler.c

index af67f53..8271306 100644 (file)
@@ -298,18 +298,17 @@ int cfs_crypto_hash_digest(enum cfs_crypto_hash_alg hash_alg,
                           unsigned char *hash, unsigned int *hash_len);
 
 /* cfs crypto hash descriptor */
-struct cfs_crypto_hash_desc;
 struct page;
 
-struct cfs_crypto_hash_desc *
+struct ahash_request *
        cfs_crypto_hash_init(enum cfs_crypto_hash_alg hash_alg,
                             unsigned char *key, unsigned int key_len);
-int cfs_crypto_hash_update_page(struct cfs_crypto_hash_desc *desc,
+int cfs_crypto_hash_update_page(struct ahash_request *req,
                                struct page *page, unsigned int offset,
                                unsigned int len);
-int cfs_crypto_hash_update(struct cfs_crypto_hash_desc *desc, const void *buf,
+int cfs_crypto_hash_update(struct ahash_request *req, const void *buf,
                           unsigned int buf_len);
-int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *desc,
+int cfs_crypto_hash_final(struct ahash_request *req,
                          unsigned char *hash, unsigned int *hash_len);
 int cfs_crypto_register(void);
 void cfs_crypto_unregister(void);
index 4aab16e..dce1734 100644 (file)
@@ -207,10 +207,10 @@ EXPORT_SYMBOL(cfs_crypto_hash_digest);
  *                     use default initial value
  * \param[in] key_len  length of \a key in bytes
  *
- * \retval             pointer to descriptor of hash instance
+ * \retval             pointer to ahash request
  * \retval             ERR_PTR(errno) in case of error
  */
-struct cfs_crypto_hash_desc *
+struct ahash_request *
        cfs_crypto_hash_init(enum cfs_crypto_hash_alg hash_alg,
                             unsigned char *key, unsigned int key_len)
 {
@@ -221,14 +221,14 @@ struct cfs_crypto_hash_desc *
        err = cfs_crypto_hash_alloc(hash_alg, &type, &req, key, key_len);
        if (err)
                return ERR_PTR(err);
-       return (struct cfs_crypto_hash_desc *)req;
+       return req;
 }
 EXPORT_SYMBOL(cfs_crypto_hash_init);
 
 /**
  * Update hash digest computed on data within the given \a page
  *
- * \param[in] hdesc    hash state descriptor
+ * \param[in] req      ahash request
  * \param[in] page     data page on which to compute the hash
  * \param[in] offset   offset within \a page at which to start hash
  * \param[in] len      length of data on which to compute hash
@@ -236,11 +236,10 @@ EXPORT_SYMBOL(cfs_crypto_hash_init);
  * \retval             0 for success
  * \retval             negative errno on failure
  */
-int cfs_crypto_hash_update_page(struct cfs_crypto_hash_desc *hdesc,
+int cfs_crypto_hash_update_page(struct ahash_request *req,
                                struct page *page, unsigned int offset,
                                unsigned int len)
 {
-       struct ahash_request *req = (void *)hdesc;
        struct scatterlist sl;
 
        sg_init_table(&sl, 1);
@@ -254,17 +253,16 @@ EXPORT_SYMBOL(cfs_crypto_hash_update_page);
 /**
  * Update hash digest computed on the specified data
  *
- * \param[in] hdesc    hash state descriptor
+ * \param[in] req      ahash request
  * \param[in] buf      data buffer on which to compute the hash
  * \param[in] buf_len  length of \buf on which to compute hash
  *
  * \retval             0 for success
  * \retval             negative errno on failure
  */
-int cfs_crypto_hash_update(struct cfs_crypto_hash_desc *hdesc,
+int cfs_crypto_hash_update(struct ahash_request *req,
                           const void *buf, unsigned int buf_len)
 {
-       struct ahash_request *req = (void *)hdesc;
        struct scatterlist sl;
 
        sg_init_one(&sl, (void *)buf, buf_len);
@@ -277,7 +275,7 @@ EXPORT_SYMBOL(cfs_crypto_hash_update);
 /**
  * Finish hash calculation, copy hash digest to buffer, clean up hash descriptor
  *
- * \param[in]  hdesc           hash descriptor
+ * \param[in]  req             ahash request
  * \param[out] hash            pointer to hash buffer to store hash digest
  * \param[in,out] hash_len     pointer to hash buffer size, if \a hash == NULL
  *                             or hash_len == NULL only free \a hdesc instead
@@ -287,10 +285,9 @@ EXPORT_SYMBOL(cfs_crypto_hash_update);
  * \retval             -EOVERFLOW if hash_len is too small for the hash digest
  * \retval             negative errno for other errors from lower layers
  */
-int cfs_crypto_hash_final(struct cfs_crypto_hash_desc *hdesc,
+int cfs_crypto_hash_final(struct ahash_request *req,
                          unsigned char *hash, unsigned int *hash_len)
 {
-       struct ahash_request *req = (void *)hdesc;
        int size = crypto_ahash_digestsize(crypto_ahash_reqtfm(req));
        int err;
 
@@ -355,23 +352,23 @@ static void cfs_crypto_performance_test(enum cfs_crypto_hash_alg hash_alg)
 
        for (start = jiffies, end = start + msecs_to_jiffies(MSEC_PER_SEC / 4),
             bcount = 0; time_before(jiffies, end) && err == 0; bcount++) {
-               struct cfs_crypto_hash_desc *hdesc;
+               struct ahash_request *req;
                int i;
 
-               hdesc = cfs_crypto_hash_init(hash_alg, NULL, 0);
-               if (IS_ERR(hdesc)) {
-                       err = PTR_ERR(hdesc);
+               req = cfs_crypto_hash_init(hash_alg, NULL, 0);
+               if (IS_ERR(req)) {
+                       err = PTR_ERR(req);
                        break;
                }
 
                for (i = 0; i < buf_len / PAGE_SIZE; i++) {
-                       err = cfs_crypto_hash_update_page(hdesc, page, 0,
+                       err = cfs_crypto_hash_update_page(req, page, 0,
                                                          PAGE_SIZE);
                        if (err != 0)
                                break;
                }
 
-               err = cfs_crypto_hash_final(hdesc, hash, &hash_len);
+               err = cfs_crypto_hash_final(req, hash, &hash_len);
                if (err != 0)
                        break;
        }
index a48e5e9..c203fee 100644 (file)
@@ -85,7 +85,7 @@ static int __obd_t10_performance_test(const char *obd_name,
                                      int repeat_number)
 {
        unsigned char cfs_alg = cksum_obd2cfs(OBD_CKSUM_T10_TOP);
-       struct cfs_crypto_hash_desc *hdesc;
+       struct ahash_request *req;
        obd_dif_csum_fn *fn = NULL;
        unsigned int bufsize;
        unsigned char *buffer;
@@ -108,9 +108,9 @@ static int __obd_t10_performance_test(const char *obd_name,
        if (__page == NULL)
                return -ENOMEM;
 
-       hdesc = cfs_crypto_hash_init(cfs_alg, NULL, 0);
-       if (IS_ERR(hdesc)) {
-               rc = PTR_ERR(hdesc);
+       req = cfs_crypto_hash_init(cfs_alg, NULL, 0);
+       if (IS_ERR(req)) {
+               rc = PTR_ERR(req);
                CERROR("%s: unable to initialize checksum hash %s: rc = %d\n",
                       obd_name, cfs_crypto_hash_name(cfs_alg), rc);
                GOTO(out, rc);
@@ -134,7 +134,7 @@ static int __obd_t10_performance_test(const char *obd_name,
 
                used_number += used;
                if (used_number == guard_number) {
-                       cfs_crypto_hash_update_page(hdesc, __page, 0,
+                       cfs_crypto_hash_update_page(req, __page, 0,
                                used_number * sizeof(*guard_start));
                        used_number = 0;
                }
@@ -144,12 +144,12 @@ static int __obd_t10_performance_test(const char *obd_name,
                GOTO(out_final, rc);
 
        if (used_number != 0)
-               cfs_crypto_hash_update_page(hdesc, __page, 0,
+               cfs_crypto_hash_update_page(req, __page, 0,
                        used_number * sizeof(*guard_start));
 
        bufsize = sizeof(cksum);
 out_final:
-       rc2 = cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize);
+       rc2 = cfs_crypto_hash_final(req, (unsigned char *)&cksum, &bufsize);
        rc = rc ? rc : rc2;
 out:
        __free_page(__page);
index 5875149..0b8e290 100644 (file)
@@ -1106,7 +1106,7 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
                                   int sector_size,
                                   u32 *check_sum)
 {
-       struct cfs_crypto_hash_desc *hdesc;
+       struct ahash_request *req;
        /* Used Adler as the default checksum type on top of DIF tags */
        unsigned char cfs_alg = cksum_obd2cfs(OBD_CKSUM_T10_TOP);
        struct page *__page;
@@ -1126,9 +1126,9 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
        if (__page == NULL)
                return -ENOMEM;
 
-       hdesc = cfs_crypto_hash_init(cfs_alg, NULL, 0);
-       if (IS_ERR(hdesc)) {
-               rc = PTR_ERR(hdesc);
+       req = cfs_crypto_hash_init(cfs_alg, NULL, 0);
+       if (IS_ERR(req)) {
+               rc = PTR_ERR(req);
                CERROR("%s: unable to initialize checksum hash %s: rc = %d\n",
                       obd_name, cfs_crypto_hash_name(cfs_alg), rc);
                GOTO(out, rc);
@@ -1166,7 +1166,7 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
 
                used_number += used;
                if (used_number == guard_number) {
-                       cfs_crypto_hash_update_page(hdesc, __page, 0,
+                       cfs_crypto_hash_update_page(req, __page, 0,
                                used_number * sizeof(*guard_start));
                        used_number = 0;
                }
@@ -1180,11 +1180,11 @@ static int osc_checksum_bulk_t10pi(const char *obd_name, int nob,
                GOTO(out, rc);
 
        if (used_number != 0)
-               cfs_crypto_hash_update_page(hdesc, __page, 0,
+               cfs_crypto_hash_update_page(req, __page, 0,
                        used_number * sizeof(*guard_start));
 
        bufsize = sizeof(cksum);
-       cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize);
+       cfs_crypto_hash_final(req, (unsigned char *)&cksum, &bufsize);
 
        /* For sending we only compute the wrong checksum instead
         * of corrupting the data so it is still correct on a redo */
@@ -1203,17 +1203,17 @@ static int osc_checksum_bulk(int nob, size_t pg_count,
                             u32 *cksum)
 {
        int                             i = 0;
-       struct cfs_crypto_hash_desc     *hdesc;
+       struct ahash_request           *req;
        unsigned int                    bufsize;
        unsigned char                   cfs_alg = cksum_obd2cfs(cksum_type);
 
        LASSERT(pg_count > 0);
 
-       hdesc = cfs_crypto_hash_init(cfs_alg, NULL, 0);
-       if (IS_ERR(hdesc)) {
+       req = cfs_crypto_hash_init(cfs_alg, NULL, 0);
+       if (IS_ERR(req)) {
                CERROR("Unable to initialize checksum hash %s\n",
                       cfs_crypto_hash_name(cfs_alg));
-               return PTR_ERR(hdesc);
+               return PTR_ERR(req);
        }
 
        while (nob > 0 && pg_count > 0) {
@@ -1229,7 +1229,7 @@ static int osc_checksum_bulk(int nob, size_t pg_count,
                        memcpy(ptr + off, "bad1", min_t(typeof(nob), 4, nob));
                        kunmap(pga[i]->pg);
                }
-               cfs_crypto_hash_update_page(hdesc, pga[i]->pg,
+               cfs_crypto_hash_update_page(req, pga[i]->pg,
                                            pga[i]->off & ~PAGE_MASK,
                                            count);
                LL_CDEBUG_PAGE(D_PAGE, pga[i]->pg, "off %d\n",
@@ -1241,7 +1241,7 @@ static int osc_checksum_bulk(int nob, size_t pg_count,
        }
 
        bufsize = sizeof(*cksum);
-       cfs_crypto_hash_final(hdesc, (unsigned char *)cksum, &bufsize);
+       cfs_crypto_hash_final(req, (unsigned char *)cksum, &bufsize);
 
        /* For sending we only compute the wrong checksum instead
         * of corrupting the data so it is still correct on a redo */
index cadb4d4..4231a0a 100644 (file)
@@ -270,12 +270,11 @@ out:
        return ret;
 }
 
-int gss_digest_hash(struct cfs_crypto_hash_desc *desc,
+int gss_digest_hash(struct ahash_request *req,
                    rawobj_t *hdr, int msgcnt, rawobj_t *msgs,
                    int iovcnt, lnet_kiov_t *iovs,
                    rawobj_t *cksum)
 {
-       struct ahash_request *req = (struct ahash_request *)desc;
        struct scatterlist sg[1];
        struct sg_table sgt;
        int rc = 0;
index c0770e8..98950b1 100644 (file)
@@ -23,7 +23,7 @@ int gss_setup_sgtable(struct sg_table *sgt, struct scatterlist *prealloc_sg,
 void gss_teardown_sgtable(struct sg_table *sgt);
 int gss_crypt_generic(struct crypto_blkcipher *tfm, int decrypt, const void *iv,
                      const void *in, void *out, size_t length);
-int gss_digest_hash(struct cfs_crypto_hash_desc *desc, rawobj_t *hdr,
+int gss_digest_hash(struct ahash_request *req, rawobj_t *hdr,
                    int msgcnt, rawobj_t *msgs, int iovcnt, lnet_kiov_t *iovs,
                    rawobj_t *cksum);
 int gss_add_padding(rawobj_t *msg, int msg_buflen, int blocksize);
index 305402d..271350f 100644 (file)
@@ -448,7 +448,7 @@ __s32 krb5_make_checksum(__u32 enctype,
                         rawobj_t *cksum)
 {
        struct krb5_enctype *ke = &enctypes[enctype];
-       struct cfs_crypto_hash_desc *desc = NULL;
+       struct ahash_request *req = NULL;
        enum cfs_crypto_hash_alg hash_algo;
        rawobj_t hdr;
        int rc;
@@ -457,12 +457,12 @@ __s32 krb5_make_checksum(__u32 enctype,
 
        /* For the cbc(des) case we want md5 instead of hmac(md5) */
        if (strcmp(ke->ke_enc_name, "cbc(des)"))
-               desc = cfs_crypto_hash_init(hash_algo, kb->kb_key.data,
+               req = cfs_crypto_hash_init(hash_algo, kb->kb_key.data,
                                           kb->kb_key.len);
        else
-               desc = cfs_crypto_hash_init(hash_algo, NULL, 0);
-       if (IS_ERR(desc)) {
-               rc = PTR_ERR(desc);
+               req = cfs_crypto_hash_init(hash_algo, NULL, 0);
+       if (IS_ERR(req)) {
+               rc = PTR_ERR(req);
                CERROR("failed to alloc hash %s : rc = %d\n",
                       ke->ke_hash_name, rc);
                goto out_no_hash;
@@ -479,7 +479,7 @@ __s32 krb5_make_checksum(__u32 enctype,
        hdr.data = (__u8 *)khdr;
        hdr.len = sizeof(*khdr);
 
-       rc = gss_digest_hash(desc, &hdr, msgcnt, msgs,
+       rc = gss_digest_hash(req, &hdr, msgcnt, msgs,
                             iovcnt, iovs, cksum);
        if (rc)
                goto out_free_hash;
@@ -487,7 +487,7 @@ __s32 krb5_make_checksum(__u32 enctype,
        if (!ke->ke_hash_hmac) {
                LASSERT(kb->kb_tfm);
 
-               cfs_crypto_hash_final(desc, cksum->data, &cksum->len);
+               cfs_crypto_hash_final(req, cksum->data, &cksum->len);
                rc = gss_crypt_generic(kb->kb_tfm, 0, NULL,
                                       cksum->data, cksum->data,
                                       cksum->len);
@@ -495,8 +495,8 @@ __s32 krb5_make_checksum(__u32 enctype,
        }
 
 out_free_hash:
-       if (desc)
-               cfs_crypto_hash_final(desc, cksum->data, &cksum->len);
+       if (req)
+               cfs_crypto_hash_final(req, cksum->data, &cksum->len);
 out_no_hash:
        return rc ? GSS_S_FAILURE : GSS_S_COMPLETE;
 }
index 9fab35a..5877726 100644 (file)
@@ -318,18 +318,18 @@ u32 sk_make_hmac(enum cfs_crypto_hash_alg algo, rawobj_t *key, int msg_count,
                 rawobj_t *msgs, int iov_count, lnet_kiov_t *iovs,
                 rawobj_t *token)
 {
-       struct cfs_crypto_hash_desc *desc;
+       struct ahash_request *req;
        int rc2, rc;
 
-       desc = cfs_crypto_hash_init(algo, key->data, key->len);
-       if (IS_ERR(desc)) {
-               rc = PTR_ERR(desc);
+       req = cfs_crypto_hash_init(algo, key->data, key->len);
+       if (IS_ERR(req)) {
+               rc = PTR_ERR(req);
                goto out_init_failed;
        }
 
-       rc2 = gss_digest_hash(desc, NULL, msg_count, msgs, iov_count, iovs,
+       rc2 = gss_digest_hash(req, NULL, msg_count, msgs, iov_count, iovs,
                              token);
-       rc = cfs_crypto_hash_final(desc, key->data, &key->len);
+       rc = cfs_crypto_hash_final(req, key->data, &key->len);
        if (!rc && rc2)
                rc = rc2;
 out_init_failed:
@@ -399,7 +399,6 @@ u32 sk_verify_bulk_hmac(enum cfs_crypto_hash_alg sc_hmac, rawobj_t *key,
                        int msgcnt, rawobj_t *msgs, int iovcnt,
                        lnet_kiov_t *iovs, int iov_bytes, rawobj_t *token)
 {
-       struct cfs_crypto_hash_desc *desc;
        rawobj_t checksum = RAWOBJ_EMPTY;
        struct ahash_request *req;
        struct scatterlist sg[1];
@@ -419,11 +418,10 @@ u32 sk_verify_bulk_hmac(enum cfs_crypto_hash_alg sc_hmac, rawobj_t *key,
        if (!checksum.data)
                return rc;
 
-       desc = cfs_crypto_hash_init(sc_hmac, key->data, key->len);
-       if (IS_ERR(desc))
+       req = cfs_crypto_hash_init(sc_hmac, key->data, key->len);
+       if (IS_ERR(req))
                goto cleanup;
 
-       req = (struct ahash_request *) desc;
        for (i = 0; i < msgcnt; i++) {
                if (!msgs[i].len)
                        continue;
@@ -466,7 +464,7 @@ u32 sk_verify_bulk_hmac(enum cfs_crypto_hash_alg sc_hmac, rawobj_t *key,
        rc = GSS_S_COMPLETE;
 
 hash_cleanup:
-       cfs_crypto_hash_final(desc, checksum.data, &checksum.len);
+       cfs_crypto_hash_final(req, checksum.data, &checksum.len);
 
 cleanup:
        OBD_FREE_LARGE(checksum.data, checksum.len);
index f8d3222..db87414 100644 (file)
@@ -916,7 +916,7 @@ EXPORT_SYMBOL(bulk_sec_desc_unpack);
 int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg,
                              void *buf, int buflen)
 {
-       struct cfs_crypto_hash_desc     *hdesc;
+       struct ahash_request           *req;
        int                             hashsize;
        unsigned int                    bufsize;
        int                             i, err;
@@ -925,17 +925,17 @@ int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg,
        LASSERT(alg > BULK_HASH_ALG_NULL && alg < BULK_HASH_ALG_MAX);
        LASSERT(buflen >= 4);
 
-       hdesc = cfs_crypto_hash_init(cfs_hash_alg_id[alg], NULL, 0);
-       if (IS_ERR(hdesc)) {
+       req = cfs_crypto_hash_init(cfs_hash_alg_id[alg], NULL, 0);
+       if (IS_ERR(req)) {
                CERROR("Unable to initialize checksum hash %s\n",
                       cfs_crypto_hash_name(cfs_hash_alg_id[alg]));
-               return PTR_ERR(hdesc);
+               return PTR_ERR(req);
        }
 
        hashsize = cfs_crypto_hash_digestsize(cfs_hash_alg_id[alg]);
 
        for (i = 0; i < desc->bd_iov_count; i++) {
-               cfs_crypto_hash_update_page(hdesc,
+               cfs_crypto_hash_update_page(req,
                                  BD_GET_KIOV(desc, i).kiov_page,
                                  BD_GET_KIOV(desc, i).kiov_offset &
                                              ~PAGE_MASK,
@@ -948,11 +948,11 @@ int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg,
                bufsize = sizeof(hashbuf);
                LASSERTF(bufsize >= hashsize, "bufsize = %u < hashsize %u\n",
                         bufsize, hashsize);
-               err = cfs_crypto_hash_final(hdesc, hashbuf, &bufsize);
+               err = cfs_crypto_hash_final(req, hashbuf, &bufsize);
                memcpy(buf, hashbuf, buflen);
        } else {
                bufsize = buflen;
-               err = cfs_crypto_hash_final(hdesc, buf, &bufsize);
+               err = cfs_crypto_hash_final(req, buf, &bufsize);
        }
 
        return err;
index a28ab03..e60df76 100644 (file)
@@ -1720,16 +1720,16 @@ static int tgt_checksum_niobuf(struct lu_target *tgt,
                                 int opc, enum cksum_types cksum_type,
                                 __u32 *cksum)
 {
-       struct cfs_crypto_hash_desc     *hdesc;
+       struct ahash_request           *req;
        unsigned int                    bufsize;
        int                             i, err;
        unsigned char                   cfs_alg = cksum_obd2cfs(cksum_type);
 
-       hdesc = cfs_crypto_hash_init(cfs_alg, NULL, 0);
-       if (IS_ERR(hdesc)) {
+       req = cfs_crypto_hash_init(cfs_alg, NULL, 0);
+       if (IS_ERR(req)) {
                CERROR("%s: unable to initialize checksum hash %s\n",
                       tgt_name(tgt), cfs_crypto_hash_name(cfs_alg));
-               return PTR_ERR(hdesc);
+               return PTR_ERR(req);
        }
 
        CDEBUG(D_INFO, "Checksum for algo %s\n", cfs_crypto_hash_name(cfs_alg));
@@ -1755,7 +1755,7 @@ static int tgt_checksum_niobuf(struct lu_target *tgt,
                                 * display in dump_all_bulk_pages() */
                                np->index = i;
 
-                               cfs_crypto_hash_update_page(hdesc, np, off,
+                               cfs_crypto_hash_update_page(req, np, off,
                                                            len);
                                continue;
                        } else {
@@ -1763,7 +1763,7 @@ static int tgt_checksum_niobuf(struct lu_target *tgt,
                                       tgt_name(tgt));
                        }
                }
-               cfs_crypto_hash_update_page(hdesc, local_nb[i].lnb_page,
+               cfs_crypto_hash_update_page(req, local_nb[i].lnb_page,
                                  local_nb[i].lnb_page_offset & ~PAGE_MASK,
                                  local_nb[i].lnb_len);
 
@@ -1788,7 +1788,7 @@ static int tgt_checksum_niobuf(struct lu_target *tgt,
                                 * display in dump_all_bulk_pages() */
                                np->index = i;
 
-                               cfs_crypto_hash_update_page(hdesc, np, off,
+                               cfs_crypto_hash_update_page(req, np, off,
                                                            len);
                                continue;
                        } else {
@@ -1799,7 +1799,7 @@ static int tgt_checksum_niobuf(struct lu_target *tgt,
        }
 
        bufsize = sizeof(*cksum);
-       err = cfs_crypto_hash_final(hdesc, (unsigned char *)cksum, &bufsize);
+       err = cfs_crypto_hash_final(req, (unsigned char *)cksum, &bufsize);
 
        return 0;
 }
@@ -1951,7 +1951,7 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt,
        enum cksum_types t10_cksum_type = tgt->lut_dt_conf.ddp_t10_cksum_type;
        unsigned char cfs_alg = cksum_obd2cfs(OBD_CKSUM_T10_TOP);
        const char *obd_name = tgt->lut_obd->obd_name;
-       struct cfs_crypto_hash_desc *hdesc;
+       struct ahash_request *req;
        unsigned int bufsize;
        unsigned char *buffer;
        struct page *__page;
@@ -1967,11 +1967,11 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt,
        if (__page == NULL)
                return -ENOMEM;
 
-       hdesc = cfs_crypto_hash_init(cfs_alg, NULL, 0);
-       if (IS_ERR(hdesc)) {
+       req = cfs_crypto_hash_init(cfs_alg, NULL, 0);
+       if (IS_ERR(req)) {
                CERROR("%s: unable to initialize checksum hash %s\n",
                       tgt_name(tgt), cfs_crypto_hash_name(cfs_alg));
-               return PTR_ERR(hdesc);
+               return PTR_ERR(req);
        }
 
        buffer = kmap(__page);
@@ -1999,7 +1999,7 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt,
                                 * display in dump_all_bulk_pages() */
                                np->index = i;
 
-                               cfs_crypto_hash_update_page(hdesc, np, off,
+                               cfs_crypto_hash_update_page(req, np, off,
                                                            len);
                                continue;
                        } else {
@@ -2044,7 +2044,7 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt,
 
                used_number += used;
                if (used_number == guard_number) {
-                       cfs_crypto_hash_update_page(hdesc, __page, 0,
+                       cfs_crypto_hash_update_page(req, __page, 0,
                                used_number * sizeof(*guard_start));
                        used_number = 0;
                }
@@ -2070,7 +2070,7 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt,
                                 * display in dump_all_bulk_pages() */
                                np->index = i;
 
-                               cfs_crypto_hash_update_page(hdesc, np, off,
+                               cfs_crypto_hash_update_page(req, np, off,
                                                            len);
                                continue;
                        } else {
@@ -2084,11 +2084,11 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt,
                GOTO(out, rc);
 
        if (used_number != 0)
-               cfs_crypto_hash_update_page(hdesc, __page, 0,
+               cfs_crypto_hash_update_page(req, __page, 0,
                        used_number * sizeof(*guard_start));
 
        bufsize = sizeof(cksum);
-       rc = cfs_crypto_hash_final(hdesc, (unsigned char *)&cksum, &bufsize);
+       rc = cfs_crypto_hash_final(req, (unsigned char *)&cksum, &bufsize);
 
        if (rc == 0)
                *check_sum = cksum;