Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9d70a6c8 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by David S. Miller
Browse files

[CRYPTO] sha1: Rename i/j to done/partial



This patch gives more descriptive names to the variables i and j.

Signed-off-by: default avatarNicolas Pitre <nico@cam.org>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent cfa8d17c
Loading
Loading
Loading
Loading
+12 −11
Original line number Original line Diff line number Diff line
@@ -49,32 +49,33 @@ static void sha1_init(void *ctx)
static void sha1_update(void *ctx, const u8 *data, unsigned int len)
static void sha1_update(void *ctx, const u8 *data, unsigned int len)
{
{
	struct sha1_ctx *sctx = ctx;
	struct sha1_ctx *sctx = ctx;
	unsigned int i, j;
	unsigned int partial, done;
	const u8 *src;
	const u8 *src;


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


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


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


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


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