diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-16 00:34:11 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2023-02-16 00:34:11 +0700 |
commit | 5d3db83396bd13c1b6775faa1ba7c2a98d0723db (patch) | |
tree | 9843567f33024bf947fa09fc87de55ee0709225d /crypto/src | |
parent | PublicExponent is never null (diff) | |
download | BouncyCastle.NET-ed25519-5d3db83396bd13c1b6775faa1ba7c2a98d0723db.tar.xz |
Mark user-customizable GCM multipliers Obsolete
Diffstat (limited to 'crypto/src')
10 files changed, 24 insertions, 3 deletions
diff --git a/crypto/src/crypto/modes/GCMBlockCipher.cs b/crypto/src/crypto/modes/GCMBlockCipher.cs index 41d850b41..e7eb9d916 100644 --- a/crypto/src/crypto/modes/GCMBlockCipher.cs +++ b/crypto/src/crypto/modes/GCMBlockCipher.cs @@ -15,13 +15,14 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Modes { +#pragma warning disable CS0618 // Type or member is obsolete /// <summary> /// Implements the Galois/Counter mode (GCM) detailed in NIST Special Publication 800-38D. /// </summary> public sealed class GcmBlockCipher : IAeadBlockCipher { - private static IGcmMultiplier CreateGcmMultiplier() + internal static IGcmMultiplier CreateGcmMultiplier() { #if NETCOREAPP3_0_OR_GREATER // TODO Prefer more tightly coupled test @@ -70,6 +71,7 @@ namespace Org.BouncyCastle.Crypto.Modes { } + [Obsolete("Will be removed")] public GcmBlockCipher( IBlockCipher c, IGcmMultiplier m) @@ -1496,4 +1498,5 @@ namespace Org.BouncyCastle.Crypto.Modes } } } +#pragma warning restore CS0618 // Type or member is obsolete } diff --git a/crypto/src/crypto/modes/GcmSivBlockCipher.cs b/crypto/src/crypto/modes/GcmSivBlockCipher.cs index 7246b59c1..a4fcdd759 100644 --- a/crypto/src/crypto/modes/GcmSivBlockCipher.cs +++ b/crypto/src/crypto/modes/GcmSivBlockCipher.cs @@ -66,7 +66,9 @@ namespace Org.BouncyCastle.Crypto.Modes /** * The multiplier. */ +#pragma warning disable CS0618 // Type or member is obsolete private readonly IGcmMultiplier theMultiplier; +#pragma warning restore CS0618 // Type or member is obsolete /** * The gHash buffer. @@ -126,12 +128,13 @@ namespace Org.BouncyCastle.Crypto.Modes { } +#pragma warning disable CS0618 // Type or member is obsolete /** * Constructor. * @param pCipher the underlying cipher */ public GcmSivBlockCipher(IBlockCipher pCipher) - : this(pCipher, new Tables4kGcmMultiplier()) + : this(pCipher, null) { } @@ -140,12 +143,18 @@ namespace Org.BouncyCastle.Crypto.Modes * @param pCipher the underlying cipher * @param pMultiplier the multiplier */ + [Obsolete("Will be removed")] public GcmSivBlockCipher(IBlockCipher pCipher, IGcmMultiplier pMultiplier) { /* Ensure that the cipher is the correct size */ if (pCipher.GetBlockSize() != BUFLEN) throw new ArgumentException("Cipher required with a block size of " + BUFLEN + "."); + if (pMultiplier == null) + { + pMultiplier = GcmBlockCipher.CreateGcmMultiplier(); + } + /* Store parameters */ theCipher = pCipher; theMultiplier = pMultiplier; @@ -154,6 +163,7 @@ namespace Org.BouncyCastle.Crypto.Modes theAEADHasher = new GcmSivHasher(this); theDataHasher = new GcmSivHasher(this); } +#pragma warning restore CS0618 // Type or member is obsolete public virtual IBlockCipher UnderlyingCipher => theCipher; diff --git a/crypto/src/crypto/modes/gcm/BasicGcmExponentiator.cs b/crypto/src/crypto/modes/gcm/BasicGcmExponentiator.cs index 4ef1bf745..b24550c8c 100644 --- a/crypto/src/crypto/modes/gcm/BasicGcmExponentiator.cs +++ b/crypto/src/crypto/modes/gcm/BasicGcmExponentiator.cs @@ -2,6 +2,7 @@ using System; namespace Org.BouncyCastle.Crypto.Modes.Gcm { + [Obsolete("Will be removed")] public class BasicGcmExponentiator : IGcmExponentiator { diff --git a/crypto/src/crypto/modes/gcm/BasicGcmMultiplier.cs b/crypto/src/crypto/modes/gcm/BasicGcmMultiplier.cs index f36aaa8e4..abae4f3fa 100644 --- a/crypto/src/crypto/modes/gcm/BasicGcmMultiplier.cs +++ b/crypto/src/crypto/modes/gcm/BasicGcmMultiplier.cs @@ -2,6 +2,7 @@ using System; namespace Org.BouncyCastle.Crypto.Modes.Gcm { + [Obsolete("Will be removed")] public class BasicGcmMultiplier : IGcmMultiplier { diff --git a/crypto/src/crypto/modes/gcm/IGcmExponentiator.cs b/crypto/src/crypto/modes/gcm/IGcmExponentiator.cs index 5b4ce9d7a..bd6c07363 100644 --- a/crypto/src/crypto/modes/gcm/IGcmExponentiator.cs +++ b/crypto/src/crypto/modes/gcm/IGcmExponentiator.cs @@ -2,7 +2,8 @@ using System; namespace Org.BouncyCastle.Crypto.Modes.Gcm { - public interface IGcmExponentiator + [Obsolete("Will be removed")] + public interface IGcmExponentiator { void Init(byte[] x); void ExponentiateX(long pow, byte[] output); diff --git a/crypto/src/crypto/modes/gcm/IGcmMultiplier.cs b/crypto/src/crypto/modes/gcm/IGcmMultiplier.cs index ec7b906ee..118423860 100644 --- a/crypto/src/crypto/modes/gcm/IGcmMultiplier.cs +++ b/crypto/src/crypto/modes/gcm/IGcmMultiplier.cs @@ -2,6 +2,7 @@ using System; namespace Org.BouncyCastle.Crypto.Modes.Gcm { + [Obsolete("Will be removed")] public interface IGcmMultiplier { void Init(byte[] H); diff --git a/crypto/src/crypto/modes/gcm/Tables1kGcmExponentiator.cs b/crypto/src/crypto/modes/gcm/Tables1kGcmExponentiator.cs index 15f8e058e..417e0b636 100644 --- a/crypto/src/crypto/modes/gcm/Tables1kGcmExponentiator.cs +++ b/crypto/src/crypto/modes/gcm/Tables1kGcmExponentiator.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; namespace Org.BouncyCastle.Crypto.Modes.Gcm { + [Obsolete("Will be removed")] public class Tables1kGcmExponentiator : IGcmExponentiator { diff --git a/crypto/src/crypto/modes/gcm/Tables4kGcmMultiplier.cs b/crypto/src/crypto/modes/gcm/Tables4kGcmMultiplier.cs index 117558b45..4d07d2c72 100644 --- a/crypto/src/crypto/modes/gcm/Tables4kGcmMultiplier.cs +++ b/crypto/src/crypto/modes/gcm/Tables4kGcmMultiplier.cs @@ -5,6 +5,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Modes.Gcm { + [Obsolete("Will be removed")] public class Tables4kGcmMultiplier : IGcmMultiplier { diff --git a/crypto/src/crypto/modes/gcm/Tables64kGcmMultiplier.cs b/crypto/src/crypto/modes/gcm/Tables64kGcmMultiplier.cs index 52a9d4e82..ba5b466db 100644 --- a/crypto/src/crypto/modes/gcm/Tables64kGcmMultiplier.cs +++ b/crypto/src/crypto/modes/gcm/Tables64kGcmMultiplier.cs @@ -5,6 +5,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Modes.Gcm { + [Obsolete("Will be removed")] public class Tables64kGcmMultiplier : IGcmMultiplier { diff --git a/crypto/src/crypto/modes/gcm/Tables8kGcmMultiplier.cs b/crypto/src/crypto/modes/gcm/Tables8kGcmMultiplier.cs index 7fe122526..f2ecac585 100644 --- a/crypto/src/crypto/modes/gcm/Tables8kGcmMultiplier.cs +++ b/crypto/src/crypto/modes/gcm/Tables8kGcmMultiplier.cs @@ -5,6 +5,7 @@ using Org.BouncyCastle.Utilities; namespace Org.BouncyCastle.Crypto.Modes.Gcm { + [Obsolete("Will be removed")] public class Tables8kGcmMultiplier : IGcmMultiplier { |