Fix an incorrect Blake2b calculation if hashing 2^64-127 to 2^64 bytes
t1, the higher 64-bit half of the 128-bit byte counter was incremented
even though t0, the lower-half, did not reach zero. It would cause the
counter to be almost 2^65 instead of almost 2^64.
@@ -392,9 +392,7 @@ public int doFinal(byte[] out, int outOffset)
f0 = 0xFFFFFFFFFFFFFFFFL;
t0 += bufferPos;
- // bufferPos may be < 128, so (t0 == 0) does not work
- // for 2^64 < message length > 2^64 - 127
- if ((t0 < 0) && (bufferPos > -t0))
+ if (bufferPos > 0 && t0 == 0)
{
t1++;
}
