modes/ctr128.c: fix false carry in counter increment procedure.
[openssl.git] / crypto / modes / ctr128.c
index b7ffb73ab7312f0ea30df30a986475a43ffc3fca..03920b447333eaef3ce68dced46d0bccc5aa3568 100644 (file)
@@ -52,7 +52,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