From 930600ff7a4c306e287709cda29aa9c5ec864ec4 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 2 Sep 2022 16:54:32 +0700 Subject: MethodImplOptions in GCMBlockCipher --- crypto/src/crypto/modes/GCMBlockCipher.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crypto/src/crypto/modes/GCMBlockCipher.cs b/crypto/src/crypto/modes/GCMBlockCipher.cs index 2cc7ff62d..05db1c2c4 100644 --- a/crypto/src/crypto/modes/GCMBlockCipher.cs +++ b/crypto/src/crypto/modes/GCMBlockCipher.cs @@ -1,6 +1,8 @@ using System; -#if NETCOREAPP3_0_OR_GREATER +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER using System.Runtime.CompilerServices; +#endif +#if NETCOREAPP3_0_OR_GREATER using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; #endif @@ -808,6 +810,7 @@ namespace Org.BouncyCastle.Crypto.Modes } #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + [MethodImpl(MethodImplOptions.AggressiveOptimization)] private void DecryptBlock(ReadOnlySpan input, Span output) { Check.OutputLength(output, BlockSize, "output buffer too short"); @@ -859,6 +862,7 @@ namespace Org.BouncyCastle.Crypto.Modes totalLength += BlockSize; } + [MethodImpl(MethodImplOptions.AggressiveOptimization)] private void DecryptBlocks2(ReadOnlySpan input, Span output) { Check.OutputLength(output, BlockSize * 2, "output buffer too short"); @@ -950,6 +954,7 @@ namespace Org.BouncyCastle.Crypto.Modes totalLength += BlockSize * 2; } + [MethodImpl(MethodImplOptions.AggressiveOptimization)] private void EncryptBlock(ReadOnlySpan input, Span output) { Check.OutputLength(output, BlockSize, "output buffer too short"); @@ -1001,6 +1006,7 @@ namespace Org.BouncyCastle.Crypto.Modes totalLength += BlockSize; } + [MethodImpl(MethodImplOptions.AggressiveOptimization)] private void EncryptBlocks2(ReadOnlySpan input, Span output) { Check.OutputLength(output, BlockSize * 2, "Output buffer too short"); @@ -1092,6 +1098,7 @@ namespace Org.BouncyCastle.Crypto.Modes totalLength += BlockSize * 2; } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private void GetNextCtrBlock(Span block) { if (blocksRemaining == 0) @@ -1341,6 +1348,7 @@ namespace Org.BouncyCastle.Crypto.Modes } #if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER + [MethodImpl(MethodImplOptions.AggressiveInlining)] private void gHASHBlock(byte[] Y, ReadOnlySpan b) { GcmUtilities.Xor(Y, b); -- cgit 1.4.1