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

[CRYPTO] scatterwalk: Use generic scatterlist chaining

This patch converts the crypto scatterwalk code to use the generic
scatterlist chaining rather the version specific to crypto.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+3 -9
+1 -2
crypto/digest.c
··· 21 21 #include <linux/scatterlist.h> 22 22 23 23 #include "internal.h" 24 - #include "scatterwalk.h" 25 24 26 25 static int init(struct hash_desc *desc) 27 26 { ··· 76 77 77 78 if (!nbytes) 78 79 break; 79 - sg = scatterwalk_sg_next(sg); 80 + sg = sg_next(sg); 80 81 } 81 82 82 83 return 0;
+1 -1
crypto/hmac.c
··· 160 160 161 161 sg_init_table(sg1, 2); 162 162 sg_set_buf(sg1, ipad, bs); 163 - sg_set_page(&sg1[1], (void *) sg, 0, 0); 163 + sg_chain(sg1, 2, sg); 164 164 165 165 sg_init_table(sg2, 1); 166 166 sg_set_buf(sg2, opad, bs + ds);
+1 -1
crypto/scatterwalk.c
··· 62 62 walk->offset += PAGE_SIZE - 1; 63 63 walk->offset &= PAGE_MASK; 64 64 if (walk->offset >= walk->sg->offset + walk->sg->length) 65 - scatterwalk_start(walk, scatterwalk_sg_next(walk->sg)); 65 + scatterwalk_start(walk, sg_next(walk->sg)); 66 66 } 67 67 } 68 68
-5
crypto/scatterwalk.h
··· 20 20 21 21 #include "internal.h" 22 22 23 - static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg) 24 - { 25 - return (++sg)->length ? sg : (void *) sg_page(sg); 26 - } 27 - 28 23 static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in, 29 24 struct scatter_walk *walk_out) 30 25 {