summaryrefslogtreecommitdiff
path: root/alg-sha256.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-09-15 22:58:08 -0400
committerZack Weinberg <zackw@panix.com>2017-09-15 22:58:08 -0400
commitccc833b4b2c60cefd74cb91a05f1ce7628179657 (patch)
treead9f5b076197d2822326a4099f66c61ea1b87149 /alg-sha256.c
parent4c538c50d016cde9f6bd56c4ff5072dfa4e30630 (diff)
downloadlibxcrypt-ccc833b4b2c60cefd74cb91a05f1ce7628179657.tar.gz
libxcrypt-ccc833b4b2c60cefd74cb91a05f1ce7628179657.tar.bz2
libxcrypt-ccc833b4b2c60cefd74cb91a05f1ce7628179657.zip
Crank up the warnings level still further.
We are now requesting essentially all of the warnings that GCC can produce. Many of the code changes required are confirming that C's somewhat confusing type conversion rules do in fact do the Right Thing in each case.
Diffstat (limited to 'alg-sha256.c')
-rw-r--r--alg-sha256.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/alg-sha256.c b/alg-sha256.c
index fecc019..5e17591 100644
--- a/alg-sha256.c
+++ b/alg-sha256.c
@@ -208,19 +208,19 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
both inputs first. */
if (ctx->buflen != 0)
{
- size_t left_over = ctx->buflen;
- size_t add = 128 - left_over > len ? len : 128 - left_over;
+ uint32_t left_over = ctx->buflen;
+ uint32_t add = 128 - left_over > len ? (uint32_t)len : 128 - left_over;
memcpy (&ctx->buffer[left_over], buffer, add);
ctx->buflen += add;
if (ctx->buflen > 64)
{
- sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx);
+ sha256_process_block (ctx->buffer, ctx->buflen & ~63u, ctx);
ctx->buflen &= 63;
/* The regions in the following copy operation cannot overlap. */
- memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63u],
ctx->buflen);
}
@@ -231,8 +231,8 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
/* Process available complete blocks. */
if (len > 64)
{
- sha256_process_block (buffer, len & ~63, ctx);
- buffer = (const char *) buffer + (len & ~63);
+ sha256_process_block (buffer, len & ~63u, ctx);
+ buffer = (const char *) buffer + (len & ~63u);
len &= 63;
}
@@ -249,6 +249,6 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx)
left_over -= 64;
memcpy (ctx->buffer, &ctx->buffer[64], left_over);
}
- ctx->buflen = left_over;
+ ctx->buflen = (uint32_t)left_over;
}
}