From d78d99738fc727f2efea7b99f6bc3cc9a083dca1 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 14 Sep 2018 18:04:22 +0700 Subject: Reduce single-bit extractions from scalars --- crypto/src/math/ec/rfc8032/Ed448.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'crypto/src/math/ec/rfc8032') diff --git a/crypto/src/math/ec/rfc8032/Ed448.cs b/crypto/src/math/ec/rfc8032/Ed448.cs index 0e56b12a8..c1c0788a7 100644 --- a/crypto/src/math/ec/rfc8032/Ed448.cs +++ b/crypto/src/math/ec/rfc8032/Ed448.cs @@ -971,8 +971,9 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 uint w = 0; for (int t = 0; t < PrecompTeeth; ++t) { - uint tBit = (n[tPos >> 5] >> (tPos & 0x1F)) & 1U; - w |= tBit << t; + uint tBit = n[tPos >> 5] >> (tPos & 0x1F); + w &= ~(1U << t); + w ^= (tBit << t); tPos += PrecompSpacing; } -- cgit 1.5.1