diff --git a/crypto/src/cms/CMSSignedHelper.cs b/crypto/src/cms/CMSSignedHelper.cs
index a1e894947..1f78835e8 100644
--- a/crypto/src/cms/CMSSignedHelper.cs
+++ b/crypto/src/cms/CMSSignedHelper.cs
@@ -130,7 +130,6 @@ namespace Org.BouncyCastle.Cms
m_digestAliases.Add("SHA512", new string[]{ "SHA-512" });
m_noParams.Add(CmsSignedGenerator.EncryptionDsa);
- //m_noParams.Add(EncryptionECDsa);
m_noParams.Add(EncryptionECDsaWithSha1);
m_noParams.Add(EncryptionECDsaWithSha224);
m_noParams.Add(EncryptionECDsaWithSha256);
@@ -174,10 +173,8 @@ namespace Org.BouncyCastle.Cms
* JCA string representations rather than the algorithm identifier (if
* possible).
*/
- internal static string GetEncryptionAlgName(string encryptionAlgOid)
- {
- return CollectionUtilities.GetValueOrKey(m_encryptionAlgs, encryptionAlgOid);
- }
+ internal static string GetEncryptionAlgName(string encryptionAlgOid) =>
+ CollectionUtilities.GetValueOrKey(m_encryptionAlgs, encryptionAlgOid);
internal static IDigest GetDigestInstance(string algorithm)
{
diff --git a/crypto/src/crypto/AesUtilities.cs b/crypto/src/crypto/AesUtilities.cs
index 1ec255c09..2d7650551 100644
--- a/crypto/src/crypto/AesUtilities.cs
+++ b/crypto/src/crypto/AesUtilities.cs
@@ -7,7 +7,7 @@ namespace Org.BouncyCastle.Crypto
public static IBlockCipher CreateEngine()
{
#if NETCOREAPP3_0_OR_GREATER
- if (AesEngine_X86.IsSupported)
+ if (IsHardwareAccelerated)
return new AesEngine_X86();
#endif
diff --git a/crypto/src/math/raw/Mod.cs b/crypto/src/math/raw/Mod.cs
index f1ca2ebf0..20f445154 100644
--- a/crypto/src/math/raw/Mod.cs
+++ b/crypto/src/math/raw/Mod.cs
@@ -500,7 +500,7 @@ namespace Org.BouncyCastle.Math.Raw
Debug.Assert(bits > 0);
int avail = 0;
- ulong data = 0L;
+ ulong data = 0UL;
int xOff = 0, zOff = 0;
while (bits > 0)
@@ -522,7 +522,7 @@ namespace Org.BouncyCastle.Math.Raw
Debug.Assert(bits > 0);
int avail = 0;
- ulong data = 0L;
+ ulong data = 0UL;
while (bits > 0)
{
diff --git a/crypto/src/pqc/crypto/crystals/dilithium/Reduce.cs b/crypto/src/pqc/crypto/crystals/dilithium/Reduce.cs
index 0f8b95ef1..b467d8109 100644
--- a/crypto/src/pqc/crypto/crystals/dilithium/Reduce.cs
+++ b/crypto/src/pqc/crypto/crystals/dilithium/Reduce.cs
@@ -4,27 +4,16 @@
{
public static int MontgomeryReduce(long a)
{
- int t;
- t = (int)(a * DilithiumEngine.QInv);
- t = (int)((a - (long)((long)t * (long)DilithiumEngine.Q)) >> 32);
- //Console.Write("{0}, ", t);
- return t;
+ int t = (int)(a * DilithiumEngine.QInv);
+ return (int)((a - (long)t * DilithiumEngine.Q) >> 32);
}
public static int Reduce32(int a)
{
- int t;
- t = (a + (1 << 22)) >> 23;
- t = a - t * DilithiumEngine.Q;
- return t;
+ int t = (a + (1 << 22)) >> 23;
+ return a - t * DilithiumEngine.Q;
}
-
- public static int ConditionalAddQ(int a)
- {
- a += (a >> 31) & DilithiumEngine.Q;
- return a;
- }
-
+ public static int ConditionalAddQ(int a) => a + ((a >> 31) & DilithiumEngine.Q);
}
-}
\ No newline at end of file
+}
|