From f4dd2b18a85b4164322d1634d2bc1cd89458f85d Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 10 May 2023 20:07:59 +0700 Subject: Refactoring in Math.EC.Rfc8032 --- crypto/src/math/ec/rfc8032/Ed25519.cs | 12 +----------- crypto/src/math/ec/rfc8032/Ed448.cs | 12 +----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/crypto/src/math/ec/rfc8032/Ed25519.cs b/crypto/src/math/ec/rfc8032/Ed25519.cs index d5b035734..fd2d5fe93 100644 --- a/crypto/src/math/ec/rfc8032/Ed25519.cs +++ b/crypto/src/math/ec/rfc8032/Ed25519.cs @@ -935,16 +935,6 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 F.Copy(u, 0, points[0].z, 0); } - //private static bool IsNeutralElementVar(int[] x, int[] y) - //{ - // return F.IsZeroVar(x) && F.IsOneVar(y); - //} - - private static bool IsNeutralElementVar(int[] x, int[] y, int[] z) - { - return F.IsZeroVar(x) && F.AreEqualVar(y, z); - } - private static void NormalizeToAffine(ref PointAccum p, ref PointAffine r) { F.Inv(p.z, r.y); @@ -960,7 +950,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 F.Normalize(p.y); F.Normalize(p.z); - return IsNeutralElementVar(p.x, p.y, p.z); + return F.IsZeroVar(p.x) && F.AreEqualVar(p.y, p.z); } private static void PointAdd(ref PointExtended p, ref PointExtended q, ref PointExtended r, ref PointTemp t) diff --git a/crypto/src/math/ec/rfc8032/Ed448.cs b/crypto/src/math/ec/rfc8032/Ed448.cs index 22fe79960..08b64ddf2 100644 --- a/crypto/src/math/ec/rfc8032/Ed448.cs +++ b/crypto/src/math/ec/rfc8032/Ed448.cs @@ -853,16 +853,6 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 F.Copy(u, 0, points[0].z, 0); } - //private static bool IsNeutralElementVar(uint[] x, uint[] y) - //{ - // return F.IsZeroVar(x) && F.IsOneVar(y); - //} - - private static bool IsNeutralElementVar(uint[] x, uint[] y, uint[] z) - { - return F.IsZeroVar(x) && F.AreEqualVar(y, z); - } - private static void NormalizeToAffine(ref PointProjective p, ref PointAffine r) { F.Inv(p.z, r.y); @@ -878,7 +868,7 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 F.Normalize(p.y); F.Normalize(p.z); - return IsNeutralElementVar(p.x, p.y, p.z); + return F.IsZeroVar(p.x) && F.AreEqualVar(p.y, p.z); } private static void PointAdd(ref PointAffine p, ref PointProjective r, ref PointTemp t) -- cgit 1.4.1