mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 21:06:58 -05:00
partition_data_manager: Move IV data to where it's needed in DecryptPackage2()
Given it's only used in one spot and has a fairly generic name, we can just specify it directly in the function call. This also the benefit of automatically moving it.
This commit is contained in:
parent
bc2196bb09
commit
3d9df49619
1 changed files with 1 additions and 3 deletions
|
@ -469,15 +469,13 @@ void PartitionDataManager::DecryptPackage2(std::array<std::array<u8, 16>, 0x20>
|
||||||
if (header.magic != Common::MakeMagic('P', 'K', '2', '1'))
|
if (header.magic != Common::MakeMagic('P', 'K', '2', '1'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const std::vector<u8> s1_iv(header.section_ctr[1].begin(), header.section_ctr[1].end());
|
|
||||||
|
|
||||||
const auto a = std::make_shared<FileSys::OffsetVfsFile>(
|
const auto a = std::make_shared<FileSys::OffsetVfsFile>(
|
||||||
file, header.section_size[1], header.section_size[0] + sizeof(Package2Header));
|
file, header.section_size[1], header.section_size[0] + sizeof(Package2Header));
|
||||||
|
|
||||||
auto c = a->ReadAllBytes();
|
auto c = a->ReadAllBytes();
|
||||||
|
|
||||||
AESCipher<Key128> cipher(package2_keys[revision], Mode::CTR);
|
AESCipher<Key128> cipher(package2_keys[revision], Mode::CTR);
|
||||||
cipher.SetIV(s1_iv);
|
cipher.SetIV({header.section_ctr[1].begin(), header.section_ctr[1].end()});
|
||||||
cipher.Transcode(c.data(), c.size(), c.data(), Op::Decrypt);
|
cipher.Transcode(c.data(), c.size(), c.data(), Op::Decrypt);
|
||||||
|
|
||||||
INIHeader ini;
|
INIHeader ini;
|
||||||
|
|
Loading…
Reference in a new issue