Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+6 -4
+6 -4
crypto/scatterwalk.c
··· 87 87 if (len_this_page > nbytes) 88 88 len_this_page = nbytes; 89 89 90 - vaddr = scatterwalk_map(walk); 91 - memcpy_dir(buf, vaddr, len_this_page, out); 92 - scatterwalk_unmap(vaddr); 90 + if (out != 2) { 91 + vaddr = scatterwalk_map(walk); 92 + memcpy_dir(buf, vaddr, len_this_page, out); 93 + scatterwalk_unmap(vaddr); 94 + } 93 95 94 96 scatterwalk_advance(walk, len_this_page); 95 97 ··· 101 99 buf += len_this_page; 102 100 nbytes -= len_this_page; 103 101 104 - scatterwalk_pagedone(walk, out, 1); 102 + scatterwalk_pagedone(walk, out & 1, 1); 105 103 } 106 104 } 107 105 EXPORT_SYMBOL_GPL(scatterwalk_copychunks);