summary refs log tree commit diff
path: root/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2020-07-04 16:42:57 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2020-07-04 16:42:57 +0700
commitb27bcfb49d403d9c0d4f4924de5f869db1c041cc (patch)
tree72c3a1bae971caa7575c1bb54fb9baa30d51ca36 /crypto/src/math/ec/custom/sec/SecP521R1Curve.cs
parentBlind the inversion when normalizing (diff)
downloadBouncyCastle.NET-ed25519-b27bcfb49d403d9c0d4f4924de5f869db1c041cc.tar.xz
EC updates from bc-java
Diffstat (limited to 'crypto/src/math/ec/custom/sec/SecP521R1Curve.cs')
-rw-r--r--crypto/src/math/ec/custom/sec/SecP521R1Curve.cs15
1 files changed, 15 insertions, 0 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs
index 28db11aea..143176b10 100644
--- a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs
+++ b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs
@@ -1,6 +1,7 @@
 using System;
 
 using Org.BouncyCastle.Math.Raw;
+using Org.BouncyCastle.Security;
 using Org.BouncyCastle.Utilities.Encoders;
 
 namespace Org.BouncyCastle.Math.EC.Custom.Sec
@@ -92,6 +93,20 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
             return new SecP521R1LookupTable(this, table, len);
         }
 
+        public override ECFieldElement RandomFieldElement(SecureRandom r)
+        {
+            uint[] x = Nat.Create(17);
+            SecP521R1Field.Random(r, x);
+            return new SecP521R1FieldElement(x);
+        }
+
+        public override ECFieldElement RandomFieldElementMult(SecureRandom r)
+        {
+            uint[] x = Nat.Create(17);
+            SecP521R1Field.RandomMult(r, x);
+            return new SecP521R1FieldElement(x);
+        }
+
         private class SecP521R1LookupTable
             : AbstractECLookupTable
         {