From a0bb44cec332184f7e2c3be6d3ced4ecdadfd7c2 Mon Sep 17 00:00:00 2001 From: Marius Thesing Date: Sun, 2 Feb 2025 19:11:29 +0100 Subject: [PATCH] remove redundant #if for some reason this made the compiler suddenly realize that the plain text variables are unused. --- .../Cryptography/Ciphers/AesGcmCipher.BclImpl.cs | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/Renci.SshNet/Security/Cryptography/Ciphers/AesGcmCipher.BclImpl.cs b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesGcmCipher.BclImpl.cs index 0e2a1a41..742925a6 100644 --- a/src/Renci.SshNet/Security/Cryptography/Ciphers/AesGcmCipher.BclImpl.cs +++ b/src/Renci.SshNet/Security/Cryptography/Ciphers/AesGcmCipher.BclImpl.cs @@ -16,11 +16,7 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers public BclImpl(byte[] key, byte[] nonce) { -#if NET _aesGcm = new AesGcm(key, TagSizeInBytes); -#else - _aesGcm = new AesGcm(key); -#endif _nonce = nonce; } @@ -37,21 +33,15 @@ namespace Renci.SshNet.Security.Cryptography.Ciphers public override void Decrypt(byte[] input, int cipherTextOffset, int cipherTextLength, int associatedDataOffset, int associatedDataLength, byte[] output, int plainTextOffset) { - var plainTextLength = cipherTextLength; var cipherText = new ReadOnlySpan(input, cipherTextOffset, cipherTextLength); var tag = new ReadOnlySpan(input, cipherTextOffset + cipherTextLength, TagSizeInBytes); - var plainText = new Span(output, plainTextOffset, plainTextLength); var associatedData = new ReadOnlySpan(input, associatedDataOffset, associatedDataLength); try { _aesGcm.Decrypt(_nonce, cipherText, tag, output, associatedData); } -#if NET catch (AuthenticationTagMismatchException ex) -#else - catch (CryptographicException ex) -#endif { throw new SshConnectionException("MAC error", DisconnectReason.MacError, ex); }