Thread (16 messages) 16 messages, 2 authors, 2015-05-27
STALE4076d

[PATCH 3/11] crypto: aead - Preserve in-place processing in old_crypt

From: Herbert Xu <herbert@gondor.apana.org.au>
Date: 2015-05-27 06:37:32
Subsystem: crypto api, the rest · Maintainers: Herbert Xu, "David S. Miller", Linus Torvalds

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>
---

 crypto/aead.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/crypto/aead.c b/crypto/aead.c
index 7c3d725..35c55e0 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),
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help