SMB2Command: Renamed parameter

This commit is contained in:
TalAloni 2020-11-28 21:50:37 +02:00
parent 1636079cc2
commit d50ce6f710

View file

@ -1,4 +1,4 @@
/* Copyright (C) 2017-2019 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved. /* Copyright (C) 2017-2020 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
* *
* You can redistribute this program and/or modify it under the terms of * You can redistribute this program and/or modify it under the terms of
* the GNU Lesser Public License as published by the Free Software Foundation, * the GNU Lesser Public License as published by the Free Software Foundation,
@ -133,7 +133,7 @@ namespace SMBLibrary.SMB2
/// <param name="dialect"> /// <param name="dialect">
/// Used for signature calculation when applicable. /// Used for signature calculation when applicable.
/// </param> /// </param>
public static byte[] GetCommandChainBytes(List<SMB2Command> commands, byte[] sessionKey, SMB2Dialect dialect) public static byte[] GetCommandChainBytes(List<SMB2Command> commands, byte[] signingKey, SMB2Dialect dialect)
{ {
int totalLength = 0; int totalLength = 0;
for (int index = 0; index < commands.Count; index++) for (int index = 0; index < commands.Count; index++)
@ -167,10 +167,10 @@ namespace SMBLibrary.SMB2
paddedLength = commandLength; paddedLength = commandLength;
} }
command.WriteBytes(buffer, offset); command.WriteBytes(buffer, offset);
if (command.Header.IsSigned && sessionKey != null) if (command.Header.IsSigned && signingKey != null)
{ {
// [MS-SMB2] Any padding at the end of the message MUST be used in the hash computation. // [MS-SMB2] Any padding at the end of the message MUST be used in the hash computation.
byte[] signature = SMB2Cryptography.CalculateSignature(sessionKey, dialect, buffer, offset, paddedLength); byte[] signature = SMB2Cryptography.CalculateSignature(signingKey, dialect, buffer, offset, paddedLength);
// [MS-SMB2] The first 16 bytes of the hash MUST be copied into the 16-byte signature field of the SMB2 Header. // [MS-SMB2] The first 16 bytes of the hash MUST be copied into the 16-byte signature field of the SMB2 Header.
ByteWriter.WriteBytes(buffer, offset + SMB2Header.SignatureOffset, signature, 16); ByteWriter.WriteBytes(buffer, offset + SMB2Header.SignatureOffset, signature, 16);
} }