summaryrefslogtreecommitdiff
path: root/src/core/crypto/aes_util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/crypto/aes_util.h')
-rw-r--r--src/core/crypto/aes_util.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/core/crypto/aes_util.h b/src/core/crypto/aes_util.h
index 8ce9d6612..edc4ab910 100644
--- a/src/core/crypto/aes_util.h
+++ b/src/core/crypto/aes_util.h
@@ -25,7 +25,7 @@ enum class Op {
25 Decrypt, 25 Decrypt,
26}; 26};
27 27
28template <typename Key, size_t KeySize = sizeof(Key)> 28template <typename Key, std::size_t KeySize = sizeof(Key)>
29class AESCipher { 29class AESCipher {
30 static_assert(std::is_same_v<Key, std::array<u8, KeySize>>, "Key must be std::array of u8."); 30 static_assert(std::is_same_v<Key, std::array<u8, KeySize>>, "Key must be std::array of u8.");
31 static_assert(KeySize == 0x10 || KeySize == 0x20, "KeySize must be 128 or 256."); 31 static_assert(KeySize == 0x10 || KeySize == 0x20, "KeySize must be 128 or 256.");
@@ -38,25 +38,25 @@ public:
38 void SetIV(std::vector<u8> iv); 38 void SetIV(std::vector<u8> iv);
39 39
40 template <typename Source, typename Dest> 40 template <typename Source, typename Dest>
41 void Transcode(const Source* src, size_t size, Dest* dest, Op op) const { 41 void Transcode(const Source* src, std::size_t size, Dest* dest, Op op) const {
42 static_assert(std::is_trivially_copyable_v<Source> && std::is_trivially_copyable_v<Dest>, 42 static_assert(std::is_trivially_copyable_v<Source> && std::is_trivially_copyable_v<Dest>,
43 "Transcode source and destination types must be trivially copyable."); 43 "Transcode source and destination types must be trivially copyable.");
44 Transcode(reinterpret_cast<const u8*>(src), size, reinterpret_cast<u8*>(dest), op); 44 Transcode(reinterpret_cast<const u8*>(src), size, reinterpret_cast<u8*>(dest), op);
45 } 45 }
46 46
47 void Transcode(const u8* src, size_t size, u8* dest, Op op) const; 47 void Transcode(const u8* src, std::size_t size, u8* dest, Op op) const;
48 48
49 template <typename Source, typename Dest> 49 template <typename Source, typename Dest>
50 void XTSTranscode(const Source* src, size_t size, Dest* dest, size_t sector_id, 50 void XTSTranscode(const Source* src, std::size_t size, Dest* dest, std::size_t sector_id,
51 size_t sector_size, Op op) { 51 std::size_t sector_size, Op op) {
52 static_assert(std::is_trivially_copyable_v<Source> && std::is_trivially_copyable_v<Dest>, 52 static_assert(std::is_trivially_copyable_v<Source> && std::is_trivially_copyable_v<Dest>,
53 "XTSTranscode source and destination types must be trivially copyable."); 53 "XTSTranscode source and destination types must be trivially copyable.");
54 XTSTranscode(reinterpret_cast<const u8*>(src), size, reinterpret_cast<u8*>(dest), sector_id, 54 XTSTranscode(reinterpret_cast<const u8*>(src), size, reinterpret_cast<u8*>(dest), sector_id,
55 sector_size, op); 55 sector_size, op);
56 } 56 }
57 57
58 void XTSTranscode(const u8* src, size_t size, u8* dest, size_t sector_id, size_t sector_size, 58 void XTSTranscode(const u8* src, std::size_t size, u8* dest, std::size_t sector_id,
59 Op op); 59 std::size_t sector_size, Op op);
60 60
61private: 61private:
62 std::unique_ptr<CipherContext> ctx; 62 std::unique_ptr<CipherContext> ctx;