Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257934
b: refs/heads/master
c: 36ca239
h: refs/heads/master
v: v3
  • Loading branch information
Mandeep Singh Baines authored and Herbert Xu committed Jun 29, 2011
1 parent 9e1215c commit 50f3435
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 52527cf3f95d437b02f54437d5c3d7fda06474d1
refs/heads/master: 36ca239b245dbdec3b0c94976e956226bdd4108c
11 changes: 6 additions & 5 deletions trunk/crypto/sha1_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 50f3435

Please sign in to comment.