diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-07-05 16:01:23 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-07-05 16:01:23 +0700 |
commit | dee05948a56eb6edd6563089367255ee9676ecd2 (patch) | |
tree | 924a1f9964d0a1b4ff842074f4d4d976b66cd566 /crypto/src/math | |
parent | Move m_resumedSession to SecurityParameters (diff) | |
download | BouncyCastle.NET-ed25519-dee05948a56eb6edd6563089367255ee9676ecd2.tar.xz |
Use static classes and 'using' aliases
Diffstat (limited to 'crypto/src/math')
-rw-r--r-- | crypto/src/math/ec/rfc7748/X25519.cs | 6 | ||||
-rw-r--r-- | crypto/src/math/ec/rfc7748/X25519Field.cs | 4 | ||||
-rw-r--r-- | crypto/src/math/ec/rfc7748/X448.cs | 6 | ||||
-rw-r--r-- | crypto/src/math/ec/rfc7748/X448Field.cs | 4 | ||||
-rw-r--r-- | crypto/src/math/ec/rfc8032/Ed25519.cs | 5 | ||||
-rw-r--r-- | crypto/src/math/ec/rfc8032/Ed448.cs | 5 |
6 files changed, 12 insertions, 18 deletions
diff --git a/crypto/src/math/ec/rfc7748/X25519.cs b/crypto/src/math/ec/rfc7748/X25519.cs index bf845d2f5..217ef8785 100644 --- a/crypto/src/math/ec/rfc7748/X25519.cs +++ b/crypto/src/math/ec/rfc7748/X25519.cs @@ -7,13 +7,13 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Rfc7748 { - public abstract class X25519 + using F = X25519Field; + + public static class X25519 { public const int PointSize = 32; public const int ScalarSize = 32; - private class F : X25519Field {}; - private const int C_A = 486662; private const int C_A24 = (C_A + 2)/4; diff --git a/crypto/src/math/ec/rfc7748/X25519Field.cs b/crypto/src/math/ec/rfc7748/X25519Field.cs index 22486e453..e6d5687ec 100644 --- a/crypto/src/math/ec/rfc7748/X25519Field.cs +++ b/crypto/src/math/ec/rfc7748/X25519Field.cs @@ -5,7 +5,7 @@ using Org.BouncyCastle.Math.Raw; namespace Org.BouncyCastle.Math.EC.Rfc7748 { - public abstract class X25519Field + public static class X25519Field { public const int Size = 10; @@ -18,8 +18,6 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748 private static readonly int[] RootNegOne = { 0x020EA0B0, 0x0386C9D2, 0x00478C4E, 0x0035697F, 0x005E8630, 0x01FBD7A7, 0x0340264F, 0x01F0B2B4, 0x00027E0E, 0x00570649 }; - protected X25519Field() {} - public static void Add(int[] x, int[] y, int[] z) { for (int i = 0; i < Size; ++i) diff --git a/crypto/src/math/ec/rfc7748/X448.cs b/crypto/src/math/ec/rfc7748/X448.cs index 061a13163..7de78ebdc 100644 --- a/crypto/src/math/ec/rfc7748/X448.cs +++ b/crypto/src/math/ec/rfc7748/X448.cs @@ -7,13 +7,13 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Rfc7748 { - public abstract class X448 + using F = X448Field; + + public static class X448 { public const int PointSize = 56; public const int ScalarSize = 56; - private class F : X448Field {}; - private const uint C_A = 156326; private const uint C_A24 = (C_A + 2)/4; diff --git a/crypto/src/math/ec/rfc7748/X448Field.cs b/crypto/src/math/ec/rfc7748/X448Field.cs index 9e3693a3f..70273aea8 100644 --- a/crypto/src/math/ec/rfc7748/X448Field.cs +++ b/crypto/src/math/ec/rfc7748/X448Field.cs @@ -6,7 +6,7 @@ using Org.BouncyCastle.Math.Raw; namespace Org.BouncyCastle.Math.EC.Rfc7748 { [CLSCompliant(false)] - public abstract class X448Field + public static class X448Field { public const int Size = 16; @@ -16,8 +16,6 @@ namespace Org.BouncyCastle.Math.EC.Rfc7748 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFEU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU, 0xFFFFFFFFU }; - protected X448Field() {} - public static void Add(uint[] x, uint[] y, uint[] z) { for (int i = 0; i < Size; ++i) diff --git a/crypto/src/math/ec/rfc8032/Ed25519.cs b/crypto/src/math/ec/rfc8032/Ed25519.cs index 97aa9c7df..d88914c90 100644 --- a/crypto/src/math/ec/rfc8032/Ed25519.cs +++ b/crypto/src/math/ec/rfc8032/Ed25519.cs @@ -3,13 +3,14 @@ using System.Diagnostics; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Digests; -using Org.BouncyCastle.Math.EC.Rfc7748; using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Rfc8032 { + using F = Rfc7748.X25519Field; + /// <summary> /// A low-level implementation of the Ed25519, Ed25519ctx, and Ed25519ph instantiations of the Edwards-Curve Digital /// Signature Algorithm specified in <a href="https://www.rfc-editor.org/rfc/rfc8032">RFC 8032</a>. @@ -33,8 +34,6 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 Ed25519ph = 2, } - private class F : X25519Field {}; - private const long M08L = 0x000000FFL; private const long M28L = 0x0FFFFFFFL; private const long M32L = 0xFFFFFFFFL; diff --git a/crypto/src/math/ec/rfc8032/Ed448.cs b/crypto/src/math/ec/rfc8032/Ed448.cs index 39c0bc0ee..55ec5f03b 100644 --- a/crypto/src/math/ec/rfc8032/Ed448.cs +++ b/crypto/src/math/ec/rfc8032/Ed448.cs @@ -3,13 +3,14 @@ using System.Diagnostics; using Org.BouncyCastle.Crypto; using Org.BouncyCastle.Crypto.Digests; -using Org.BouncyCastle.Math.EC.Rfc7748; using Org.BouncyCastle.Math.Raw; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Math.EC.Rfc8032 { + using F = Rfc7748.X448Field; + /// <summary> /// A low-level implementation of the Ed448 and Ed448ph instantiations of the Edwards-Curve Digital Signature /// Algorithm specified in <a href="https://www.rfc-editor.org/rfc/rfc8032">RFC 8032</a>. @@ -30,8 +31,6 @@ namespace Org.BouncyCastle.Math.EC.Rfc8032 Ed448ph = 1, } - private class F : X448Field {}; - private const ulong M26UL = 0x03FFFFFFUL; private const ulong M28UL = 0x0FFFFFFFUL; |