From: Szilveszter Ordog <slipszi@gmail.com>
To: linux-crypto@vger.kernel.org
Subject: [PATCH] crypto: ahash - Fix handling of unaligned buffers
Date: Tue, 23 Feb 2010 12:50:01 +0100 [thread overview]
Message-ID: <ac67d9131002230350o9618b9apd111f0da1bba15b1@mail.gmail.com> (raw)
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>
---
crypto/ahash.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/crypto/ahash.c b/crypto/ahash.c
index f347637..db42202 100644
--- a/crypto/ahash.c
+++ b/crypto/ahash.c
@@ -65,7 +65,6 @@ int crypto_hash_walk_done(struct crypto_hash_walk
*walk, int err)
walk->data -= walk->offset;
if (nbytes && walk->offset & alignmask && !err) {
- walk->offset += alignmask - 1;
walk->offset = ALIGN(walk->offset, alignmask + 1);
walk->data += walk->offset;
--
1.5.5.6
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next reply other threads:[~2010-02-23 11:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-23 11:50 Szilveszter Ordog [this message]
2010-03-02 14:37 ` [PATCH] crypto: ahash - Fix handling of unaligned buffers Herbert Xu
2010-03-02 23:10 ` Szilveszter Ordog
2010-03-03 0:04 ` Herbert Xu
2010-03-04 0:48 ` Szilveszter Ordog
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ac67d9131002230350o9618b9apd111f0da1bba15b1@mail.gmail.com \
--to=slipszi@gmail.com \
--cc=linux-crypto@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).