summary refs log tree commit diff
path: root/crypto/src/asn1/anssi
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2019-08-02 22:30:07 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2019-08-02 22:30:07 +0700
commitc85a0e90ffc14dbb2673e2f5a1287133301b9f1a (patch)
treecafc39488113fe5e3d9e761b59acd5dcc2392232 /crypto/src/asn1/anssi
parentAdd experimental support for GLV Type A endomorphisms (diff)
downloadBouncyCastle.NET-ed25519-c85a0e90ffc14dbb2673e2f5a1287133301b9f1a.tar.xz
EC wNAF-related updates from bc-java
- better control of window size limits
- callers take advantage of available larger precomps
- provide ConfigureBasepoint to mark points for larger precomp
- mark built-in curve basepoints for larger default wNAF width
Diffstat (limited to 'crypto/src/asn1/anssi')
-rw-r--r--crypto/src/asn1/anssi/ANSSINamedCurves.cs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crypto/src/asn1/anssi/ANSSINamedCurves.cs b/crypto/src/asn1/anssi/ANSSINamedCurves.cs
index d0c90ebf1..ce941709f 100644
--- a/crypto/src/asn1/anssi/ANSSINamedCurves.cs
+++ b/crypto/src/asn1/anssi/ANSSINamedCurves.cs
@@ -4,6 +4,7 @@ using System.Collections;
 using Org.BouncyCastle.Asn1.X9;
 using Org.BouncyCastle.Math;
 using Org.BouncyCastle.Math.EC;
+using Org.BouncyCastle.Math.EC.Multiplier;
 using Org.BouncyCastle.Utilities;
 using Org.BouncyCastle.Utilities.Collections;
 using Org.BouncyCastle.Utilities.Encoders;
@@ -12,6 +13,13 @@ namespace Org.BouncyCastle.Asn1.Anssi
 {
     public class AnssiNamedCurves
     {
+        private static X9ECPoint ConfigureBasepoint(ECCurve curve, string encoding)
+        {
+            X9ECPoint G = new X9ECPoint(curve, Hex.Decode(encoding));
+            WNafUtilities.ConfigureBasepoint(G.Point);
+            return G;
+        }
+
         private static ECCurve ConfigureCurve(ECCurve curve)
         {
             return curve;
@@ -42,9 +50,8 @@ namespace Org.BouncyCastle.Asn1.Anssi
                 BigInteger h = BigInteger.One;
 
                 ECCurve curve = ConfigureCurve(new FpCurve(p, a, b, n, h));
-                X9ECPoint G = new X9ECPoint(curve, Hex.Decode("04"
-                    + "B6B3D4C356C139EB31183D4749D423958C27D2DCAF98B70164C97A2DD98F5CFF"
-                    + "6142E0F7C8B204911F9271F0F3ECEF8C2701C307E8E4C9E183115A1554062CFB"));
+                X9ECPoint G = ConfigureBasepoint(curve,
+                    "04B6B3D4C356C139EB31183D4749D423958C27D2DCAF98B70164C97A2DD98F5CFF6142E0F7C8B204911F9271F0F3ECEF8C2701C307E8E4C9E183115A1554062CFB");
 
                 return new X9ECParameters(curve, G, n, h, S);
             }