summary refs log tree commit diff
path: root/crypto/src/crypto/modes/GCMBlockCipher.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/crypto/modes/GCMBlockCipher.cs')
-rw-r--r--crypto/src/crypto/modes/GCMBlockCipher.cs22
1 files changed, 15 insertions, 7 deletions
diff --git a/crypto/src/crypto/modes/GCMBlockCipher.cs b/crypto/src/crypto/modes/GCMBlockCipher.cs
index ad4c044d4..b413088ab 100644
--- a/crypto/src/crypto/modes/GCMBlockCipher.cs
+++ b/crypto/src/crypto/modes/GCMBlockCipher.cs
@@ -30,7 +30,9 @@ namespace Org.BouncyCastle.Crypto.Modes
             Vector128.Create((byte)15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
 
         private static bool IsFourWaySupported =>
-            Pclmulqdq.IsSupported && Ssse3.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == BlockSize;
+            Org.BouncyCastle.Runtime.Intrinsics.X86.Pclmulqdq.IsEnabled &&
+            Org.BouncyCastle.Runtime.Intrinsics.X86.Ssse3.IsEnabled &&
+            Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked;
 #endif
 
         internal static IGcmMultiplier CreateGcmMultiplier()
@@ -1093,7 +1095,8 @@ namespace Org.BouncyCastle.Crypto.Modes
 
             GetNextCtrBlock(ctrBlock);
 #if NETCOREAPP3_0_OR_GREATER
-            if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == BlockSize)
+            if (Org.BouncyCastle.Runtime.Intrinsics.X86.Sse2.IsEnabled &&
+                Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked)
             {
                 var t0 = MemoryMarshal.Read<Vector128<byte>>(input);
                 var t1 = MemoryMarshal.Read<Vector128<byte>>(ctrBlock);
@@ -1135,7 +1138,8 @@ namespace Org.BouncyCastle.Crypto.Modes
 
             GetNextCtrBlock(ctrBlock);
 #if NETCOREAPP3_0_OR_GREATER
-            if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == BlockSize)
+            if (Org.BouncyCastle.Runtime.Intrinsics.X86.Sse2.IsEnabled &&
+                Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked)
             {
                 var t0 = MemoryMarshal.Read<Vector128<byte>>(input);
                 var t1 = MemoryMarshal.Read<Vector128<byte>>(ctrBlock);
@@ -1175,7 +1179,8 @@ namespace Org.BouncyCastle.Crypto.Modes
 
             GetNextCtrBlock(ctrBlock);
 #if NETCOREAPP3_0_OR_GREATER
-            if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == BlockSize)
+            if (Org.BouncyCastle.Runtime.Intrinsics.X86.Sse2.IsEnabled &&
+                Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked)
             {
                 var t0 = MemoryMarshal.Read<Vector128<byte>>(input);
                 var t1 = MemoryMarshal.Read<Vector128<byte>>(ctrBlock);
@@ -1290,7 +1295,8 @@ namespace Org.BouncyCastle.Crypto.Modes
 
             GetNextCtrBlock(ctrBlock);
 #if NETCOREAPP3_0_OR_GREATER
-            if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == BlockSize)
+            if (Org.BouncyCastle.Runtime.Intrinsics.X86.Sse2.IsEnabled &&
+                Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked)
             {
                 var t0 = MemoryMarshal.Read<Vector128<byte>>(input);
                 var t1 = MemoryMarshal.Read<Vector128<byte>>(ctrBlock);
@@ -1332,7 +1338,8 @@ namespace Org.BouncyCastle.Crypto.Modes
             GetNextCtrBlocks2(ctrBlocks);
 
 #if NETCOREAPP3_0_OR_GREATER
-            if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == BlockSize)
+            if (Org.BouncyCastle.Runtime.Intrinsics.X86.Sse2.IsEnabled &&
+                Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked)
             {
                 var t0 = MemoryMarshal.Read<Vector128<byte>>(input);
                 var t1 = MemoryMarshal.Read<Vector128<byte>>(ctrBlocks);
@@ -1372,7 +1379,8 @@ namespace Org.BouncyCastle.Crypto.Modes
             ctrBlocks = ctrBlocks[BlockSize..];
 
 #if NETCOREAPP3_0_OR_GREATER
-            if (Sse2.IsSupported && Unsafe.SizeOf<Vector128<byte>>() == BlockSize)
+            if (Org.BouncyCastle.Runtime.Intrinsics.X86.Sse2.IsEnabled &&
+                Org.BouncyCastle.Runtime.Intrinsics.Vector.IsPacked)
             {
                 var t0 = MemoryMarshal.Read<Vector128<byte>>(input);
                 var t1 = MemoryMarshal.Read<Vector128<byte>>(ctrBlocks);