This patch gives more descriptive names to the variables i and j.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
static void sha1_update(void *ctx, const u8 *data, unsigned int len)
{
struct sha1_ctx *sctx = ctx;
static void sha1_update(void *ctx, const u8 *data, unsigned int len)
{
struct sha1_ctx *sctx = ctx;
+ unsigned int partial, done;
- j = (sctx->count >> 3) & 0x3f;
+ partial = (sctx->count >> 3) & 0x3f;
+ if ((partial + len) > 63) {
u32 temp[SHA_WORKSPACE_WORDS];
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);
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));
memset(temp, 0, sizeof(temp));
- memcpy(&sctx->buffer[j], src, len - i);
+ memcpy(sctx->buffer + partial, src, len - done);