lustre 2.10.3 diff
The snippet can be accessed without any authentication.
Authored by
Arif Ali
lustre-2.10.3.patch 9.31 KiB
diff --git a/lustre/ptlrpc/gss/gss_crypto.c b/lustre/ptlrpc/gss/gss_crypto.c
index 17fd9cf..bfb400f 100644
--- a/lustre/ptlrpc/gss/gss_crypto.c
+++ b/lustre/ptlrpc/gss/gss_crypto.c
@@ -48,6 +48,8 @@
#define DEBUG_SUBSYSTEM S_SEC
+#include <crypto/hash.h>
+
#include <libcfs/linux/linux-crypto.h>
#include <obd.h>
#include <obd_support.h>
@@ -270,14 +272,14 @@ out:
return ret;
}
-int gss_digest_hmac(struct crypto_hash *tfm,
+int gss_digest_hmac(struct crypto_shash *tfm,
rawobj_t *key,
rawobj_t *hdr,
int msgcnt, rawobj_t *msgs,
int iovcnt, lnet_kiov_t *iovs,
rawobj_t *cksum)
{
- struct hash_desc desc = {
+ struct shash_desc desc = {
.tfm = tfm,
.flags = 0,
};
@@ -286,11 +288,11 @@ int gss_digest_hmac(struct crypto_hash *tfm,
int i;
int rc;
- rc = crypto_hash_setkey(tfm, key->data, key->len);
+ rc = crypto_shash_setkey(tfm, key->data, key->len);
if (rc)
return rc;
- rc = crypto_hash_init(&desc);
+ rc = crypto_shash_init(&desc);
if (rc)
return rc;
@@ -301,7 +303,7 @@ int gss_digest_hmac(struct crypto_hash *tfm,
rc = gss_setup_sgtable(&sgt, sg, msgs[i].data, msgs[i].len);
if (rc != 0)
return rc;
- rc = crypto_hash_update(&desc, sg, msgs[i].len);
+ rc = crypto_shash_update(&desc, sg, msgs[i].len);
if (rc)
return rc;
@@ -315,7 +317,7 @@ int gss_digest_hmac(struct crypto_hash *tfm,
sg_init_table(sg, 1);
sg_set_page(&sg[0], iovs[i].kiov_page, iovs[i].kiov_len,
iovs[i].kiov_offset);
- rc = crypto_hash_update(&desc, sg, iovs[i].kiov_len);
+ rc = crypto_shash_update(&desc, sg, iovs[i].kiov_len);
if (rc)
return rc;
}
@@ -324,24 +326,24 @@ int gss_digest_hmac(struct crypto_hash *tfm,
rc = gss_setup_sgtable(&sgt, sg, hdr, sizeof(*hdr));
if (rc != 0)
return rc;
- rc = crypto_hash_update(&desc, sg, sizeof(hdr->len));
+ rc = crypto_shash_update(&desc, sg, sizeof(hdr->len));
if (rc)
return rc;
gss_teardown_sgtable(&sgt);
}
- return crypto_hash_final(&desc, cksum->data);
+ return crypto_shash_final(&desc, cksum->data);
}
-int gss_digest_norm(struct crypto_hash *tfm,
+int gss_digest_norm(struct crypto_shash *tfm,
struct gss_keyblock *kb,
rawobj_t *hdr,
int msgcnt, rawobj_t *msgs,
int iovcnt, lnet_kiov_t *iovs,
rawobj_t *cksum)
{
- struct hash_desc desc;
+ struct shash_desc desc;
struct scatterlist sg[1];
struct sg_table sgt;
int i;
@@ -351,7 +353,7 @@ int gss_digest_norm(struct crypto_hash *tfm,
desc.tfm = tfm;
desc.flags = 0;
- rc = crypto_hash_init(&desc);
+ rc = crypto_shash_init(&desc);
if (rc)
return rc;
@@ -363,7 +365,7 @@ int gss_digest_norm(struct crypto_hash *tfm,
if (rc != 0)
return rc;
- rc = crypto_hash_update(&desc, sg, msgs[i].len);
+ rc = crypto_shash_update(&desc, sg, msgs[i].len);
if (rc)
return rc;
@@ -377,7 +379,7 @@ int gss_digest_norm(struct crypto_hash *tfm,
sg_init_table(sg, 1);
sg_set_page(&sg[0], iovs[i].kiov_page, iovs[i].kiov_len,
iovs[i].kiov_offset);
- rc = crypto_hash_update(&desc, sg, iovs[i].kiov_len);
+ rc = crypto_shash_update(&desc, sg, iovs[i].kiov_len);
if (rc)
return rc;
}
@@ -387,14 +389,14 @@ int gss_digest_norm(struct crypto_hash *tfm,
if (rc != 0)
return rc;
- rc = crypto_hash_update(&desc, sg, sizeof(*hdr));
+ rc = crypto_shash_update(&desc, sg, sizeof(*hdr));
if (rc)
return rc;
gss_teardown_sgtable(&sgt);
}
- rc = crypto_hash_final(&desc, cksum->data);
+ rc = crypto_shash_final(&desc, cksum->data);
if (rc)
return rc;
diff --git a/lustre/ptlrpc/gss/gss_crypto.h b/lustre/ptlrpc/gss/gss_crypto.h
index ad15cde..82e7f41 100644
--- a/lustre/ptlrpc/gss/gss_crypto.h
+++ b/lustre/ptlrpc/gss/gss_crypto.h
@@ -1,6 +1,8 @@
#ifndef PTLRPC_GSS_CRYPTO_H
#define PTLRPC_GSS_CRYPTO_H
+#include <crypto/hash.h>
+
#include "gss_internal.h"
struct gss_keyblock {
@@ -21,10 +23,10 @@ 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_hmac(struct crypto_hash *tfm, rawobj_t *key, rawobj_t *hdr,
+int gss_digest_hmac(struct crypto_shash *tfm, rawobj_t *key, rawobj_t *hdr,
int msgcnt, rawobj_t *msgs, int iovcnt, lnet_kiov_t *iovs,
rawobj_t *cksum);
-int gss_digest_norm(struct crypto_hash *tfm, struct gss_keyblock *kb,
+int gss_digest_norm(struct crypto_shash *tfm, struct gss_keyblock *kb,
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);
diff --git a/lustre/ptlrpc/gss/gss_krb5_mech.c b/lustre/ptlrpc/gss/gss_krb5_mech.c
index 000d7a8..c8cc595 100644
--- a/lustre/ptlrpc/gss/gss_krb5_mech.c
+++ b/lustre/ptlrpc/gss/gss_krb5_mech.c
@@ -52,9 +52,10 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/crypto.h>
#include <linux/mutex.h>
+#include <crypto/hash.h>
+
#include <obd.h>
#include <obd_class.h>
#include <obd_support.h>
@@ -441,17 +442,17 @@ __s32 krb5_make_checksum(__u32 enctype,
rawobj_t *cksum)
{
struct krb5_enctype *ke = &enctypes[enctype];
- struct crypto_hash *tfm;
+ struct crypto_shash *tfm;
rawobj_t hdr;
__u32 code = GSS_S_FAILURE;
int rc;
- if (!(tfm = crypto_alloc_hash(ke->ke_hash_name, 0, 0))) {
+ if (!(tfm = crypto_alloc_shash(ke->ke_hash_name, 0, 0))) {
CERROR("failed to alloc TFM: %s\n", ke->ke_hash_name);
return GSS_S_FAILURE;
}
- cksum->len = crypto_hash_digestsize(tfm);
+ cksum->len = crypto_shash_digestsize(tfm);
OBD_ALLOC_LARGE(cksum->data, cksum->len);
if (!cksum->data) {
cksum->len = 0;
@@ -471,7 +472,7 @@ __s32 krb5_make_checksum(__u32 enctype,
if (rc == 0)
code = GSS_S_COMPLETE;
out_tfm:
- crypto_free_hash(tfm);
+ crypto_free_shash(tfm);
return code;
}
diff --git a/lustre/ptlrpc/gss/gss_sk_mech.c b/lustre/ptlrpc/gss/gss_sk_mech.c
index fd1b071..98ed6c3 100644
--- a/lustre/ptlrpc/gss/gss_sk_mech.c
+++ b/lustre/ptlrpc/gss/gss_sk_mech.c
@@ -32,9 +32,9 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
-#include <linux/crypto.h>
#include <linux/mutex.h>
#include <crypto/ctr.h>
+#include <crypto/hash.h>
#include <obd.h>
#include <obd_class.h>
@@ -331,20 +331,20 @@ static
__u32 sk_make_hmac(char *alg_name, rawobj_t *key, int msg_count, rawobj_t *msgs,
int iov_count, lnet_kiov_t *iovs, rawobj_t *token)
{
- struct crypto_hash *tfm;
+ struct crypto_shash *tfm;
int rc;
- tfm = crypto_alloc_hash(alg_name, 0, 0);
+ tfm = crypto_alloc_shash(alg_name, 0, 0);
if (IS_ERR(tfm))
return GSS_S_FAILURE;
rc = GSS_S_FAILURE;
- LASSERT(token->len >= crypto_hash_digestsize(tfm));
+ LASSERT(token->len >= crypto_shash_digestsize(tfm));
if (!gss_digest_hmac(tfm, key, NULL, msg_count, msgs, iov_count, iovs,
token))
rc = GSS_S_COMPLETE;
- crypto_free_hash(tfm);
+ crypto_free_shash(tfm);
return rc;
}
@@ -411,7 +411,7 @@ __u32 sk_verify_bulk_hmac(struct sk_hmac_type *sht, rawobj_t *key,
{
rawobj_t checksum = RAWOBJ_EMPTY;
struct crypto_hash *tfm;
- struct hash_desc desc = {
+ struct shash_desc desc = {
.tfm = NULL,
.flags = 0,
};
@@ -432,19 +432,19 @@ __u32 sk_verify_bulk_hmac(struct sk_hmac_type *sht, rawobj_t *key,
if (!checksum.data)
return rc;
- tfm = crypto_alloc_hash(sht->sht_name, 0, 0);
+ tfm = crypto_alloc_shash(sht->sht_name, 0, 0);
if (IS_ERR(tfm))
goto cleanup;
desc.tfm = tfm;
- LASSERT(token->len >= crypto_hash_digestsize(tfm));
+ LASSERT(token->len >= crypto_shash_digestsize(tfm));
- rc = crypto_hash_setkey(tfm, key->data, key->len);
+ rc = crypto_shash_setkey(tfm, key->data, key->len);
if (rc)
goto hash_cleanup;
- rc = crypto_hash_init(&desc);
+ rc = crypto_shash_init(&desc);
if (rc)
goto hash_cleanup;
@@ -456,7 +456,7 @@ __u32 sk_verify_bulk_hmac(struct sk_hmac_type *sht, rawobj_t *key,
if (rc != 0)
goto hash_cleanup;
- rc = crypto_hash_update(&desc, sg, msgs[i].len);
+ rc = crypto_shash_update(&desc, sg, msgs[i].len);
if (rc) {
gss_teardown_sgtable(&sgt);
goto hash_cleanup;
@@ -475,12 +475,12 @@ __u32 sk_verify_bulk_hmac(struct sk_hmac_type *sht, rawobj_t *key,
sg_init_table(sg, 1);
sg_set_page(&sg[0], iovs[i].kiov_page, bytes,
iovs[i].kiov_offset);
- rc = crypto_hash_update(&desc, sg, bytes);
+ rc = crypto_shash_update(&desc, sg, bytes);
if (rc)
goto hash_cleanup;
}
- crypto_hash_final(&desc, checksum.data);
+ crypto_shash_final(&desc, checksum.data);
if (memcmp(token->data, checksum.data, checksum.len)) {
rc = GSS_S_BAD_SIG;
@@ -490,7 +490,7 @@ __u32 sk_verify_bulk_hmac(struct sk_hmac_type *sht, rawobj_t *key,
rc = GSS_S_COMPLETE;
hash_cleanup:
- crypto_free_hash(tfm);
+ crypto_free_shash(tfm);
cleanup:
OBD_FREE_LARGE(checksum.data, checksum.len);
Please register or sign in to comment