summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2018-10-13 09:20:19 -0400
committerGravatar Lioncash2018-10-13 09:20:21 -0400
commit3d9df49619a44bacda8c02fea60e63d9a7aa22fc (patch)
tree0b84d20b329a3849f22e81824ec88382c9225280 /src
parentpartition_data_manager: Remove commented out code (diff)
downloadyuzu-3d9df49619a44bacda8c02fea60e63d9a7aa22fc.tar.gz
yuzu-3d9df49619a44bacda8c02fea60e63d9a7aa22fc.tar.xz
yuzu-3d9df49619a44bacda8c02fea60e63d9a7aa22fc.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/core/crypto/partition_data_manager.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/core/crypto/partition_data_manager.cpp b/src/core/crypto/partition_data_manager.cpp
index 056119c04..e364affba 100644
--- a/src/core/crypto/partition_data_manager.cpp
+++ b/src/core/crypto/partition_data_manager.cpp
@@ -469,15 +469,13 @@ void PartitionDataManager::DecryptPackage2(std::array<std::array<u8, 16>, 0x20>
469 if (header.magic != Common::MakeMagic('P', 'K', '2', '1')) 469 if (header.magic != Common::MakeMagic('P', 'K', '2', '1'))
470 return; 470 return;
471 471
472 const std::vector<u8> s1_iv(header.section_ctr[1].begin(), header.section_ctr[1].end());
473
474 const auto a = std::make_shared<FileSys::OffsetVfsFile>( 472 const auto a = std::make_shared<FileSys::OffsetVfsFile>(
475 file, header.section_size[1], header.section_size[0] + sizeof(Package2Header)); 473 file, header.section_size[1], header.section_size[0] + sizeof(Package2Header));
476 474
477 auto c = a->ReadAllBytes(); 475 auto c = a->ReadAllBytes();
478 476
479 AESCipher<Key128> cipher(package2_keys[revision], Mode::CTR); 477 AESCipher<Key128> cipher(package2_keys[revision], Mode::CTR);
480 cipher.SetIV(s1_iv); 478 cipher.SetIV({header.section_ctr[1].begin(), header.section_ctr[1].end()});
481 cipher.Transcode(c.data(), c.size(), c.data(), Op::Decrypt); 479 cipher.Transcode(c.data(), c.size(), c.data(), Op::Decrypt);
482 480
483 INIHeader ini; 481 INIHeader ini;