1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Merge topic 'librhash-left-shift-unsigned'

9e07ffa4 librhash: Avoid signed left-shift overflow in sha256
This commit is contained in:
Brad King
2016-11-29 08:58:59 -05:00
committed by CMake Topic Stage

View File

@@ -218,8 +218,8 @@ void rhash_sha256_final(sha256_ctx *ctx, unsigned char* result)
/* pad message and run for last block */
/* append the byte 0x80 to the message */
ctx->message[index] &= le2me_32(~(0xFFFFFFFF << shift));
ctx->message[index++] ^= le2me_32(0x80 << shift);
ctx->message[index] &= le2me_32(~(0xFFFFFFFFu << shift));
ctx->message[index++] ^= le2me_32(0x80u << shift);
/* if no room left in the message to store 64-bit message length */
if (index > 14) {