diff options
| author | bunnei <bunneidev@gmail.com> | 2020-08-05 22:35:41 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-05 22:35:41 -0400 |
| commit | 35c1607f231cab060305e79f434ef15442c162f1 (patch) | |
| tree | 0a2af713d7f5ca2b0c0bbe45176c112ae9ba2b03 /src/core/crypto/aes_util.h | |
| parent | d888ac7d20e2300f9fdb595716bcfe158ea012ca (diff) | |
| parent | 15660bd8570735139d91d0165a2614747f570202 (diff) | |
Merge pull request #4484 from lioncash/aesutil
aes_util: Allow SetIV() to be non-allocating
Diffstat (limited to 'src/core/crypto/aes_util.h')
| -rw-r--r-- | src/core/crypto/aes_util.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/crypto/aes_util.h b/src/core/crypto/aes_util.h index edc4ab910..e2a304186 100644 --- a/src/core/crypto/aes_util.h +++ b/src/core/crypto/aes_util.h @@ -6,7 +6,6 @@ #include <memory> #include <type_traits> -#include <vector> #include "common/common_types.h" #include "core/file_sys/vfs.h" @@ -32,10 +31,12 @@ class AESCipher { public: AESCipher(Key key, Mode mode); - ~AESCipher(); - void SetIV(std::vector<u8> iv); + template <typename ContiguousContainer> + void SetIV(const ContiguousContainer& container) { + SetIVImpl(std::data(container), std::size(container)); + } template <typename Source, typename Dest> void Transcode(const Source* src, std::size_t size, Dest* dest, Op op) const { @@ -59,6 +60,8 @@ public: std::size_t sector_size, Op op); private: + void SetIVImpl(const u8* data, std::size_t size); + std::unique_ptr<CipherContext> ctx; }; } // namespace Core::Crypto |
