]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[CRYPTO] scatterwalk: Restore custom sg chaining for now
authorHerbert Xu <herbert@gondor.apana.org.au>
Wed, 5 Dec 2007 09:59:25 +0000 (20:59 +1100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 10 Jan 2008 21:16:33 +0000 (08:16 +1100)
Unfortunately the generic chaining hasn't been ported to all architectures
yet, and notably not s390.  So this patch restores the chainging that we've
been using previously which does work everywhere.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/digest.c
crypto/gcm.c
crypto/hmac.c
crypto/scatterwalk.c
include/crypto/scatterwalk.h

index 52845f53f8e1b862c8bcd55b4cb32e8980d2581f..6fd43bddd545e788546d868b097e3ad811867e76 100644 (file)
@@ -75,7 +75,7 @@ static int update2(struct hash_desc *desc,
 
                if (!nbytes)
                        break;
-               sg = sg_next(sg);
+               sg = scatterwalk_sg_next(sg);
        }
 
        return 0;
index 27483f361e8027cecdfa67068cc5e028d91ae0d5..502da929a5fc8f9e0eeec134edc4e293abde9796 100644 (file)
@@ -100,7 +100,7 @@ static void crypto_gcm_ghash_update_sg(struct crypto_gcm_ghash_ctx *ctx,
                n = scatterwalk_clamp(&walk, len);
 
                if (!n) {
-                       scatterwalk_start(&walk, sg_next(walk.sg));
+                       scatterwalk_start(&walk, scatterwalk_sg_next(walk.sg));
                        n = scatterwalk_clamp(&walk, len);
                }
 
index 34c3706db85d4fdb8099bfd911750418bff1f2ba..a1d016a50e7debd10f6b7030f44d598b6eccedb3 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <crypto/algapi.h>
+#include <crypto/scatterwalk.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -160,7 +161,7 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg,
 
        sg_init_table(sg1, 2);
        sg_set_buf(sg1, ipad, bs);
-       sg_chain(sg1, 2, sg);
+       scatterwalk_sg_chain(sg1, 2, sg);
 
        sg_init_table(sg2, 1);
        sg_set_buf(sg2, opad, bs + ds);
index 12d19019e178ebb18a21fa9a61cc4a9433fa3cf1..297e19d13c4e6c34dd52688158266a1b502be518 100644 (file)
@@ -61,7 +61,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, sg_next(walk->sg));
+                       scatterwalk_start(walk, scatterwalk_sg_next(walk->sg));
        }
 }
 
@@ -112,7 +112,7 @@ void scatterwalk_map_and_copy(void *buf, struct scatterlist *sg,
                        break;
 
                offset += sg->length;
-               sg = sg_next(sg);
+               sg = scatterwalk_sg_next(sg);
        }
 
        scatterwalk_advance(&walk, start - offset);
index 07b6f17122d2e968ddede9281f94fb65754e806c..bd62431c33bdbbc0651b6542a917303af8ada16a 100644 (file)
@@ -52,6 +52,17 @@ static inline void crypto_yield(u32 flags)
                cond_resched();
 }
 
+static inline void scatterwalk_sg_chain(struct scatterlist *sg1, int num,
+                                       struct scatterlist *sg2)
+{
+       sg_set_page(&sg1[num - 1], (void *)sg2, 0, 0);
+}
+
+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)
 {