diff --git a/crypto/modes/ctr128.c b/crypto/modes/ctr128.c index bcafd6b6bf..d4b22728e6 100644 --- a/crypto/modes/ctr128.c +++ b/crypto/modes/ctr128.c @@ -100,7 +100,7 @@ static void ctr128_inc_aligned(unsigned char *counter) --n; d = data[n] += c; /* did addition carry? */ - c = ((d - c) ^ d) >> (sizeof(size_t) * 8 - 1); + c = ((d - c) & ~d) >> (sizeof(size_t) * 8 - 1); } while (n); } #endif