diff options
author | Lioncash <mathew1800@gmail.com> | 2021-04-23 15:58:38 +0200 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2021-04-23 15:58:41 +0200 |
commit | 9c5248d101033cbb47739248ddff6e638aa97235 (patch) | |
tree | 01099cd7611cfb9ede286bae03e33a8cfe5913bd /src/core | |
parent | Merge pull request #6223 from lat9nq/ffmpeg-external-fixes (diff) | |
download | yuzu-9c5248d101033cbb47739248ddff6e638aa97235.tar yuzu-9c5248d101033cbb47739248ddff6e638aa97235.tar.gz yuzu-9c5248d101033cbb47739248ddff6e638aa97235.tar.bz2 yuzu-9c5248d101033cbb47739248ddff6e638aa97235.tar.lz yuzu-9c5248d101033cbb47739248ddff6e638aa97235.tar.xz yuzu-9c5248d101033cbb47739248ddff6e638aa97235.tar.zst yuzu-9c5248d101033cbb47739248ddff6e638aa97235.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/crypto/aes_util.cpp | 6 | ||||
-rw-r--r-- | src/core/crypto/aes_util.h | 8 |
2 files changed, 5 insertions, 9 deletions
diff --git a/src/core/crypto/aes_util.cpp b/src/core/crypto/aes_util.cpp index cb7506241..85a666de9 100644 --- a/src/core/crypto/aes_util.cpp +++ b/src/core/crypto/aes_util.cpp @@ -119,9 +119,9 @@ void AESCipher<Key, KeySize>::XTSTranscode(const u8* src, std::size_t size, u8* } template <typename Key, std::size_t KeySize> -void AESCipher<Key, KeySize>::SetIVImpl(const u8* data, std::size_t size) { - ASSERT_MSG((mbedtls_cipher_set_iv(&ctx->encryption_context, data, size) || - mbedtls_cipher_set_iv(&ctx->decryption_context, data, size)) == 0, +void AESCipher<Key, KeySize>::SetIV(std::span<const u8> data) { + ASSERT_MSG((mbedtls_cipher_set_iv(&ctx->encryption_context, data.data(), data.size()) || + mbedtls_cipher_set_iv(&ctx->decryption_context, data.data(), data.size())) == 0, "Failed to set IV on mbedtls ciphers."); } diff --git a/src/core/crypto/aes_util.h b/src/core/crypto/aes_util.h index e2a304186..230451b8f 100644 --- a/src/core/crypto/aes_util.h +++ b/src/core/crypto/aes_util.h @@ -5,6 +5,7 @@ #pragma once #include <memory> +#include <span> #include <type_traits> #include "common/common_types.h" #include "core/file_sys/vfs.h" @@ -33,10 +34,7 @@ public: AESCipher(Key key, Mode mode); ~AESCipher(); - template <typename ContiguousContainer> - void SetIV(const ContiguousContainer& container) { - SetIVImpl(std::data(container), std::size(container)); - } + void SetIV(std::span<const u8> data); template <typename Source, typename Dest> void Transcode(const Source* src, std::size_t size, Dest* dest, Op op) const { @@ -60,8 +58,6 @@ 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 |