Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/crypto/ec
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2016-04-25 20:22:22 +0300
committerAdam Langley <agl@google.com>2016-04-26 02:05:20 +0300
commitf13444a5ad92974005df38c4344c922af2449ca3 (patch)
tree113c6e88fdcea31de1d0aea32bb76cea2d187871 /crypto/ec
parent1fc7564ba7dd985f311d5fccd1de4b01ee368b43 (diff)
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>
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/p256-64.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/crypto/ec/p256-64.c b/crypto/ec/p256-64.c
index 84b65979..c4259b62 100644
--- a/crypto/ec/p256-64.c
+++ b/crypto/ec/p256-64.c
@@ -328,8 +328,7 @@ static void felem_shrink(smallfelem out, const felem in) {
* 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 */