Skip to content

Commit

Permalink
crypto: scatterwalk - Add no-copy support to copychunks
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
herbertx committed Jul 18, 2016
1 parent 5506f53 commit 85eccdd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions crypto/scatterwalk.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
if (len_this_page > nbytes)
len_this_page = nbytes;

vaddr = scatterwalk_map(walk);
memcpy_dir(buf, vaddr, len_this_page, out);
scatterwalk_unmap(vaddr);
if (out != 2) {
vaddr = scatterwalk_map(walk);
memcpy_dir(buf, vaddr, len_this_page, out);
scatterwalk_unmap(vaddr);
}

scatterwalk_advance(walk, len_this_page);

Expand All @@ -99,7 +101,7 @@ void scatterwalk_copychunks(void *buf, struct scatter_walk *walk,
buf += len_this_page;
nbytes -= len_this_page;

scatterwalk_pagedone(walk, out, 1);
scatterwalk_pagedone(walk, out & 1, 1);
}
}
EXPORT_SYMBOL_GPL(scatterwalk_copychunks);
Expand Down

0 comments on commit 85eccdd

Please sign in to comment.