Use different bit tricks to extend the LSB. C gets grumpy when you shift into a sign bit. Replace it with a different bit trick. BUG=chromium:603502 Change-Id: Ia4cc2e2d68675528b7c0155882ff4d6230df482b Reviewed-on: https://boringssl-review.googlesource.com/7740 Reviewed-by: Adam Langley <agl@google.com>
diff --git a/crypto/ec/p256-64.c b/crypto/ec/p256-64.c index 84b6597..c4259b6 100644 --- a/crypto/ec/p256-64.c +++ b/crypto/ec/p256-64.c
@@ -328,8 +328,7 @@ * conditionally subtract kPrime if tmp[3] is large enough. */ high = tmp[3] >> 64; /* As tmp[3] < 2^65, high is either 1 or 0 */ - high <<= 63; - high >>= 63; + high = ~(high - 1); /* high is: * all ones if the high word of tmp[3] is 1 * all zeros if the high word of tmp[3] if 0 */