Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1315879
| From | Herbert Xu <herbert@gondor.apana.org.au> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 24/26] nfsd: Use shash |
| Date | 2016-01-24 14:30 +0100 |
| Message-ID | <qUsTT-5op-1@gated-at.bofh.it> (permalink) |
| References | <qUsKd-5k1-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
This patch replaces uses of the long obsolete hash interface with
shash.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
fs/nfsd/nfs4recover.c | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
index 79f0307..a79c150 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
@@ -32,10 +32,10 @@
*
*/
+#include <crypto/hash.h>
#include <linux/file.h>
#include <linux/slab.h>
#include <linux/namei.h>
-#include <linux/crypto.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/module.h>
@@ -104,29 +104,35 @@ static int
nfs4_make_rec_clidname(char *dname, const struct xdr_netobj *clname)
{
struct xdr_netobj cksum;
- struct hash_desc desc;
- struct scatterlist sg;
+ struct crypto_shash *tfm;
int status;
dprintk("NFSD: nfs4_make_rec_clidname for %.*s\n",
clname->len, clname->data);
- desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
- desc.tfm = crypto_alloc_hash("md5", 0, CRYPTO_ALG_ASYNC);
- if (IS_ERR(desc.tfm)) {
- status = PTR_ERR(desc.tfm);
+ tfm = crypto_alloc_shash("md5", 0, 0);
+ if (IS_ERR(tfm)) {
+ status = PTR_ERR(tfm);
goto out_no_tfm;
}
- cksum.len = crypto_hash_digestsize(desc.tfm);
+ cksum.len = crypto_shash_digestsize(tfm);
cksum.data = kmalloc(cksum.len, GFP_KERNEL);
if (cksum.data == NULL) {
status = -ENOMEM;
goto out;
}
- sg_init_one(&sg, clname->data, clname->len);
+ {
+ SHASH_DESC_ON_STACK(desc, tfm);
+
+ desc->tfm = tfm;
+ desc->flags = CRYPTO_TFM_REQ_MAY_SLEEP;
+
+ status = crypto_shash_digest(desc, clname->data, clname->len,
+ cksum.data);
+ shash_desc_zero(desc);
+ }
- status = crypto_hash_digest(&desc, &sg, sg.length, cksum.data);
if (status)
goto out;
@@ -135,7 +141,7 @@ nfs4_make_rec_clidname(char *dname, const struct xdr_netobj *clname)
status = 0;
out:
kfree(cksum.data);
- crypto_free_hash(desc.tfm);
+ crypto_free_shash(tfm);
out_no_tfm:
return status;
}
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/26] crypto: Use skcipher and ahash/shash where possible Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
[PATCH 8/26] cifs: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
[PATCH 11/26] f2fs: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
[PATCH 13/26] lib80211: Use skcipher and ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
[PATCH 1/26] block: cryptoloop - Use new skcipher interface Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
Re: [PATCH 1/26] block: cryptoloop - Use new skcipher interface kbuild test robot <lkp@intel.com> - 2016-01-24 14:40 +0100
Re: [PATCH 1/26] block: cryptoloop - Use new skcipher interface Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:50 +0100
[PATCH 16/26] libceph: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
Re: [PATCH 16/26] libceph: Use skcipher Ilya Dryomov <idryomov@gmail.com> - 2016-01-25 17:20 +0100
Re: [PATCH 16/26] libceph: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-26 12:00 +0100
Re: [PATCH 16/26] libceph: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-26 12:40 +0100
Re: [PATCH 16/26] libceph: Use skcipher Ilya Dryomov <idryomov@gmail.com> - 2016-01-26 12:40 +0100
[PATCH 14/26] KEYS: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
[PATCH 6/26] staging: rtl8192u: Use skcipher and ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
Re: [PATCH 6/26] staging: rtl8192u: Use skcipher and ahash Greg KH <greg@kroah.com> - 2016-01-24 21:10 +0100
[PATCH 3/26] staging: rtl8192e: Replace uses of obsolete blkcipher and hash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
Re: [PATCH 3/26] staging: rtl8192e: Replace uses of obsolete blkcipher and hash Greg KH <greg@kroah.com> - 2016-01-24 21:10 +0100
[PATCH 5/26] orinoco: Use ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:20 +0100
[PATCH 24/26] nfsd: Use shash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
[PATCH 25/26] sctp: Use shash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [PATCH 25/26] sctp: Use shash David Miller <davem@davemloft.net> - 2016-01-25 07:10 +0100
[PATCH 10/26] ext4: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
[PATCH 18/26] rxrpc: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
[PATCH 17/26] mac802154: Use skcipher Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [PATCH 17/26] mac802154: Use skcipher Stefan Schmidt <stefan@osg.samsung.com> - 2016-01-26 18:00 +0100
[PATCH 4/26] dm crypt: Use skcipher and ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [PATCH 4/26] dm crypt: Use skcipher and ahash kbuild test robot <lkp@intel.com> - 2016-01-24 14:50 +0100
[PATCH 22/26] iscsi_tcp: Use ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [dm-devel] [PATCH 22/26] iscsi_tcp: Use ahash Mike Christie <michaelc@cs.wisc.edu> - 2016-01-25 21:00 +0100
[PATCH 26/26] tcp: Use ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [PATCH 26/26] tcp: Use ahash David Miller <davem@davemloft.net> - 2016-01-25 07:10 +0100
[PATCH 23/26] iscsi-target: Use shash and ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
[PATCH 19/26] ipsec: Use skcipher and ahash when probing algorithms Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [PATCH 19/26] ipsec: Use skcipher and ahash when probing algorithms kbuild test robot <lkp@intel.com> - 2016-01-24 14:50 +0100
Re: [PATCH 19/26] ipsec: Use skcipher and ahash when probing algorithms David Miller <davem@davemloft.net> - 2016-01-25 07:10 +0100
[PATCH 20/26] drbd: Use shash and ahash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
[PATCH 21/26] nfc: s3fwrn5: Use shash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [PATCH 21/26] nfc: s3fwrn5: Use shash kbuild test robot <lkp@intel.com> - 2016-01-24 15:00 +0100
[PATCH 15/26] Bluetooth: Use skcipher and hash Herbert Xu <herbert@gondor.apana.org.au> - 2016-01-24 14:30 +0100
Re: [PATCH 15/26] Bluetooth: Use skcipher and hash Marcel Holtmann <marcel@holtmann.org> - 2016-01-25 07:50 +0100
csiph-web