summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-06 18:05:03 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-06 18:05:03 +0100
commitaf903dcd31e1b345d858ca2af9a84ed61c960b57 (patch)
treed355ee40aa413a22e45df97ac1a3527aa8eacd37 /crypto
parentLinux 4.14-rc8 (diff)
parentcrypto: ccm - preserve the IV buffer (diff)
downloadlinux-af903dcd31e1b345d858ca2af9a84ed61c960b57.tar.xz
linux-af903dcd31e1b345d858ca2af9a84ed61c960b57.zip
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fixes from Herbert Xu: "This fixes an unaligned panic in x86/sha-mb and a bug in ccm that triggers with certain underlying implementations" * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: crypto: ccm - preserve the IV buffer crypto: x86/sha1-mb - fix panic due to unaligned access crypto: x86/sha256-mb - fix panic due to unaligned access
Diffstat (limited to 'crypto')
-rw-r--r--crypto/ccm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/ccm.c b/crypto/ccm.c
index 1ce37ae0ce56..0a083342ec8c 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -363,7 +363,7 @@ static int crypto_ccm_decrypt(struct aead_request *req)
unsigned int cryptlen = req->cryptlen;
u8 *authtag = pctx->auth_tag;
u8 *odata = pctx->odata;
- u8 *iv = req->iv;
+ u8 *iv = pctx->idata;
int err;
cryptlen -= authsize;
@@ -379,6 +379,8 @@ static int crypto_ccm_decrypt(struct aead_request *req)
if (req->src != req->dst)
dst = pctx->dst;
+ memcpy(iv, req->iv, 16);
+
skcipher_request_set_tfm(skreq, ctx->ctr);
skcipher_request_set_callback(skreq, pctx->flags,
crypto_ccm_decrypt_done, req);