Fix major crypto bug

`cryptKeyTruncByte` was incorrectly typed as a byte when 1 was added.
This caused `cryptKeyTruncByte` to wrap around to 0 when it was 0xFF,
resulting in an incorrect multiplication by zero, breaking [en|de]cryption entirely.
This commit is contained in:
Andrew Gutekanst
2020-02-22 21:03:35 -05:00
parent fff92b16ed
commit ecc0e49497
2 changed files with 7 additions and 1 deletions

View File

@@ -28,7 +28,7 @@ func _generalCrypt(data []byte, rotKey uint32, cryptType int, overrideByteKey *b
cryptKeyTruncByte = *overrideByteKey
}
derivedCryptKey := int32((uint32(len(data)) * uint32(cryptKeyTruncByte+1)) & 0xFFFFFFFF)
derivedCryptKey := int32((uint32(len(data)) * (uint32(cryptKeyTruncByte) + 1)) & 0xFFFFFFFF)
sharedBufIdx := byte(1)
accumulator0 := uint32(0)
accumulator1 := uint32(0)