From b23a511e1a28d168c2b7804c42af479b00a26563 Mon Sep 17 00:00:00 2001 From: vodkar Date: Fri, 30 Mar 2018 03:07:38 +0500 Subject: [PATCH] Bit shifting This code causes undefined behavior if the N value is higher than 32. You cannot use this code to write a value higher than 0x80000000 into the 'X' variable. --- src/crypto/c_blake256.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/crypto/c_blake256.c b/src/crypto/c_blake256.c index 00a84c22..6aa497c1 100644 --- a/src/crypto/c_blake256.c +++ b/src/crypto/c_blake256.c @@ -134,7 +134,7 @@ void blake256_update(state *S, const uint8_t *data, uint64_t datalen) { if (S->t[0] == 0) S->t[1]++; blake256_compress(S, S->buf); data += fill; - datalen -= (fill << 3); + datalen -= (uint64_t)fill << (uint64_t)3; left = 0; }