summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-08-17 09:50:35 +0200
committerGitHub <noreply@github.com>2020-08-17 09:50:35 +0200
commit0530dd6ea17e643dded01a204cd0311a709c2b5f (patch)
tree56649dd8af484c5a078af64b94de68b5f14cecbe
parentMerge pull request #4531 from lioncash/overload (diff)
parentpartition_data_manager: Eliminate magic value (diff)
downloadyuzu-0530dd6ea17e643dded01a204cd0311a709c2b5f.tar
yuzu-0530dd6ea17e643dded01a204cd0311a709c2b5f.tar.gz
yuzu-0530dd6ea17e643dded01a204cd0311a709c2b5f.tar.bz2
yuzu-0530dd6ea17e643dded01a204cd0311a709c2b5f.tar.lz
yuzu-0530dd6ea17e643dded01a204cd0311a709c2b5f.tar.xz
yuzu-0530dd6ea17e643dded01a204cd0311a709c2b5f.tar.zst
yuzu-0530dd6ea17e643dded01a204cd0311a709c2b5f.zip
-rw-r--r--src/core/crypto/aes_util.cpp2
-rw-r--r--src/core/crypto/partition_data_manager.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/core/crypto/aes_util.cpp b/src/core/crypto/aes_util.cpp
index 330996b24..6a9734812 100644
--- a/src/core/crypto/aes_util.cpp
+++ b/src/core/crypto/aes_util.cpp
@@ -116,7 +116,7 @@ void AESCipher<Key, KeySize>::XTSTranscode(const u8* src, std::size_t size, u8*
for (std::size_t i = 0; i < size; i += sector_size) {
SetIV(CalculateNintendoTweak(sector_id++));
- Transcode<u8, u8>(src + i, sector_size, dest + i, op);
+ Transcode(src + i, sector_size, dest + i, op);
}
}
diff --git a/src/core/crypto/partition_data_manager.cpp b/src/core/crypto/partition_data_manager.cpp
index 3e96f7516..46136d04a 100644
--- a/src/core/crypto/partition_data_manager.cpp
+++ b/src/core/crypto/partition_data_manager.cpp
@@ -367,8 +367,8 @@ static bool AttemptDecrypt(const std::array<u8, 16>& key, Package2Header& header
Package2Header temp = header;
AESCipher<Key128> cipher(key, Mode::CTR);
cipher.SetIV(header.header_ctr);
- cipher.Transcode(&temp.header_ctr, sizeof(Package2Header) - 0x100, &temp.header_ctr,
- Op::Decrypt);
+ cipher.Transcode(&temp.header_ctr, sizeof(Package2Header) - sizeof(Package2Header::signature),
+ &temp.header_ctr, Op::Decrypt);
if (temp.magic == Common::MakeMagic('P', 'K', '2', '1')) {
header = temp;
return true;