ec/curve448/curve448.c: fix undefined behaviour sanitizer failure.
authorAndy Polyakov <appro@openssl.org>
Fri, 2 Mar 2018 16:25:31 +0000 (17:25 +0100)
committerAndy Polyakov <appro@openssl.org>
Sat, 3 Mar 2018 21:02:22 +0000 (22:02 +0100)
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5494)

crypto/ec/curve448/curve448.c

index 8ced622..7dc68c8 100644 (file)
@@ -579,7 +579,7 @@ static int recode_wnaf(struct smvt_control *control,
             assert(position >= 0);
             if (odd & (1 << (table_bits + 1)))
                 delta -= (1 << (table_bits + 1));
-            current -= delta << pos;
+            current -= delta * (1 << pos);
             control[position].power = pos + 16 * (w - 1);
             control[position].addend = delta;
             position--;