diff options
Diffstat (limited to 'lib/sha256.c')
-rw-r--r-- | lib/sha256.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/sha256.c b/lib/sha256.c index 03d3899..85405b2 100644 --- a/lib/sha256.c +++ b/lib/sha256.c @@ -1,7 +1,7 @@ /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or memory blocks according to the NIST specification FIPS-180-2. - Copyright (C) 2005-2006, 2008-2017 Free Software Foundation, Inc. + Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -14,7 +14,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. */ + along with this program. If not, see <https://www.gnu.org/licenses/>. */ /* Written by David Madore, considerably copypasting from Scott G. Miller's sha1.c @@ -366,7 +366,8 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) sha256_process_block (ctx->buffer, ctx->buflen & ~63, ctx); ctx->buflen &= 63; - /* The regions in the following copy operation cannot overlap. */ + /* The regions in the following copy operation cannot overlap, + because ctx->buflen < 64 ≤ (left_over + add) & ~63. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~63], ctx->buflen); @@ -408,6 +409,8 @@ sha256_process_bytes (const void *buffer, size_t len, struct sha256_ctx *ctx) { sha256_process_block (ctx->buffer, 64, ctx); left_over -= 64; + /* The regions in the following copy operation cannot overlap, + because left_over ≤ 64. */ memcpy (ctx->buffer, &ctx->buffer[16], left_over); } ctx->buflen = left_over; @@ -574,3 +577,10 @@ sha256_process_block (const void *buffer, size_t len, struct sha256_ctx *ctx) } } #endif + +/* + * Hey Emacs! + * Local Variables: + * coding: utf-8 + * End: + */ |