summaryrefslogtreecommitdiffstats
path: root/src/core/crypto/partition_data_manager.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2020-08-03 20:14:39 +0200
committerLioncash <mathew1800@gmail.com>2020-08-03 20:29:58 +0200
commit15660bd8570735139d91d0165a2614747f570202 (patch)
tree6886854694175d87bf33924c1799b1b46e4fd05d /src/core/crypto/partition_data_manager.cpp
parentipc: Allow all trivially copyable objects to be passed directly into WriteBuffer (#4465) (diff)
downloadyuzu-15660bd8570735139d91d0165a2614747f570202.tar
yuzu-15660bd8570735139d91d0165a2614747f570202.tar.gz
yuzu-15660bd8570735139d91d0165a2614747f570202.tar.bz2
yuzu-15660bd8570735139d91d0165a2614747f570202.tar.lz
yuzu-15660bd8570735139d91d0165a2614747f570202.tar.xz
yuzu-15660bd8570735139d91d0165a2614747f570202.tar.zst
yuzu-15660bd8570735139d91d0165a2614747f570202.zip
Diffstat (limited to 'src/core/crypto/partition_data_manager.cpp')
-rw-r--r--src/core/crypto/partition_data_manager.cpp5
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);