Add Read16/Read8 to the CBlobBigEndianReader so the key check is reading 8bit from the correct location to determin which key to use. Also change check to == 1 as suggested in the IRC channel on first implementation. Potentially fixes 6852.

This commit is contained in:
Ryan Houdek 2013-12-06 20:40:12 -06:00
parent 14d9802ea4
commit 4867937355

View File

@ -45,9 +45,20 @@ public:
{
u32 Temp;
m_rReader.Read(_Offset, 4, (u8*)&Temp);
return(Common::swap32(Temp));
return Common::swap32(Temp);
}
u16 Read16(u64 _Offset)
{
u16 Temp;
m_rReader.Read(_Offset, 2, (u8*)&Temp);
return Common::swap16(Temp);
}
u8 Read8(u64 _Offset)
{
u8 Temp;
m_rReader.Read(_Offset, 1, &Temp);
return Temp;
}
private:
IBlobReader& m_rReader;
};
@ -188,10 +199,8 @@ static IVolume* CreateVolumeFromCryptedWiiImage(IBlobReader& _rReader, u32 _Part
// Magic value is at 0x501f1 (1byte)
// If encrypted with the Korean key, the magic value would be 1
// Otherwise it is zero
if (Korean && Reader.Read32(0x501ee) != 0)
{
if (Korean && Reader.Read8(0x501f1) == 1)
usingKoreanKey = true;
}
aes_context AES_ctx;
aes_setkey_dec(&AES_ctx, (usingKoreanKey ? g_MasterKeyK : g_MasterKey), 128);