X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=crc%2Fsha256.c;h=3a72a5bfb2e14bbcc0d718acfa9e296ec9c48ded;hb=2a988d8bcb447eb098fc382835cc507587c6ba66;hp=0091d4477284dca5deca9c3e603c4e292ddac2b2;hpb=00fb3c8dcbb940338fea9f6cab689b4924266305;p=fio.git diff --git a/crc/sha256.c b/crc/sha256.c index 0091d447..3a72a5bf 100644 --- a/crc/sha256.c +++ b/crc/sha256.c @@ -227,7 +227,7 @@ static void sha256_transform(uint32_t *state, const uint8_t *input) memset(W, 0, 64 * sizeof(uint32_t)); } -void sha256_init(struct sha256_ctx *sctx) +void fio_sha256_init(struct fio_sha256_ctx *sctx) { sctx->state[0] = H0; sctx->state[1] = H1; @@ -240,13 +240,13 @@ void sha256_init(struct sha256_ctx *sctx) sctx->count[0] = sctx->count[1] = 0; } -void sha256_update(struct sha256_ctx *sctx, const uint8_t *data, - unsigned int len) +void fio_sha256_update(struct fio_sha256_ctx *sctx, const uint8_t *data, + unsigned int len) { - unsigned int i, index, part_len; + unsigned int i, idx, part_len; /* Compute number of bytes mod 128 */ - index = (unsigned int)((sctx->count[0] >> 3) & 0x3f); + idx = (unsigned int)((sctx->count[0] >> 3) & 0x3f); /* Update number of bits */ if ((sctx->count[0] += (len << 3)) < (len << 3)) { @@ -254,20 +254,20 @@ void sha256_update(struct sha256_ctx *sctx, const uint8_t *data, sctx->count[1] += (len >> 29); } - part_len = 64 - index; + part_len = 64 - idx; /* Transform as many times as possible. */ if (len >= part_len) { - memcpy(&sctx->buf[index], data, part_len); + memcpy(&sctx->buf[idx], data, part_len); sha256_transform(sctx->state, sctx->buf); for (i = part_len; i + 63 < len; i += 64) sha256_transform(sctx->state, &data[i]); - index = 0; + idx = 0; } else { i = 0; } /* Buffer remaining input */ - memcpy(&sctx->buf[index], &data[i], len-i); + memcpy(&sctx->buf[idx], &data[i], len-i); }