aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/scatterwalk.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2005-07-06 16:51:31 -0400
committerDavid S. Miller <davem@davemloft.net>2005-07-06 16:51:31 -0400
commitc774e93e2152d0be2612739418689e6e6400f4eb (patch)
treeabe25ec0577bd95128adb3f38609a09f0a3e2469 /crypto/scatterwalk.c
parent8279dd748f9704b811e528b31304e2fab026abc5 (diff)
[CRYPTO] Add plumbing for multi-block operations
The VIA Padlock device is able to perform much better when multiple blocks are fed to it at once. As this device offers an exceptional throughput rate it is worthwhile to optimise the infrastructure specifically for it. We shift the existing page-sized fast path down to the CBC/ECB functions. We can then replace the CBC/ECB functions with functions provided by the underlying algorithm that performs the multi-block operations. As a side-effect this improves the performance of large cipher operations for all existing algorithm implementations. I've measured the gain to be around 5% for 3DES and 15% for AES. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'crypto/scatterwalk.c')
-rw-r--r--crypto/scatterwalk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/scatterwalk.c b/crypto/scatterwalk.c
index 50c9461e8cc6..47ac90e615f4 100644
--- a/crypto/scatterwalk.c
+++ b/crypto/scatterwalk.c
@@ -100,7 +100,7 @@ void scatterwalk_done(struct scatter_walk *walk, int out, int more)
100int scatterwalk_copychunks(void *buf, struct scatter_walk *walk, 100int scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
101 size_t nbytes, int out) 101 size_t nbytes, int out)
102{ 102{
103 do { 103 while (nbytes > walk->len_this_page) {
104 memcpy_dir(buf, walk->data, walk->len_this_page, out); 104 memcpy_dir(buf, walk->data, walk->len_this_page, out);
105 buf += walk->len_this_page; 105 buf += walk->len_this_page;
106 nbytes -= walk->len_this_page; 106 nbytes -= walk->len_this_page;
@@ -108,7 +108,7 @@ int scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
108 scatterwalk_unmap(walk, out); 108 scatterwalk_unmap(walk, out);
109 scatterwalk_pagedone(walk, out, 1); 109 scatterwalk_pagedone(walk, out, 1);
110 scatterwalk_map(walk, out); 110 scatterwalk_map(walk, out);
111 } while (nbytes > walk->len_this_page); 111 }
112 112
113 memcpy_dir(buf, walk->data, nbytes, out); 113 memcpy_dir(buf, walk->data, nbytes, out);
114 return nbytes; 114 return nbytes;