Skip to content

Commit c89edd9

Browse files
ebiggersherbertx
authored andcommitted
crypto: aegis - 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(). Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent cb25dbb commit c89edd9

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crypto/aegis128-core.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,10 +284,10 @@ static void crypto_aegis128_process_ad(struct aegis_state *state,
284284

285285
scatterwalk_start(&walk, sg_src);
286286
while (assoclen != 0) {
287-
unsigned int size = scatterwalk_clamp(&walk, assoclen);
287+
unsigned int size;
288+
const u8 *mapped = scatterwalk_next(&walk, assoclen, &size);
288289
unsigned int left = size;
289-
void *mapped = scatterwalk_map(&walk);
290-
const u8 *src = (const u8 *)mapped;
290+
const u8 *src = mapped;
291291

292292
if (pos + size >= AEGIS_BLOCK_SIZE) {
293293
if (pos > 0) {
@@ -308,9 +308,7 @@ static void crypto_aegis128_process_ad(struct aegis_state *state,
308308

309309
pos += left;
310310
assoclen -= size;
311-
scatterwalk_unmap(mapped);
312-
scatterwalk_advance(&walk, size);
313-
scatterwalk_done(&walk, 0, assoclen);
311+
scatterwalk_done_src(&walk, mapped, size);
314312
}
315313

316314
if (pos > 0) {

0 commit comments

Comments
 (0)