Commit af903dcd authored by Linus Torvalds's avatar Linus Torvalds

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
parents 39dae59d 441f99c9
...@@ -157,8 +157,8 @@ LABEL skip_ %I ...@@ -157,8 +157,8 @@ LABEL skip_ %I
.endr .endr
# Find min length # Find min length
vmovdqa _lens+0*16(state), %xmm0 vmovdqu _lens+0*16(state), %xmm0
vmovdqa _lens+1*16(state), %xmm1 vmovdqu _lens+1*16(state), %xmm1
vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
...@@ -178,8 +178,8 @@ LABEL skip_ %I ...@@ -178,8 +178,8 @@ LABEL skip_ %I
vpsubd %xmm2, %xmm0, %xmm0 vpsubd %xmm2, %xmm0, %xmm0
vpsubd %xmm2, %xmm1, %xmm1 vpsubd %xmm2, %xmm1, %xmm1
vmovdqa %xmm0, _lens+0*16(state) vmovdqu %xmm0, _lens+0*16(state)
vmovdqa %xmm1, _lens+1*16(state) vmovdqu %xmm1, _lens+1*16(state)
# "state" and "args" are the same address, arg1 # "state" and "args" are the same address, arg1
# len is arg2 # len is arg2
...@@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2) ...@@ -235,8 +235,8 @@ ENTRY(sha1_mb_mgr_get_comp_job_avx2)
jc .return_null jc .return_null
# Find min length # Find min length
vmovdqa _lens(state), %xmm0 vmovdqu _lens(state), %xmm0
vmovdqa _lens+1*16(state), %xmm1 vmovdqu _lens+1*16(state), %xmm1
vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
......
...@@ -155,8 +155,8 @@ LABEL skip_ %I ...@@ -155,8 +155,8 @@ LABEL skip_ %I
.endr .endr
# Find min length # Find min length
vmovdqa _lens+0*16(state), %xmm0 vmovdqu _lens+0*16(state), %xmm0
vmovdqa _lens+1*16(state), %xmm1 vmovdqu _lens+1*16(state), %xmm1
vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
...@@ -176,8 +176,8 @@ LABEL skip_ %I ...@@ -176,8 +176,8 @@ LABEL skip_ %I
vpsubd %xmm2, %xmm0, %xmm0 vpsubd %xmm2, %xmm0, %xmm0
vpsubd %xmm2, %xmm1, %xmm1 vpsubd %xmm2, %xmm1, %xmm1
vmovdqa %xmm0, _lens+0*16(state) vmovdqu %xmm0, _lens+0*16(state)
vmovdqa %xmm1, _lens+1*16(state) vmovdqu %xmm1, _lens+1*16(state)
# "state" and "args" are the same address, arg1 # "state" and "args" are the same address, arg1
# len is arg2 # len is arg2
...@@ -234,8 +234,8 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2) ...@@ -234,8 +234,8 @@ ENTRY(sha256_mb_mgr_get_comp_job_avx2)
jc .return_null jc .return_null
# Find min length # Find min length
vmovdqa _lens(state), %xmm0 vmovdqu _lens(state), %xmm0
vmovdqa _lens+1*16(state), %xmm1 vmovdqu _lens+1*16(state), %xmm1
vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A} vpminud %xmm1, %xmm0, %xmm2 # xmm2 has {D,C,B,A}
vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C} vpalignr $8, %xmm2, %xmm3, %xmm3 # xmm3 has {x,x,D,C}
......
...@@ -363,7 +363,7 @@ static int crypto_ccm_decrypt(struct aead_request *req) ...@@ -363,7 +363,7 @@ static int crypto_ccm_decrypt(struct aead_request *req)
unsigned int cryptlen = req->cryptlen; unsigned int cryptlen = req->cryptlen;
u8 *authtag = pctx->auth_tag; u8 *authtag = pctx->auth_tag;
u8 *odata = pctx->odata; u8 *odata = pctx->odata;
u8 *iv = req->iv; u8 *iv = pctx->idata;
int err; int err;
cryptlen -= authsize; cryptlen -= authsize;
...@@ -379,6 +379,8 @@ static int crypto_ccm_decrypt(struct aead_request *req) ...@@ -379,6 +379,8 @@ static int crypto_ccm_decrypt(struct aead_request *req)
if (req->src != req->dst) if (req->src != req->dst)
dst = pctx->dst; dst = pctx->dst;
memcpy(iv, req->iv, 16);
skcipher_request_set_tfm(skreq, ctx->ctr); skcipher_request_set_tfm(skreq, ctx->ctr);
skcipher_request_set_callback(skreq, pctx->flags, skcipher_request_set_callback(skreq, pctx->flags,
crypto_ccm_decrypt_done, req); crypto_ccm_decrypt_done, req);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment