diff options
Diffstat (limited to 'crypto/src/math/ec/custom/sec')
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT113Field.cs | 5 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT131Field.cs | 5 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT163Field.cs | 5 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT193Field.cs | 4 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT233Field.cs | 5 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT239Field.cs | 5 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT283Field.cs | 5 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT409Field.cs | 4 | ||||
-rw-r--r-- | crypto/src/math/ec/custom/sec/SecT571Field.cs | 4 |
9 files changed, 24 insertions, 18 deletions
diff --git a/crypto/src/math/ec/custom/sec/SecT113Field.cs b/crypto/src/math/ec/custom/sec/SecT113Field.cs index 596d8070b..2477b9c78 100644 --- a/crypto/src/math/ec/custom/sec/SecT113Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT113Field.cs @@ -287,7 +287,8 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private static void ImplMultiply(ReadOnlySpan<ulong> x, ReadOnlySpan<ulong> y, Span<ulong> zz) { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<ulong>>() == 16) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPackedLittleEndian) { var X01 = Vector128.Create(x[0], x[1]); var Y01 = Vector128.Create(y[0], y[1]); @@ -424,7 +425,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec #endif { #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { zz[3] = Bmi2.X64.ParallelBitDeposit(x[1] >> 32, 0x5555555555555555UL); zz[2] = Bmi2.X64.ParallelBitDeposit(x[1] , 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT131Field.cs b/crypto/src/math/ec/custom/sec/SecT131Field.cs index 743fa6a5d..49d504afb 100644 --- a/crypto/src/math/ec/custom/sec/SecT131Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT131Field.cs @@ -324,7 +324,8 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private static void ImplMultiply(ReadOnlySpan<ulong> x, ReadOnlySpan<ulong> y, Span<ulong> zz) { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<ulong>>() == 16) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPackedLittleEndian) { var X01 = Vector128.Create(x[0], x[1]); var X2_ = Vector128.CreateScalar(x[2]); @@ -620,7 +621,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec zz[4] = Interleave.Expand8to16((byte)x[2]); #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { zz[3] = Bmi2.X64.ParallelBitDeposit(x[1] >> 32, 0x5555555555555555UL); zz[2] = Bmi2.X64.ParallelBitDeposit(x[1] , 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT163Field.cs b/crypto/src/math/ec/custom/sec/SecT163Field.cs index d0f09cd8b..e4fda48ac 100644 --- a/crypto/src/math/ec/custom/sec/SecT163Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT163Field.cs @@ -335,7 +335,8 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private static void ImplMultiply(ReadOnlySpan<ulong> x, ReadOnlySpan<ulong> y, Span<ulong> zz) { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<ulong>>() == 16) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPackedLittleEndian) { var X01 = Vector128.Create(x[0], x[1]); var X2_ = Vector128.CreateScalar(x[2]); @@ -623,7 +624,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec #endif { #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { zz[5] = Bmi2.X64.ParallelBitDeposit(x[2] >> 32, 0x5555555555555555UL); zz[4] = Bmi2.X64.ParallelBitDeposit(x[2] , 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT193Field.cs b/crypto/src/math/ec/custom/sec/SecT193Field.cs index b610bf554..7eebc29c6 100644 --- a/crypto/src/math/ec/custom/sec/SecT193Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT193Field.cs @@ -360,7 +360,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private static void ImplMultiply(ReadOnlySpan<ulong> x, ReadOnlySpan<ulong> y, Span<ulong> zz) { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled) { var X01 = Vector128.Create(x[0], x[1]); var X2_ = Vector128.CreateScalar(x[2]); @@ -545,7 +545,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec zz[6] = x[3] & M01; #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { zz[5] = Bmi2.X64.ParallelBitDeposit(x[2] >> 32, 0x5555555555555555UL); zz[4] = Bmi2.X64.ParallelBitDeposit(x[2] , 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT233Field.cs b/crypto/src/math/ec/custom/sec/SecT233Field.cs index 00bbc0635..bf7b33139 100644 --- a/crypto/src/math/ec/custom/sec/SecT233Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT233Field.cs @@ -378,7 +378,8 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private static void ImplMultiply(ReadOnlySpan<ulong> x, ReadOnlySpan<ulong> y, Span<ulong> zz) { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<ulong>>() == 16) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPackedLittleEndian) { var X01 = Vector128.Create(x[0], x[1]); var X23 = Vector128.Create(x[2], x[3]); @@ -576,7 +577,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec #endif { #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { ulong x0 = x[0], x1 = x[1], x2 = x[2], x3 = x[3]; zz[7] = Bmi2.X64.ParallelBitDeposit(x3 >> 32, 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT239Field.cs b/crypto/src/math/ec/custom/sec/SecT239Field.cs index b90867b76..a6f3c9e4d 100644 --- a/crypto/src/math/ec/custom/sec/SecT239Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT239Field.cs @@ -387,7 +387,8 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private static void ImplMultiply(ReadOnlySpan<ulong> x, ReadOnlySpan<ulong> y, Span<ulong> zz) { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<ulong>>() == 16) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPackedLittleEndian) { var X01 = Vector128.Create(x[0], x[1]); var X23 = Vector128.Create(x[2], x[3]); @@ -587,7 +588,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec #endif { #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { ulong x0 = x[0], x1 = x[1], x2 = x[2], x3 = x[3]; zz[7] = Bmi2.X64.ParallelBitDeposit(x3 >> 32, 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT283Field.cs b/crypto/src/math/ec/custom/sec/SecT283Field.cs index 498a72c81..92f8ea385 100644 --- a/crypto/src/math/ec/custom/sec/SecT283Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT283Field.cs @@ -386,7 +386,8 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec private static void ImplMultiply(ReadOnlySpan<ulong> x, ReadOnlySpan<ulong> y, Span<ulong> zz) { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<ulong>>() == 16) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled && + Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPackedLittleEndian) { var X01 = Vector128.Create(x[0], x[1]); var X23 = Vector128.Create(x[2], x[3]); @@ -746,7 +747,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec zz[8] = Interleave.Expand32to64((uint)x[4]); #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { zz[7] = Bmi2.X64.ParallelBitDeposit(x[3] >> 32, 0x5555555555555555UL); zz[6] = Bmi2.X64.ParallelBitDeposit(x[3] , 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT409Field.cs b/crypto/src/math/ec/custom/sec/SecT409Field.cs index 6a5afb0dc..a8a39a575 100644 --- a/crypto/src/math/ec/custom/sec/SecT409Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT409Field.cs @@ -551,7 +551,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec Debug.Assert(y >> 59 == 0); #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled) { var X = Vector128.CreateScalar(x); var Y = Vector128.CreateScalar(y); @@ -607,7 +607,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec zz[12] = Interleave.Expand32to64((uint)x[6]); #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { zz[11] = Bmi2.X64.ParallelBitDeposit(x[5] >> 32, 0x5555555555555555UL); zz[10] = Bmi2.X64.ParallelBitDeposit(x[5] , 0x5555555555555555UL); diff --git a/crypto/src/math/ec/custom/sec/SecT571Field.cs b/crypto/src/math/ec/custom/sec/SecT571Field.cs index e970027a5..47f157dc3 100644 --- a/crypto/src/math/ec/custom/sec/SecT571Field.cs +++ b/crypto/src/math/ec/custom/sec/SecT571Field.cs @@ -654,7 +654,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec #endif { #if NETCOREAPP3_0_OR_GREATER - if (Pclmulqdq.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled) { var X = Vector128.CreateScalar(x); var Y = Vector128.CreateScalar(y); @@ -711,7 +711,7 @@ namespace Org.BouncyCastle.Math.EC.Custom.Sec #endif { #if NETCOREAPP3_0_OR_GREATER - if (Bmi2.X64.IsSupported) + if (Org.BouncyCastle.Runtime.Intrinsics.X86.Bmi2.X64.IsEnabled) { zz[17] = Bmi2.X64.ParallelBitDeposit(x[8] >> 32, 0x5555555555555555UL); zz[16] = Bmi2.X64.ParallelBitDeposit(x[8] , 0x5555555555555555UL); |