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.
This commit is contained in:
vodkar 2018-03-30 03:07:38 +05:00 committed by GitHub
parent d24babb96e
commit b23a511e1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}