summary refs log tree commit diff
path: root/crypto
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-05-10 20:07:59 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-05-10 20:07:59 +0700
commitf4dd2b18a85b4164322d1634d2bc1cd89458f85d (patch)
treeef1d7453a110bb935e9a4298f2d8a890fbc14dee /crypto
parentRefactoring in Math.Raw (diff)
downloadBouncyCastle.NET-ed25519-f4dd2b18a85b4164322d1634d2bc1cd89458f85d.tar.xz
Refactoring in Math.EC.Rfc8032
Diffstat (limited to 'crypto')
-rw-r--r--crypto/src/math/ec/rfc8032/Ed25519.cs12
-rw-r--r--crypto/src/math/ec/rfc8032/Ed448.cs12
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)