diff options
author | Szilveszter Ördög <slipszi@gmail.com> | 2010-03-02 19:03:23 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2010-03-02 19:03:23 -0500 |
commit | cbb9bf65ae25dee772e85589136e7dd1c3e743ae (patch) | |
tree | 3dbb72e204bdcd15d7a36f27ef28f056b1367965 /crypto/ahash.c | |
parent | 77ba115c478d442024964b217f9f12192018cc77 (diff) |
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>
Diffstat (limited to 'crypto/ahash.c')
-rw-r--r-- | crypto/ahash.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/crypto/ahash.c b/crypto/ahash.c index 33a4ff45f842..b8c59b889c6e 100644 --- a/crypto/ahash.c +++ b/crypto/ahash.c | |||
@@ -78,7 +78,6 @@ int crypto_hash_walk_done(struct crypto_hash_walk *walk, int err) | |||
78 | walk->data -= walk->offset; | 78 | walk->data -= walk->offset; |
79 | 79 | ||
80 | if (nbytes && walk->offset & alignmask && !err) { | 80 | if (nbytes && walk->offset & alignmask && !err) { |
81 | walk->offset += alignmask - 1; | ||
82 | walk->offset = ALIGN(walk->offset, alignmask + 1); | 81 | walk->offset = ALIGN(walk->offset, alignmask + 1); |
83 | walk->data += walk->offset; | 82 | walk->data += walk->offset; |
84 | 83 | ||