summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMandeep Singh Baines <msb@chromium.org>2011-06-27 15:41:56 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2011-06-30 07:44:06 +0800
commit36ca239b245dbdec3b0c94976e956226bdd4108c (patch)
tree2edff3bb1c78edf1b8d8daca05048d01de1e7e9f
parent52527cf3f95d437b02f54437d5c3d7fda06474d1 (diff)
downloadop-kernel-dev-36ca239b245dbdec3b0c94976e956226bdd4108c.zip
op-kernel-dev-36ca239b245dbdec3b0c94976e956226bdd4108c.tar.gz
crypto: sha1_generic - use SHA1_BLOCK_SIZE
Modify sha1_update to use SHA1_BLOCK_SIZE. Signed-off-by: Mandeep Singh Baines <msb@chromium.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r--crypto/sha1_generic.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/crypto/sha1_generic.c b/crypto/sha1_generic.c
index 0416091..00ae60e 100644
--- a/crypto/sha1_generic.c
+++ b/crypto/sha1_generic.c
@@ -43,25 +43,26 @@ static int sha1_update(struct shash_desc *desc, const u8 *data,
unsigned int partial, done;
const u8 *src;
- partial = sctx->count & 0x3f;
+ partial = sctx->count % SHA1_BLOCK_SIZE;
sctx->count += len;
done = 0;
src = data;
- if ((partial + len) > 63) {
+ if ((partial + len) >= SHA1_BLOCK_SIZE) {
u32 temp[SHA_WORKSPACE_WORDS];
if (partial) {
done = -partial;
- memcpy(sctx->buffer + partial, data, done + 64);
+ memcpy(sctx->buffer + partial, data,
+ done + SHA1_BLOCK_SIZE);
src = sctx->buffer;
}
do {
sha_transform(sctx->state, src, temp);
- done += 64;
+ done += SHA1_BLOCK_SIZE;
src = data + done;
- } while (done + 63 < len);
+ } while (done + SHA1_BLOCK_SIZE <= len);
memset(temp, 0, sizeof(temp));
partial = 0;
OpenPOWER on IntegriCloud