diff options
Diffstat (limited to 'crypto/src/math/ec/custom/sec')
23 files changed, 45 insertions, 34 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs index ffe40581f..58bff2390 100644 --- a/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP128R1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP128R1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF")); + public static readonly BigInteger q = SecP128R1FieldElement.Q; private const int SECP128R1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP128R1_FE_INTS = 4; diff --git a/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs index 5912a87e8..04f432ced 100644 --- a/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP128R1FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP128R1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP128R1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs index 4bacd55c6..1b5bbfe96 100644 --- a/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP160K1Curve.cs @@ -8,7 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP160K1Curve : AbstractFpCurve { - public static readonly BigInteger q = SecP160R2Curve.q; + public static readonly BigInteger q = SecP160R2FieldElement.Q; private const int SECP160K1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP160K1_FE_INTS = 5; diff --git a/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs index c48edaf7c..42f2f467b 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP160R1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF")); + public static readonly BigInteger q = SecP160R1FieldElement.Q; private const int SECP160R1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP160R1_FE_INTS = 5; diff --git a/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs index 3ab11bdae..5365d7cd0 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R1FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP160R1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP160R1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs b/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs index ecc836671..17f73d7ce 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R2Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP160R2Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73")); + public static readonly BigInteger q = SecP160R2FieldElement.Q; private const int SECP160R2_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP160R2_FE_INTS = 5; diff --git a/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs index 9d8131857..95d3c0b31 100644 --- a/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP160R2FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP160R2FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP160R2Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs index 62e253dc5..6647ebab9 100644 --- a/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP192K1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP192K1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37")); + public static readonly BigInteger q = SecP192K1FieldElement.Q; private const int SECP192K1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP192K1_FE_INTS = 6; diff --git a/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs index 54b72573c..d3de532d9 100644 --- a/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP192K1FieldElement.cs @@ -3,13 +3,15 @@ using System.Diagnostics; using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP192K1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP192K1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs index 8b9042627..a65afd0b0 100644 --- a/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP192R1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP192R1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF")); + public static readonly BigInteger q = SecP192R1FieldElement.Q; private const int SECP192R1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP192R1_FE_INTS = 6; diff --git a/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs index f3e12b542..65a1aadb3 100644 --- a/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP192R1FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP192R1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP192R1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs index 859cb8526..ce56fbf52 100644 --- a/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP224K1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP224K1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D")); + public static readonly BigInteger q = SecP224K1FieldElement.Q; private const int SECP224K1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP224K1_FE_INTS = 7; diff --git a/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs index ef53a88d6..0614b7def 100644 --- a/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP224K1FieldElement.cs @@ -3,13 +3,15 @@ using System.Diagnostics; using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP224K1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP224K1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFE56D")); // Calculated as BigInteger.Two.ModPow(Q.ShiftRight(2), Q) private static readonly uint[] PRECOMP_POW2 = new uint[]{ 0x33bfd202, 0xdcfad133, 0x2287624a, 0xc3811ba8, diff --git a/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs index bb63ebf5e..a37fc282f 100644 --- a/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP224R1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP224R1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001")); + public static readonly BigInteger q = SecP224R1FieldElement.Q; private const int SECP224R1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP224R1_FE_INTS = 7; diff --git a/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs index 5780b7481..968bc0baa 100644 --- a/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP224R1FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP224R1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP224R1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs b/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs index bdda5a1b9..26c788b5f 100644 --- a/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP256K1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP256K1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F")); + public static readonly BigInteger q = SecP256K1FieldElement.Q; private const int SECP256K1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP256K1_FE_INTS = 8; diff --git a/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs index 9a604bdb7..d24f8d0df 100644 --- a/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP256K1FieldElement.cs @@ -3,13 +3,15 @@ using System.Diagnostics; using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP256K1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP256K1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs index 24341e613..504d7edc6 100644 --- a/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP256R1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP256R1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF")); + public static readonly BigInteger q = SecP256R1FieldElement.Q; private const int SECP256R1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP256R1_FE_INTS = 8; diff --git a/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs index 808e99ea6..be4021485 100644 --- a/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP256R1FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP256R1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP256R1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs index ac1855945..5c6afc2e5 100644 --- a/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP384R1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP384R1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF")); + public static readonly BigInteger q = SecP384R1FieldElement.Q; private const int SECP384R1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP384R1_FE_INTS = 12; diff --git a/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs index 7eedccae6..9d3f51d87 100644 --- a/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP384R1FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP384R1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP384R1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF")); protected internal readonly uint[] x; diff --git a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs index 0841fb8a5..cca86e2cb 100644 --- a/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs +++ b/crypto/src/math/ec/custom/sec/SecP521R1Curve.cs @@ -8,8 +8,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec internal class SecP521R1Curve : AbstractFpCurve { - public static readonly BigInteger q = new BigInteger(1, - Hex.Decode("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")); + public static readonly BigInteger q = SecP521R1FieldElement.Q; private const int SECP521R1_DEFAULT_COORDS = COORD_JACOBIAN; private const int SECP521R1_FE_INTS = 17; diff --git a/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs b/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs index 96658a8e5..a428a1243 100644 --- a/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs +++ b/crypto/src/math/ec/custom/sec/SecP521R1FieldElement.cs @@ -2,13 +2,15 @@ using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Utilities.Encoders; namespace Org.BouncyCastle.Math.EC.Custom.Sec { internal class SecP521R1FieldElement : AbstractFpFieldElement { - public static readonly BigInteger Q = SecP521R1Curve.q; + public static readonly BigInteger Q = new BigInteger(1, + Hex.Decode("01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF")); protected internal readonly uint[] x; |