]> code.ossystems Code Review - meta-freescale.git/blob
c808606201c18ce557d1d97cb21f99beab794ab9
[meta-freescale.git] /
1 From 5a6cd042d3cee9e3bbf3b0125a89e64d75dffdc7 Mon Sep 17 00:00:00 2001
2 From: Cristian Stoica <cristian.stoica@freescale.com>
3 Date: Thu, 31 Oct 2013 13:13:51 +0200
4 Subject: [[Patch][fsl 04/16] fix scatterlist size for in-place operations
5
6 Upstream-status: Pending
7
8 For in-place operations, the scatterlist must be big enough to allow for
9 either the source or destination data:
10  - for block ciphers, the destination will be bigger than the source if
11    the source is not multiple of blocksize
12  - for aead ciphers, the additional data and padding guarantees the
13    destination to be bigger than the source.
14
15 Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
16 Tested-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com>
17 ---
18  zc.c |    5 +++--
19  1 file changed, 3 insertions(+), 2 deletions(-)
20
21 diff --git a/zc.c b/zc.c
22 index 809a36d..8855083 100644
23 --- a/zc.c
24 +++ b/zc.c
25 @@ -162,8 +162,9 @@ int get_userbuf(struct csession *ses,
26         }
27  
28         if (src == dst) {       /* inplace operation */
29 -               rc = __get_userbuf(src, src_len, 1, ses->used_pages,
30 -                                      ses->pages, ses->sg, task, mm);
31 +               rc = __get_userbuf(src, max(src_len, dst_len), 1, ses->used_pages,
32 +                               ses->pages, ses->sg, task, mm);
33 +
34                 if (unlikely(rc)) {
35                         derr(1, "failed to get user pages for data IO");
36                         return rc;
37 -- 
38 1.7.9.7
39