summaryrefslogtreecommitdiffstats
path: root/crypto/aead.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2015-05-27 14:37:29 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2015-05-28 11:23:17 +0800
commitb455eb80f17471797ba9cb904fe86af1df35f073 (patch)
treeeb75097755e27c5b2e6c65a529eee3be0f9a7ad3 /crypto/aead.c
parentfdaef75f66bba5999a94f3cd9156bf353ba2ef98 (diff)
downloadlinux-stable-b455eb80f17471797ba9cb904fe86af1df35f073.tar.gz
linux-stable-b455eb80f17471797ba9cb904fe86af1df35f073.tar.bz2
linux-stable-b455eb80f17471797ba9cb904fe86af1df35f073.zip
crypto: aead - Preserve in-place processing in old_crypt
This patch tries to preserve in-place processing in old_crypt as various algorithms are optimised for in-place processing where src == dst. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/aead.c')
-rw-r--r--crypto/aead.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/aead.c b/crypto/aead.c
index 7c3d725bd264..35c55e04fcbc 100644
--- a/crypto/aead.c
+++ b/crypto/aead.c
@@ -107,7 +107,8 @@ static int old_crypt(struct aead_request *req,
return crypt(req);
src = scatterwalk_ffwd(nreq->srcbuf, req->src, req->assoclen);
- dst = scatterwalk_ffwd(nreq->dstbuf, req->dst, req->assoclen);
+ dst = req->src == req->dst ?
+ src : scatterwalk_ffwd(nreq->dstbuf, req->dst, req->assoclen);
aead_request_set_tfm(&nreq->subreq, aead);
aead_request_set_callback(&nreq->subreq, aead_request_flags(req),