mirror of
https://github.com/sshnet/SSH.NET.git
synced 2026-09-10 01:05:42 +00:00
Reset MAC after TransformFinalBlock on .NET Framework in Session.cs (#1830)
Add `#if NETFRAMEWORK` block to call `_serverMac.Initialize()` after `TransformFinalBlock` in `ReceiveMessage`. Ensures MAC is reset for reuse, addressing issues on older .NET Framework builds (e.g., mscorlib.dll 4.8.4110.0). Co-authored-by: Wojciech Nagórski <wojtpl2@gmail.com>
This commit is contained in:
@@ -1327,6 +1327,11 @@ namespace Renci.SshNet
|
||||
{
|
||||
throw new SshConnectionException("MAC error", DisconnectReason.MacError);
|
||||
}
|
||||
#if NETFRAMEWORK
|
||||
// Ensure MAC is reset so that it can be reused for the next packet
|
||||
// It is only required for certain older .NET Framework builds, e.g., mscorlib.dll version 4.8.4110.0
|
||||
_serverMac.Initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
var numberOfBytesToDecrypt = 4 + packetLength - blockSize;
|
||||
@@ -1374,6 +1379,11 @@ namespace Renci.SshNet
|
||||
{
|
||||
throw new SshConnectionException("MAC error", DisconnectReason.MacError);
|
||||
}
|
||||
#if NETFRAMEWORK
|
||||
// Ensure MAC is reset so that it can be reused for the next packet
|
||||
// It is only required for certain older .NET Framework builds, e.g., mscorlib.dll version 4.8.4110.0
|
||||
_serverMac.Initialize();
|
||||
#endif
|
||||
}
|
||||
|
||||
var paddingLength = _receiveBuffer.ActiveReadOnlySpan[packetLengthFieldLength];
|
||||
|
||||
Reference in New Issue
Block a user