Mercurial > gnulib
changeset 10129:4c9de4cfa188
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.
author | Jim Meyering <meyering@redhat.com> |
---|---|
date | Mon, 26 May 2008 19:29:50 +0200 |
parents | 92a80b637ea1 |
children | 7581db129a32 |
files | ChangeLog lib/sha256.c lib/sha256.h |
diffstat | 3 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Mon May 26 16:25:28 2008 +0200 +++ b/ChangeLog Mon May 26 19:29:50 2008 +0200 @@ -1,5 +1,11 @@ 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.
--- a/lib/sha256.c Mon May 26 16:25:28 2008 +0200 +++ b/lib/sha256.c Mon May 26 19:29:50 2008 +0200 @@ -126,7 +126,7 @@ 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. */