Skip to content

Commit 468577a

Browse files
committed
[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>
1 parent 102d49d commit 468577a

4 files changed

Lines changed: 3 additions & 9 deletions

File tree

crypto/digest.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/scatterlist.h>
2222

2323
#include "internal.h"
24-
#include "scatterwalk.h"
2524

2625
static int init(struct hash_desc *desc)
2726
{
@@ -77,7 +76,7 @@ static int update2(struct hash_desc *desc,
7776

7877
if (!nbytes)
7978
break;
80-
sg = scatterwalk_sg_next(sg);
79+
sg = sg_next(sg);
8180
}
8281

8382
return 0;

crypto/hmac.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ static int hmac_digest(struct hash_desc *pdesc, struct scatterlist *sg,
160160

161161
sg_init_table(sg1, 2);
162162
sg_set_buf(sg1, ipad, bs);
163-
sg_set_page(&sg1[1], (void *) sg, 0, 0);
163+
sg_chain(sg1, 2, sg);
164164

165165
sg_init_table(sg2, 1);
166166
sg_set_buf(sg2, opad, bs + ds);

crypto/scatterwalk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
6262
walk->offset += PAGE_SIZE - 1;
6363
walk->offset &= PAGE_MASK;
6464
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));
6666
}
6767
}
6868

crypto/scatterwalk.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@
2020

2121
#include "internal.h"
2222

23-
static inline struct scatterlist *scatterwalk_sg_next(struct scatterlist *sg)
24-
{
25-
return (++sg)->length ? sg : (void *) sg_page(sg);
26-
}
27-
2823
static inline unsigned long scatterwalk_samebuf(struct scatter_walk *walk_in,
2924
struct scatter_walk *walk_out)
3025
{

0 commit comments

Comments
 (0)