Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add Read16/Read8 to the CBlobBigEndianReader so the key check is read…
…ing 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.
  • Loading branch information
Sonicadvance1 committed Dec 7, 2013
1 parent 14d9802 commit 4867937
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Source/Core/DiscIO/Src/VolumeCreator.cpp
Expand Up @@ -45,9 +45,20 @@ class CBlobBigEndianReader
{
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;
};
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 4867937

Please sign in to comment.