]> err.no Git - linux-2.6/commitdiff
[CRYPTO] scatterwalk: Use generic scatterlist chaining
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 15 Nov 2007 04:08:45 +0000 (12:08 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 10 Jan 2008 21:16:14 +0000 (08:16 +1100)
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>
crypto/digest.c
crypto/hmac.c
crypto/scatterwalk.c
crypto/scatterwalk.h

index 8871dec8cae7484a1fe34e68966563ad1d6032b9..d3e827a141f11cf458d848e0e54c042895cc169e 100644 (file)
@@ -21,7 +21,6 @@
 #include <linux/scatterlist.h>
 
 #include "internal.h"
-#include "scatterwalk.h"
 
 static int init(struct hash_desc *desc)
 {
@@ -77,7 +76,7 @@ static int update2(struct hash_desc *desc,
 
                if (!nbytes)
                        break;
-               sg = scatterwalk_sg_next(sg);
+               sg = sg_next(sg);
        }
 
        return 0;
index 0f05be769c346c71d6ed3a70228d947c4699e50f..34c3706db85d4fdb8099bfd911750418bff1f2ba 100644 (file)
@@ -160,7 +160,7 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg,
 
        sg_init_table(sg1, 2);
        sg_set_buf(sg1, ipad, bs);
-       sg_set_page(&sg1[1], (void *) sg, 0, 0);
+       sg_chain(sg1, 2, sg);
 
        sg_init_table(sg2, 1);
        sg_set_buf(sg2, opad, bs + ds);
index b9bbda0bb9f968efc4a728dd316952b7516f617b..206c39a97e57d3f3d50d0bf8e72eeb4b929d98c6 100644 (file)
@@ -62,7 +62,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
                walk->offset += PAGE_SIZE - 1;
                walk->offset &= PAGE_MASK;
                if (walk->offset >= walk->sg->offset + walk->sg->length)
-                       scatterwalk_start(walk, scatterwalk_sg_next(walk->sg));
+                       scatterwalk_start(walk, sg_next(walk->sg));
        }
 }
 
index 87ed681cceba4fa42d9d46399560d6972aadbce2..fd5517d2a7a9f09bdb941bac45815ddca6ded48a 100644 (file)
 
 #include "internal.h"
 
-static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
-{
-       return (++sg)->length ? sg : (void *) sg_page(sg);
-}
-
 static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in,
                                                struct scatter_walk *walk_out)
 {