Merge pull request #1374 from ergo720/kernel_crypto

Kernel function XcDESKeyParity implementation
This commit is contained in:
PatrickvL 2018-08-05 16:12:47 +02:00 committed by GitHub
commit bdd929ef04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 1 deletions

View File

@ -56,6 +56,10 @@ namespace NtDll
};
// Used by JumpedDESKeyParity
static const xboxkrnl::BYTE DESParityTable[] = { 0x00,0x01,0x01,0x02,0x01,0x02,0x02,0x03,0x01,0x02,0x02,0x03,0x02,0x03,0x03,0x04 };
// The following are the default implementations of the crypto functions
xboxkrnl::VOID NTAPI JumpedSHAInit
@ -233,7 +237,15 @@ xboxkrnl::VOID NTAPI JumpedDESKeyParity
xboxkrnl::ULONG dwKeyLength
)
{
LOG_UNIMPLEMENTED();
// This function sets the parity on the DES key to be odd
// Test case: Halo, Tenchu, dashboard, Splinter Cell 1 and 2, ...
for (DWORD i = 0; i < dwKeyLength; i++)
{
if (!((DESParityTable[pbKey[i] >> 4] + DESParityTable[pbKey[i] & 0x0F]) % 2)) {
pbKey[i] = pbKey[i] ^ 0x01;
}
}
}
xboxkrnl::VOID NTAPI JumpedKeyTable