summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-07-19 15:28:24 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-07-19 15:28:24 +0700
commitc5a1f12eff4da07c373b9a146003dac60614387c (patch)
treea51d8f4cf5740409bcb5688406302e9f93d116d7
parentAesX86Engine improvements (diff)
downloadBouncyCastle.NET-ed25519-c5a1f12eff4da07c373b9a146003dac60614387c.tar.xz
More precise preprocessor directives
-rw-r--r--crypto/src/crypto/AesUtilities.cs2
-rw-r--r--crypto/src/crypto/engines/AesX86Engine.cs2
-rw-r--r--crypto/src/crypto/modes/GCMBlockCipher.cs4
-rw-r--r--crypto/src/crypto/modes/gcm/GcmUtilities.cs4
-rw-r--r--crypto/src/math/BigInteger.cs6
-rw-r--r--crypto/src/math/ec/custom/sec/SecT571Field.cs4
-rw-r--r--crypto/src/math/raw/Interleave.cs14
-rw-r--r--crypto/src/util/Integers.cs6
-rw-r--r--crypto/src/util/Longs.cs6
9 files changed, 24 insertions, 24 deletions
diff --git a/crypto/src/crypto/AesUtilities.cs b/crypto/src/crypto/AesUtilities.cs
index 3b4fb520f..7cabf340c 100644
--- a/crypto/src/crypto/AesUtilities.cs
+++ b/crypto/src/crypto/AesUtilities.cs
@@ -6,7 +6,7 @@ namespace Org.BouncyCastle.Crypto
     {
         public static IBlockCipher CreateEngine()
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (AesX86Engine.IsSupported)
                 return new AesX86Engine();
 #endif
diff --git a/crypto/src/crypto/engines/AesX86Engine.cs b/crypto/src/crypto/engines/AesX86Engine.cs
index d16019992..6d856a765 100644
--- a/crypto/src/crypto/engines/AesX86Engine.cs
+++ b/crypto/src/crypto/engines/AesX86Engine.cs
@@ -1,4 +1,4 @@
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
 using System;
 using System.Runtime.CompilerServices;
 using System.Runtime.Intrinsics;
diff --git a/crypto/src/crypto/modes/GCMBlockCipher.cs b/crypto/src/crypto/modes/GCMBlockCipher.cs
index b2723e004..9250097cd 100644
--- a/crypto/src/crypto/modes/GCMBlockCipher.cs
+++ b/crypto/src/crypto/modes/GCMBlockCipher.cs
@@ -1,6 +1,5 @@
 using System;
 
-using Org.BouncyCastle.Crypto.Macs;
 using Org.BouncyCastle.Crypto.Modes.Gcm;
 using Org.BouncyCastle.Crypto.Parameters;
 using Org.BouncyCastle.Crypto.Utilities;
@@ -17,7 +16,8 @@ namespace Org.BouncyCastle.Crypto.Modes
     {
         private static IGcmMultiplier CreateGcmMultiplier()
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
+            // TODO Prefer more tightly coupled test
             if (System.Runtime.Intrinsics.X86.Pclmulqdq.IsSupported)
             {
                 return new BasicGcmMultiplier();
diff --git a/crypto/src/crypto/modes/gcm/GcmUtilities.cs b/crypto/src/crypto/modes/gcm/GcmUtilities.cs
index c40d53195..714e1fe49 100644
--- a/crypto/src/crypto/modes/gcm/GcmUtilities.cs
+++ b/crypto/src/crypto/modes/gcm/GcmUtilities.cs
@@ -1,5 +1,5 @@
 using System;
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
 using System.Runtime.Intrinsics;
 using System.Runtime.Intrinsics.X86;
 #endif
@@ -169,7 +169,7 @@ namespace Org.BouncyCastle.Crypto.Modes.Gcm
         {
             ulong z0, z1, z2, z3;
 
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Pclmulqdq.IsSupported)
             {
                 var X = Vector128.Create(x.n1, x.n0);
diff --git a/crypto/src/math/BigInteger.cs b/crypto/src/math/BigInteger.cs
index f915beafc..d6c43cdc0 100644
--- a/crypto/src/math/BigInteger.cs
+++ b/crypto/src/math/BigInteger.cs
@@ -2,7 +2,7 @@ using System;
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Globalization;
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
 using System.Runtime.Intrinsics.X86;
 #endif
 using System.Runtime.Serialization;
@@ -894,7 +894,7 @@ namespace Org.BouncyCastle.Math
 
         public static int BitCnt(int i)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Popcnt.IsSupported)
             {
                 return (int)Popcnt.PopCount((uint)i);
@@ -968,7 +968,7 @@ namespace Org.BouncyCastle.Math
         //
         private static int BitLen(int w)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Lzcnt.IsSupported)
             {
                 return 32 - (int)Lzcnt.LeadingZeroCount((uint)w);
diff --git a/crypto/src/math/ec/custom/sec/SecT571Field.cs b/crypto/src/math/ec/custom/sec/SecT571Field.cs
index 97bc08d67..91a3fde9d 100644
--- a/crypto/src/math/ec/custom/sec/SecT571Field.cs
+++ b/crypto/src/math/ec/custom/sec/SecT571Field.cs
@@ -1,6 +1,6 @@
 using System;
 using System.Diagnostics;
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
 using System.Runtime.Intrinsics;
 using System.Runtime.Intrinsics.X86;
 #endif
@@ -403,7 +403,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec
 
         protected static void ImplMulwAcc(ulong[] u, ulong x, ulong y, ulong[] z, int zOff)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Pclmulqdq.IsSupported)
             {
                 var X = Vector128.CreateScalar(x);
diff --git a/crypto/src/math/raw/Interleave.cs b/crypto/src/math/raw/Interleave.cs
index 560fd76fb..a71b4a1b8 100644
--- a/crypto/src/math/raw/Interleave.cs
+++ b/crypto/src/math/raw/Interleave.cs
@@ -1,5 +1,5 @@
 using System;
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
 using System.Runtime.Intrinsics.X86;
 #endif
 
@@ -32,7 +32,7 @@ namespace Org.BouncyCastle.Math.Raw
 
         internal static ulong Expand32to64(uint x)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi2.IsSupported)
             {
                 return (ulong)Bmi2.ParallelBitDeposit(x >> 16, 0x55555555U) << 32
@@ -51,7 +51,7 @@ namespace Org.BouncyCastle.Math.Raw
 
         internal static void Expand64To128(ulong x, ulong[] z, int zOff)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi2.X64.IsSupported)
             {
                 z[zOff    ] = Bmi2.X64.ParallelBitDeposit(x      , 0x5555555555555555UL);
@@ -92,7 +92,7 @@ namespace Org.BouncyCastle.Math.Raw
 
         internal static void Expand64To128Rev(ulong x, ulong[] z, int zOff)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi2.X64.IsSupported)
             {
                 z[zOff    ] = Bmi2.X64.ParallelBitDeposit(x >> 32, 0xAAAAAAAAAAAAAAAAUL);
@@ -155,7 +155,7 @@ namespace Org.BouncyCastle.Math.Raw
 
         internal static ulong Unshuffle(ulong x)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi2.X64.IsSupported)
             {
                 return Bmi2.X64.ParallelBitExtract(x, 0xAAAAAAAAAAAAAAAAUL) << 32
@@ -174,7 +174,7 @@ namespace Org.BouncyCastle.Math.Raw
 
         internal static ulong Unshuffle(ulong x, out ulong even)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi2.X64.IsSupported)
             {
                 even = Bmi2.X64.ParallelBitExtract(x, 0x5555555555555555UL);
@@ -189,7 +189,7 @@ namespace Org.BouncyCastle.Math.Raw
 
         internal static ulong Unshuffle(ulong x0, ulong x1, out ulong even)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi2.X64.IsSupported)
             {
                 even = Bmi2.X64.ParallelBitExtract(x0, 0x5555555555555555UL)
diff --git a/crypto/src/util/Integers.cs b/crypto/src/util/Integers.cs
index b32cdfc30..ff907ac80 100644
--- a/crypto/src/util/Integers.cs
+++ b/crypto/src/util/Integers.cs
@@ -1,5 +1,5 @@
 using System;
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
 using System.Runtime.Intrinsics.X86;
 #endif
 
@@ -45,7 +45,7 @@ namespace Org.BouncyCastle.Utilities
 
         public static int NumberOfLeadingZeros(int i)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Lzcnt.IsSupported)
             {
                 return (int)Lzcnt.LeadingZeroCount((uint)i);
@@ -67,7 +67,7 @@ namespace Org.BouncyCastle.Utilities
 
         public static int NumberOfTrailingZeros(int i)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi1.IsSupported)
             {
                 return (int)Bmi1.TrailingZeroCount((uint)i);
diff --git a/crypto/src/util/Longs.cs b/crypto/src/util/Longs.cs
index ff45a8143..45dd91090 100644
--- a/crypto/src/util/Longs.cs
+++ b/crypto/src/util/Longs.cs
@@ -1,5 +1,5 @@
 using System;
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
 using System.Runtime.Intrinsics.X86;
 #endif
 
@@ -48,7 +48,7 @@ namespace Org.BouncyCastle.Utilities
 
         public static int NumberOfLeadingZeros(long i)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Lzcnt.X64.IsSupported)
             {
                 return (int)Lzcnt.X64.LeadingZeroCount((ulong)i);
@@ -66,7 +66,7 @@ namespace Org.BouncyCastle.Utilities
 
         public static int NumberOfTrailingZeros(long i)
         {
-#if NET5_0_OR_GREATER
+#if NETCOREAPP3_0_OR_GREATER
             if (Bmi1.X64.IsSupported)
             {
                 return (int)Bmi1.X64.TrailingZeroCount((ulong)i);