1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:37:36 +00:00

LibCrypto+LibTLS+Kernel: Switch the Cipher::Mode interface to use Span

This shaves 2.5 more runtime seconds off 'disasm /bin/id', and makes the
Mode<T> interface a lot more allocation-friendly.
This commit is contained in:
AnotherTest 2020-08-11 23:30:49 +04:30 committed by Andreas Kling
parent caedd05bd8
commit bc7a149039
11 changed files with 182 additions and 153 deletions

View file

@ -46,7 +46,7 @@ public:
AESCipherBlock(const u8* data, size_t length, PaddingMode mode = PaddingMode::CMS)
: AESCipherBlock(mode)
{
overwrite(data, length);
CipherBlock::overwrite(data, length);
}
static size_t block_size() { return BlockSizeInBits / 8; };
@ -54,8 +54,9 @@ public:
virtual ByteBuffer get() const override { return m_data; };
virtual const ByteBuffer& data() const override { return m_data; };
virtual void overwrite(const ByteBuffer&) override;
virtual void overwrite(const u8* data, size_t length) override;
virtual void overwrite(const ReadonlyBytes&) override;
virtual void overwrite(const ByteBuffer& buffer) override { overwrite(buffer.span()); }
virtual void overwrite(const u8* data, size_t size) override { overwrite({ data, size }); }
virtual void apply_initialization_vector(const u8* ivec) override
{