diff options
author | Lioncash <mathew1800@gmail.com> | 2018-08-04 22:52:19 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2018-08-04 23:30:48 +0200 |
commit | 64c8212ae1168e86693d05875f4284330e52f26d (patch) | |
tree | b7e949b631c624aa023c7075e19d47746a1d43a2 /src/core | |
parent | aes_util: Make Transcode() a const member function (diff) | |
download | yuzu-64c8212ae1168e86693d05875f4284330e52f26d.tar yuzu-64c8212ae1168e86693d05875f4284330e52f26d.tar.gz yuzu-64c8212ae1168e86693d05875f4284330e52f26d.tar.bz2 yuzu-64c8212ae1168e86693d05875f4284330e52f26d.tar.lz yuzu-64c8212ae1168e86693d05875f4284330e52f26d.tar.xz yuzu-64c8212ae1168e86693d05875f4284330e52f26d.tar.zst yuzu-64c8212ae1168e86693d05875f4284330e52f26d.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/crypto/aes_util.cpp | 20 | ||||
-rw-r--r-- | src/core/crypto/aes_util.h | 2 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/core/crypto/aes_util.cpp b/src/core/crypto/aes_util.cpp index e2dc4acb3..a9876c83e 100644 --- a/src/core/crypto/aes_util.cpp +++ b/src/core/crypto/aes_util.cpp @@ -9,6 +9,16 @@ #include "core/crypto/key_manager.h" namespace Core::Crypto { +namespace { +std::vector<u8> CalculateNintendoTweak(size_t sector_id) { + std::vector<u8> out(0x10); + for (size_t i = 0xF; i <= 0xF; --i) { + out[i] = sector_id & 0xFF; + sector_id >>= 8; + } + return out; +} +} // Anonymous namespace static_assert(static_cast<size_t>(Mode::CTR) == static_cast<size_t>(MBEDTLS_CIPHER_AES_128_CTR), "CTR has incorrect value."); @@ -100,16 +110,6 @@ void AESCipher<Key, KeySize>::XTSTranscode(const u8* src, size_t size, u8* dest, } } -template <typename Key, size_t KeySize> -std::vector<u8> AESCipher<Key, KeySize>::CalculateNintendoTweak(size_t sector_id) { - std::vector<u8> out(0x10); - for (size_t i = 0xF; i <= 0xF; --i) { - out[i] = sector_id & 0xFF; - sector_id >>= 8; - } - return out; -} - template class AESCipher<Key128>; template class AESCipher<Key256>; } // namespace Core::Crypto
\ No newline at end of file diff --git a/src/core/crypto/aes_util.h b/src/core/crypto/aes_util.h index bda41b144..ce4947a04 100644 --- a/src/core/crypto/aes_util.h +++ b/src/core/crypto/aes_util.h @@ -56,7 +56,5 @@ public: private: std::unique_ptr<CipherContext> ctx; - - static std::vector<u8> CalculateNintendoTweak(size_t sector_id); }; } // namespace Core::Crypto |