summaryrefslogtreecommitdiff
path: root/crypto/hmac.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-10-21 08:37:20 -0200
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-10-21 08:37:20 -0200
commitfc50fd7584832f2b4d03eca83ba1ecde4c473a3e (patch)
tree6589908c4c15c92420a97a60aab1026a0cd88deb /crypto/hmac.c
parentf5f52c34ba387c65f0838d2bd33f24387cf2ff3f (diff)
parent6de0bdb30d75edcf5f1e3f80da5b65670b9831f1 (diff)
downloadlinux-crypto-fc50fd7584832f2b4d03eca83ba1ecde4c473a3e.tar.gz
linux-crypto-fc50fd7584832f2b4d03eca83ba1ecde4c473a3e.zip
Merge tag 'v3.18-rc1' into v4l_for_linus
Linux 3.18-rc1 * tag 'v3.18-rc1': (9167 commits) Linux 3.18-rc1 MAINTAINERS: corrected bcm2835 search Net: DSA: Fix checking for get_phy_flags function sparc64: Do not define thread fpregs save area as zero-length array. sparc64: Fix corrupted thread fault code. MAINTAINERS: Become the docs maintainer x86,kvm,vmx: Preserve CR4 across VM entry ipv6: fix a potential use after free in sit.c ipv6: fix a potential use after free in ip6_offload.c ipv4: fix a potential use after free in gre_offload.c tcp: fix build error if IPv6 is not enabled futex: Ensure get_futex_key_refs() always implies a barrier bna: fix skb->truesize underestimation net: dsa: add includes for ethtool and phy_fixed definitions openvswitch: Set flow-key members. netrom: use linux/uaccess.h dsa: Fix conversion from host device to mii bus tipc: fix bug in bundled buffer reception ipv6: introduce tcp_v6_iif() sfc: add support for skb->xmit_more ...
Diffstat (limited to 'crypto/hmac.c')
-rw-r--r--crypto/hmac.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/crypto/hmac.c b/crypto/hmac.c
index 8d9544cf..e392219d 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -52,20 +52,17 @@ static int hmac_setkey(struct crypto_shash *parent,
struct hmac_ctx *ctx = align_ptr(opad + ss,
crypto_tfm_ctx_alignment());
struct crypto_shash *hash = ctx->hash;
- struct {
- struct shash_desc shash;
- char ctx[crypto_shash_descsize(hash)];
- } desc;
+ SHASH_DESC_ON_STACK(shash, hash);
unsigned int i;
- desc.shash.tfm = hash;
- desc.shash.flags = crypto_shash_get_flags(parent) &
- CRYPTO_TFM_REQ_MAY_SLEEP;
+ shash->tfm = hash;
+ shash->flags = crypto_shash_get_flags(parent)
+ & CRYPTO_TFM_REQ_MAY_SLEEP;
if (keylen > bs) {
int err;
- err = crypto_shash_digest(&desc.shash, inkey, keylen, ipad);
+ err = crypto_shash_digest(shash, inkey, keylen, ipad);
if (err)
return err;
@@ -81,12 +78,12 @@ static int hmac_setkey(struct crypto_shash *parent,
opad[i] ^= 0x5c;
}
- return crypto_shash_init(&desc.shash) ?:
- crypto_shash_update(&desc.shash, ipad, bs) ?:
- crypto_shash_export(&desc.shash, ipad) ?:
- crypto_shash_init(&desc.shash) ?:
- crypto_shash_update(&desc.shash, opad, bs) ?:
- crypto_shash_export(&desc.shash, opad);
+ return crypto_shash_init(shash) ?:
+ crypto_shash_update(shash, ipad, bs) ?:
+ crypto_shash_export(shash, ipad) ?:
+ crypto_shash_init(shash) ?:
+ crypto_shash_update(shash, opad, bs) ?:
+ crypto_shash_export(shash, opad);
}
static int hmac_export(struct shash_desc *pdesc, void *out)