diff options
Diffstat (limited to 'crypto/src/math/ec/custom')
22 files changed, 67 insertions, 22 deletions
diff --git a/crypto/src/math/ec/custom/djb/Curve25519FieldElement.cs b/crypto/src/math/ec/custom/djb/Curve25519FieldElement.cs index 732e9e468..37256a550 100644 --- a/crypto/src/math/ec/custom/djb/Curve25519FieldElement.cs +++ b/crypto/src/math/ec/custom/djb/Curve25519FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Djb { internal class Curve25519FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = Curve25519.q; diff --git a/crypto/src/math/ec/custom/gm/SM2P256V1FieldElement.cs b/crypto/src/math/ec/custom/gm/SM2P256V1FieldElement.cs index 4f6428f9e..087a040f2 100644 --- a/crypto/src/math/ec/custom/gm/SM2P256V1FieldElement.cs +++ b/crypto/src/math/ec/custom/gm/SM2P256V1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.GM { internal class SM2P256V1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SM2P256V1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs index fa7951d5d..5912a87e8 100644 --- a/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP128R1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP128R1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs index d1fc75644..3ab11bdae 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP160R1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP160R1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs index bdb5245b2..9d8131857 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP160R2FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP160R2Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs index dce377035..54b72573c 100644 --- a/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs @@ -7,7 +7,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP192K1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP192K1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs index 45bcb00f0..f3e12b542 100644 --- a/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP192R1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP192R1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs index fec07436a..ef53a88d6 100644 --- a/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs @@ -7,7 +7,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP224K1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP224K1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs index 2b9a06564..5780b7481 100644 --- a/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP224R1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP224R1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs index 473113d0f..9a604bdb7 100644 --- a/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs @@ -7,7 +7,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP256K1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP256K1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs index d7838aead..808e99ea6 100644 --- a/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP256R1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP256R1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs index 18d48a57d..7eedccae6 100644 --- a/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP384R1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP384R1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs index 6f02a7eb5..96658a8e5 100644 --- a/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP521R1FieldElement - : ECFieldElement + : AbstractFpFieldElement { public static readonly BigInteger Q = SecP521R1Curve.q; diff --git a/crypto/src/math/ec/custom/sec/SecT113FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT113FieldElement.cs index 9ba25d987..bb87b00fc 100644 --- a/crypto/src/math/ec/custom/sec/SecT113FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT113FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT113FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT113FieldElement(z); } + public override int Trace() + { + return (int)SecT113Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat128.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT131FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT131FieldElement.cs index c38e8eb0a..f96c7ca39 100644 --- a/crypto/src/math/ec/custom/sec/SecT131FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT131FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT131FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT131FieldElement(z); } + public override int Trace() + { + return (int)SecT131Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat192.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT163FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT163FieldElement.cs index 07bd07652..903645999 100644 --- a/crypto/src/math/ec/custom/sec/SecT163FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT163FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT163FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT163FieldElement(z); } + public override int Trace() + { + return (int)SecT163Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat192.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT193FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT193FieldElement.cs index d04e68d3f..9813bcb01 100644 --- a/crypto/src/math/ec/custom/sec/SecT193FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT193FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT193FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT193FieldElement(z); } + public override int Trace() + { + return (int)SecT193Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat256.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT233FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT233FieldElement.cs index 64d09bd6d..fbfe35e13 100644 --- a/crypto/src/math/ec/custom/sec/SecT233FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT233FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT233FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT233FieldElement(z); } + public override int Trace() + { + return (int)SecT233Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat256.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT239FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT239FieldElement.cs index 18563f746..b1b58e89b 100644 --- a/crypto/src/math/ec/custom/sec/SecT239FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT239FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT239FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT239FieldElement(z); } + public override int Trace() + { + return (int)SecT239Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat256.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT283FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT283FieldElement.cs index b054bedfb..c1bb2e30c 100644 --- a/crypto/src/math/ec/custom/sec/SecT283FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT283FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT283FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT283FieldElement(z); } + public override int Trace() + { + return (int)SecT283Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat320.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT409FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT409FieldElement.cs index 7076905bb..68a63312d 100644 --- a/crypto/src/math/ec/custom/sec/SecT409FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT409FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT409FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT409FieldElement(z); } + public override int Trace() + { + return (int)SecT409Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat448.Create64(); diff --git a/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs b/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs index 5f28c01be..c9f3aa5c0 100644 --- a/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecT571FieldElement.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecT571FieldElement - : ECFieldElement + : AbstractF2mFieldElement { protected internal readonly ulong[] x; @@ -150,6 +150,11 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec return new SecT571FieldElement(z); } + public override int Trace() + { + return (int)SecT571Field.Trace(x); + } + public override ECFieldElement Invert() { ulong[] z = Nat576.Create64(); |