diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-03-30 21:30:45 +0200 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2020-03-30 21:30:45 +0200 |
commit | ee770c2346eb37e0dcb8b6cf3eaacf3d8efd6bbc (patch) | |
tree | 58f05092be1a17a939e861f8cadcda1b6ca2ecef /lib/md5.c | |
parent | 0da9e21872802cfc6e975b1ebaf9efb9e5934d84 (diff) | |
parent | fef76e17ed4c607ea73b81279f9ef1d7121be900 (diff) |
Merge branch 'release/experimental/1.0.29-1_experimental1'experimental/1.0.29-1_experimental1
Diffstat (limited to 'lib/md5.c')
-rw-r--r-- | lib/md5.c | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -123,6 +123,7 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; + size_t offset; /* Now count remaining bytes. */ ctx->total[0] += bytes; @@ -133,9 +134,11 @@ md5_finish_ctx (struct md5_ctx *ctx, void *resbuf) memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ - ((md5_uint32 *) ctx->buffer)[bytes + pad] = SWAP (ctx->total[0] << 3); - ((md5_uint32 *) ctx->buffer)[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | - (ctx->total[0] >> 29)); + offset = (bytes + pad) / sizeof (md5_uint32); + ((md5_uint32 *) ctx->buffer)[offset] = SWAP (ctx->total[0] << 3); + offset = (bytes + pad + 4) / sizeof (md5_uint32); + ((md5_uint32 *) ctx->buffer)[offset] = SWAP ((ctx->total[1] << 3) | + (ctx->total[0] >> 29)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); |