summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-25 17:33:23 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-25 17:33:23 +0700
commit5fe8bb066e26228327121df17cd4e9e3cc24c7ae (patch)
treefa29ad449f396794e02c91f8d703550869f91fd9
parentXor methods in Nat classes (diff)
downloadBouncyCastle.NET-ed25519-5fe8bb066e26228327121df17cd4e9e3cc24c7ae.tar.xz
Remove unnecessary intrinsic usage
-rw-r--r--crypto/src/crypto/modes/gcm/GcmUtilities.cs28
1 files changed, 0 insertions, 28 deletions
diff --git a/crypto/src/crypto/modes/gcm/GcmUtilities.cs b/crypto/src/crypto/modes/gcm/GcmUtilities.cs
index e25092dce..97b34fb61 100644
--- a/crypto/src/crypto/modes/gcm/GcmUtilities.cs
+++ b/crypto/src/crypto/modes/gcm/GcmUtilities.cs
@@ -4,7 +4,6 @@ using System.Diagnostics;
 using System.Runtime.CompilerServices;
 #endif
 #if NETCOREAPP3_0_OR_GREATER
-using System.Runtime.InteropServices;
 using System.Runtime.Intrinsics;
 using System.Runtime.Intrinsics.X86;
 #endif
@@ -17,11 +16,6 @@ namespace Org.BouncyCastle.Crypto.Modes.Gcm
 {
     internal abstract class GcmUtilities
     {
-#if NETCOREAPP3_0_OR_GREATER
-        private static readonly Vector128<byte> EndianMask = Vector128.Create((byte)
-            0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01, 0x00, 0x0F, 0x0E, 0x0D, 0x0C, 0x0B, 0x0A, 0x09, 0x08);
-#endif
-
         internal struct FieldElement
         {
             internal ulong n0, n1;
@@ -41,17 +35,6 @@ namespace Org.BouncyCastle.Crypto.Modes.Gcm
 #endif
         internal static void AsBytes(ulong x0, ulong x1, byte[] z)
         {
-#if NETCOREAPP3_0_OR_GREATER
-            if (Ssse3.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<byte>>() == 16)
-            {
-                var X = Vector128.Create(x0, x1).AsByte();
-                // TODO[Arm] System.Runtime.Intrinsics.Arm.AdvSimd.Reverse8
-                var Z = Ssse3.Shuffle(X, EndianMask);
-                MemoryMarshal.Write(z.AsSpan(), ref Z);
-                return;
-            }
-#endif
-
             Pack.UInt64_To_BE(x0, z, 0);
             Pack.UInt64_To_BE(x1, z, 8);
         }
@@ -69,17 +52,6 @@ namespace Org.BouncyCastle.Crypto.Modes.Gcm
 #endif
         internal static void AsFieldElement(byte[] x, out FieldElement z)
         {
-#if NETCOREAPP3_0_OR_GREATER
-            if (Ssse3.IsSupported && BitConverter.IsLittleEndian && Unsafe.SizeOf<Vector128<byte>>() == 16)
-            {
-                var X = MemoryMarshal.Read<Vector128<byte>>(x.AsSpan());
-                var Z = Ssse3.Shuffle(X, EndianMask).AsUInt64();
-                z.n0 = Z.GetElement(0);
-                z.n1 = Z.GetElement(1);
-                return;
-            }
-#endif
-
             z.n0 = Pack.BE_To_UInt64(x, 0);
             z.n1 = Pack.BE_To_UInt64(x, 8);
         }