* lib/sha256.h (struct sha256_ctx) [buflen]: Change type from
uint32_t to size_t.
* lib/sha256.c (sha256_conclude_ctx): Change type of a local
to match.
2008-05-26 Jim Meyering <meyering@redhat.com>
+ sha256: do not artificially restrict buffer length to be < 2^32
+ * lib/sha256.h (struct sha256_ctx) [buflen]: Change type from
+ uint32_t to size_t.
+ * lib/sha256.c (sha256_conclude_ctx): Change type of a local
+ to match.
+
avoid unaligned access errors, e.g., on sparc
* lib/sha512.c (sha512_conclude_ctx): Use set_uint64 rather than
direct access through a possibly-unaligned uint64* pointer.
sha256_conclude_ctx (struct sha256_ctx *ctx)
{
/* Take yet unprocessed bytes into account. */
- uint32_t bytes = ctx->buflen;
+ size_t bytes = ctx->buflen;
size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;
/* Now count remaining bytes. */
uint32_t state[8];
uint32_t total[2];
- uint32_t buflen;
+ size_t buflen;
uint32_t buffer[32];
};