diff options
Diffstat (limited to 'crypto/src/math/ec/rfc7748/X448Field.cs')
-rw-r--r-- | crypto/src/math/ec/rfc7748/X448Field.cs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/crypto/src/math/ec/rfc7748/X448Field.cs b/crypto/src/math/ec/rfc7748/X448Field.cs index 5a682714d..7cda6ebcc 100644 --- a/crypto/src/math/ec/rfc7748/X448Field.cs +++ b/crypto/src/math/ec/rfc7748/X448Field.cs @@ -195,14 +195,21 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748 Mul(t, x, z); } - public static bool IsZeroVar(uint[] x) + public static int IsZero(uint[] x) { uint d = 0; for (int i = 0; i < Size; ++i) { d |= x[i]; } - return d == 0U; + d |= d >> 16; + d &= 0xFFFF; + return ((int)d - 1) >> 31; + } + + public static bool IsZeroVar(uint[] x) + { + return 0U != IsZero(x); } public static void Mul(uint[] x, uint y, uint[] z) |