mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:57:45 +00:00
LibCrypto: Remove all uses of VLAs
This removes all uses of VLAs with either Vectors with inline capacity for the expected soft upper bound, or the occasional heap allocation.
This commit is contained in:
parent
0d50d3ed1e
commit
b05beb79d4
7 changed files with 41 additions and 36 deletions
|
@ -29,7 +29,7 @@ public:
|
|||
CipherBlock::overwrite(data, length);
|
||||
}
|
||||
|
||||
static size_t block_size() { return BlockSizeInBits / 8; };
|
||||
constexpr static size_t block_size() { return BlockSizeInBits / 8; };
|
||||
|
||||
virtual ReadonlyBytes bytes() const override { return ReadonlyBytes { m_data, sizeof(m_data) }; }
|
||||
virtual Bytes bytes() override { return Bytes { m_data, sizeof(m_data) }; }
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
String to_string() const;
|
||||
|
||||
private:
|
||||
size_t data_size() const { return sizeof(m_data); }
|
||||
constexpr static size_t data_size() { return sizeof(m_data); }
|
||||
|
||||
u8 m_data[BlockSizeInBits / 8] {};
|
||||
};
|
||||
|
|
|
@ -39,8 +39,6 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
static size_t block_size() { VERIFY_NOT_REACHED(); }
|
||||
|
||||
virtual ReadonlyBytes bytes() const = 0;
|
||||
|
||||
virtual void overwrite(ReadonlyBytes) = 0;
|
||||
|
@ -106,7 +104,7 @@ public:
|
|||
virtual const KeyType& key() const = 0;
|
||||
virtual KeyType& key() = 0;
|
||||
|
||||
static size_t block_size() { return BlockType::block_size(); }
|
||||
constexpr static size_t block_size() { return BlockType::block_size(); }
|
||||
|
||||
PaddingMode padding_mode() const { return m_padding_mode; }
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue