aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2016-07-12 01:17:55 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2016-07-18 05:35:48 -0400
commit85eccddee401ae81067e763516889780b5545160 (patch)
tree2ed2c98edfbe965640dd75a73bdabce37e4479c7
parent5506f53c7cc17c4ad5e69e5512a35faf77182986 (diff)
crypto: scatterwalk - Add no-copy support to copychunks
The function ablkcipher_done_slow is pretty much identical to scatterwalk_copychunks except that it doesn't actually copy as the processing hasn't been completed yet. This patch allows scatterwalk_copychunks to be used in this case by specifying out == 2. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/scatterwalk.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 03ca4aef1b9d..e124ce26feed 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -87,9 +87,11 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
87 if (len_this_page > nbytes) 87 if (len_this_page > nbytes)
88 len_this_page = nbytes; 88 len_this_page = nbytes;
89 89
90 vaddr = scatterwalk_map(walk); 90 if (out != 2) {
91 memcpy_dir(buf, vaddr, len_this_page, out); 91 vaddr = scatterwalk_map(walk);
92 scatterwalk_unmap(vaddr); 92 memcpy_dir(buf, vaddr, len_this_page, out);
93 scatterwalk_unmap(vaddr);
94 }
93 95
94 scatterwalk_advance(walk, len_this_page); 96 scatterwalk_advance(walk, len_this_page);
95 97
@@ -99,7 +101,7 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
99 buf += len_this_page; 101 buf += len_this_page;
100 nbytes -= len_this_page; 102 nbytes -= len_this_page;
101 103
102 scatterwalk_pagedone(walk, out, 1); 104 scatterwalk_pagedone(walk, out & 1, 1);
103 } 105 }
104} 106}
105EXPORT_SYMBOL_GPL(scatterwalk_copychunks); 107EXPORT_SYMBOL_GPL(scatterwalk_copychunks);