Skip to content

Commit 5dc14e0

Browse files
ebiggersherbertx
authored andcommitted
crypto: arm/ghash - use the new scatterwalk functions
Use scatterwalk_next() which consolidates scatterwalk_clamp() and scatterwalk_map(), and use scatterwalk_done_src() which consolidates scatterwalk_unmap(), scatterwalk_advance(), and scatterwalk_done(). Remove unnecessary code that seemed to be intended to advance to the next sg entry, which is already handled by the scatterwalk functions. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent c89edd9 commit 5dc14e0

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

arch/arm/crypto/ghash-ce-glue.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -459,26 +459,19 @@ static void gcm_calculate_auth_mac(struct aead_request *req, u64 dg[], u32 len)
459459
scatterwalk_start(&walk, req->src);
460460

461461
do {
462-
u32 n = scatterwalk_clamp(&walk, len);
463-
u8 *p;
462+
unsigned int n;
463+
const u8 *p;
464464

465-
if (!n) {
466-
scatterwalk_start(&walk, sg_next(walk.sg));
467-
n = scatterwalk_clamp(&walk, len);
468-
}
469-
470-
p = scatterwalk_map(&walk);
465+
p = scatterwalk_next(&walk, len, &n);
471466
gcm_update_mac(dg, p, n, buf, &buf_count, ctx);
472-
scatterwalk_unmap(p);
467+
scatterwalk_done_src(&walk, p, n);
473468

474469
if (unlikely(len / SZ_4K > (len - n) / SZ_4K)) {
475470
kernel_neon_end();
476471
kernel_neon_begin();
477472
}
478473

479474
len -= n;
480-
scatterwalk_advance(&walk, n);
481-
scatterwalk_done(&walk, 0, len);
482475
} while (len);
483476

484477
if (buf_count) {

0 commit comments

Comments
 (0)