aboutsummaryrefslogtreecommitdiff
path: root/src/core/crypto/partition_data_manager.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-08-05 22:35:41 -0400
committerGitHub <noreply@github.com>2020-08-05 22:35:41 -0400
commit35c1607f231cab060305e79f434ef15442c162f1 (patch)
tree0a2af713d7f5ca2b0c0bbe45176c112ae9ba2b03 /src/core/crypto/partition_data_manager.cpp
parentd888ac7d20e2300f9fdb595716bcfe158ea012ca (diff)
parent15660bd8570735139d91d0165a2614747f570202 (diff)
Merge pull request #4484 from lioncash/aesutil
aes_util: Allow SetIV() to be non-allocating
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);