Skip to content

Commit cbb9bf6

Browse files
slipsziherbertx
authored andcommitted
crypto: hash - Fix handling of unaligned buffers
The correct way to calculate the start of the aligned part of an unaligned buffer is: offset = ALIGN(offset, alignmask + 1); However, crypto_hash_walk_done() has: offset += alignmask - 1; offset = ALIGN(offset, alignmask + 1); which actually skips a whole block unless offset % (alignmask + 1) == 1. This patch fixes the problem. Signed-off-by: Szilveszter Ördög <slipszi@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 77ba115 commit cbb9bf6

1 file changed

Lines changed: 0 additions & 1 deletion

File tree

‎crypto/ahash.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err)
7878
walk->data -= walk->offset;
7979

8080
if (nbytes && walk->offset & alignmask && !err) {
81-
walk->offset += alignmask - 1;
8281
walk->offset = ALIGN(walk->offset, alignmask + 1);
8382
walk->data += walk->offset;
8483

0 commit comments

Comments
 (0)