summary refs log tree commit diff
path: root/crypto/src/math/ec/ECPoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/math/ec/ECPoint.cs')
-rw-r--r--crypto/src/math/ec/ECPoint.cs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crypto/src/math/ec/ECPoint.cs b/crypto/src/math/ec/ECPoint.cs
index dbeaf31aa..3e206e65f 100644
--- a/crypto/src/math/ec/ECPoint.cs
+++ b/crypto/src/math/ec/ECPoint.cs
@@ -67,6 +67,12 @@ namespace Org.BouncyCastle.Math.EC
             this.m_withCompression = withCompression;
         }
 
+        protected internal bool SatisfiesCofactor()
+        {
+            BigInteger h = Curve.Cofactor;
+            return h == null || h.Equals(BigInteger.One) || !ECAlgorithms.ReferenceMultiply(this, h).IsInfinity;
+        }
+
         protected abstract bool SatisfiesCurveEquation();
 
         public ECPoint GetDetachedPoint()
@@ -304,12 +310,8 @@ namespace Org.BouncyCastle.Math.EC
                 if (!SatisfiesCurveEquation())
                     return false;
 
-                BigInteger h = curve.Cofactor;
-                if (h != null && !h.Equals(BigInteger.One)
-                    && ECAlgorithms.ReferenceMultiply(this, h).IsInfinity)
-                {
+                if (!SatisfiesCofactor())
                     return false;
-                }
             }
 
             return true;