diff options
Diffstat (limited to 'lib/sha512.c')
| -rw-r--r-- | lib/sha512.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/sha512.c b/lib/sha512.c index 6876bfdb08c..dbde67183b7 100644 --- a/lib/sha512.c +++ b/lib/sha512.c @@ -374,7 +374,8 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) sha512_process_block (ctx->buffer, ctx->buflen & ~127, ctx); ctx->buflen &= 127; - /* The regions in the following copy operation cannot overlap. */ + /* The regions in the following copy operation cannot overlap, + because ctx->buflen < 128 ≤ (left_over + add) & ~127. */ memcpy (ctx->buffer, &((char *) ctx->buffer)[(left_over + add) & ~127], ctx->buflen); @@ -416,6 +417,8 @@ sha512_process_bytes (const void *buffer, size_t len, struct sha512_ctx *ctx) { sha512_process_block (ctx->buffer, 128, ctx); left_over -= 128; + /* The regions in the following copy operation cannot overlap, + because left_over ≤ 128. */ memcpy (ctx->buffer, &ctx->buffer[16], left_over); } ctx->buflen = left_over; |
