diff options
author | bunnei <bunneidev@gmail.com> | 2020-08-06 04:35:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-06 04:35:41 +0200 |
commit | 35c1607f231cab060305e79f434ef15442c162f1 (patch) | |
tree | 0a2af713d7f5ca2b0c0bbe45176c112ae9ba2b03 /src/core/crypto/partition_data_manager.cpp | |
parent | Merge pull request #4477 from lioncash/log-desig (diff) | |
parent | aes_util: Allow SetIV to be non-allocating (diff) | |
download | yuzu-35c1607f231cab060305e79f434ef15442c162f1.tar yuzu-35c1607f231cab060305e79f434ef15442c162f1.tar.gz yuzu-35c1607f231cab060305e79f434ef15442c162f1.tar.bz2 yuzu-35c1607f231cab060305e79f434ef15442c162f1.tar.lz yuzu-35c1607f231cab060305e79f434ef15442c162f1.tar.xz yuzu-35c1607f231cab060305e79f434ef15442c162f1.tar.zst yuzu-35c1607f231cab060305e79f434ef15442c162f1.zip |
Diffstat (limited to 'src/core/crypto/partition_data_manager.cpp')
-rw-r--r-- | src/core/crypto/partition_data_manager.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/core/crypto/partition_data_manager.cpp b/src/core/crypto/partition_data_manager.cpp index 7ed71ac3a..b31a81560 100644 --- a/src/core/crypto/partition_data_manager.cpp +++ b/src/core/crypto/partition_data_manager.cpp @@ -346,10 +346,9 @@ FileSys::VirtualFile PartitionDataManager::GetPackage2Raw(Package2Type type) con } static bool AttemptDecrypt(const std::array<u8, 16>& key, Package2Header& header) { - const std::vector<u8> iv(header.header_ctr.begin(), header.header_ctr.end()); Package2Header temp = header; AESCipher<Key128> cipher(key, Mode::CTR); - cipher.SetIV(iv); + cipher.SetIV(header.header_ctr); cipher.Transcode(&temp.header_ctr, sizeof(Package2Header) - 0x100, &temp.header_ctr, Op::Decrypt); if (temp.magic == Common::MakeMagic('P', 'K', '2', '1')) { @@ -388,7 +387,7 @@ void PartitionDataManager::DecryptPackage2(const std::array<Key128, 0x20>& packa auto c = a->ReadAllBytes(); AESCipher<Key128> cipher(package2_keys[revision], Mode::CTR); - cipher.SetIV({header.section_ctr[1].begin(), header.section_ctr[1].end()}); + cipher.SetIV(header.section_ctr[1]); cipher.Transcode(c.data(), c.size(), c.data(), Op::Decrypt); const auto ini_file = std::make_shared<FileSys::VectorVfsFile>(c); |