mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-20 07:27:56 -05:00
aes_util: Allow SetIV to be non-allocating
In a few places, the data to be set as the IV is already within an array. We shouldn't require this data to be heap-allocated if it doesn't need to be. This allows certain callers to reduce heap churn.
This commit is contained in:
@ -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
|
||||
|
Reference in New Issue
Block a user