Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 17426
b: refs/heads/master
c: 9d70a6c
h: refs/heads/master
v: v3
  • Loading branch information
Nicolas Pitre authored and David S. Miller committed Jan 9, 2006
1 parent 61f23f0 commit 2fcf35b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 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: cfa8d17cc836905ad174fd924701b352585d62f1
refs/heads/master: 9d70a6c86cd86e111291bd0d506028ecb9649923
23 changes: 12 additions & 11 deletions trunk/crypto/sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,32 +49,33 @@ static void sha1_init(void *ctx)
static void sha1_update(void *ctx, const u8 *data, unsigned int len)
{
struct sha1_ctx *sctx = ctx;
unsigned int i, j;
unsigned int partial, done;
const u8 *src;

j = (sctx->count >> 3) & 0x3f;
partial = (sctx->count >> 3) & 0x3f;
sctx->count += len << 3;
i = 0;
done = 0;
src = data;

if ((j + len) > 63) {
if ((partial + len) > 63) {
u32 temp[SHA_WORKSPACE_WORDS];

if (j) {
memcpy(&sctx->buffer[j], data, (i = 64-j));
if (partial) {
done = 64 - partial;
memcpy(sctx->buffer + partial, data, done);
src = sctx->buffer;
}

do {
sha_transform(sctx->state, src, temp);
i += 64;
src = &data[i];
} while (i + 63 < len);
done += 64;
src = data + done;
} while (done + 63 < len);

memset(temp, 0, sizeof(temp));
j = 0;
partial = 0;
}
memcpy(&sctx->buffer[j], src, len - i);
memcpy(sctx->buffer + partial, src, len - done);
}


Expand Down

0 comments on commit 2fcf35b

Please sign in to comment.