summaryrefslogtreecommitdiffstats
path: root/src/core/file_sys
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-08-06 04:35:41 +0200
committerGitHub <noreply@github.com>2020-08-06 04:35:41 +0200
commit35c1607f231cab060305e79f434ef15442c162f1 (patch)
tree0a2af713d7f5ca2b0c0bbe45176c112ae9ba2b03 /src/core/file_sys
parentMerge pull request #4477 from lioncash/log-desig (diff)
parentaes_util: Allow SetIV to be non-allocating (diff)
downloadyuzu-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/file_sys')
-rw-r--r--src/core/file_sys/content_archive.cpp7
-rw-r--r--src/core/file_sys/nca_patch.cpp3
2 files changed, 6 insertions, 4 deletions
diff --git a/src/core/file_sys/content_archive.cpp b/src/core/file_sys/content_archive.cpp
index 473245d5a..5039341c7 100644
--- a/src/core/file_sys/content_archive.cpp
+++ b/src/core/file_sys/content_archive.cpp
@@ -495,9 +495,10 @@ VirtualFile NCA::Decrypt(const NCASectionHeader& s_header, VirtualFile in, u64 s
auto out = std::make_shared<Core::Crypto::CTREncryptionLayer>(std::move(in), *key,
starting_offset);
- std::vector<u8> iv(16);
- for (u8 i = 0; i < 8; ++i)
- iv[i] = s_header.raw.section_ctr[0x8 - i - 1];
+ Core::Crypto::CTREncryptionLayer::IVData iv{};
+ for (std::size_t i = 0; i < 8; ++i) {
+ iv[i] = s_header.raw.section_ctr[8 - i - 1];
+ }
out->SetIV(iv);
return std::static_pointer_cast<VfsFile>(out);
}
diff --git a/src/core/file_sys/nca_patch.cpp b/src/core/file_sys/nca_patch.cpp
index 0090cc6c4..fe7375e84 100644
--- a/src/core/file_sys/nca_patch.cpp
+++ b/src/core/file_sys/nca_patch.cpp
@@ -3,6 +3,7 @@
// Refer to the license.txt file included.
#include <algorithm>
+#include <array>
#include <cstddef>
#include <cstring>
@@ -66,7 +67,7 @@ std::size_t BKTR::Read(u8* data, std::size_t length, std::size_t offset) const {
Core::Crypto::AESCipher<Core::Crypto::Key128> cipher(key, Core::Crypto::Mode::CTR);
// Calculate AES IV
- std::vector<u8> iv(16);
+ std::array<u8, 16> iv{};
auto subsection_ctr = subsection.ctr;
auto offset_iv = section_offset + base_offset;
for (std::size_t i = 0; i < section_ctr.size(); ++i)