Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AK: Make some tweaks to AK::Span. #3166

Merged
merged 7 commits into from
Aug 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Libraries/LibCrypto/Cipher/AES.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,10 @@ void AESCipher::decrypt_block(const AESCipherBlock& in, AESCipherBlock& out)
// clang-format on
}

void AESCipherBlock::overwrite(const ReadonlyBytes& span)
void AESCipherBlock::overwrite(ReadonlyBytes bytes)
{
auto data = span.data();
auto length = span.size();
auto data = bytes.data();
auto length = bytes.size();

ASSERT(length <= m_data.size());
m_data.overwrite(0, data, length);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/LibCrypto/Cipher/AES.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ struct AESCipherBlock : public CipherBlock {
virtual ByteBuffer get() const override { return m_data; };
virtual const ByteBuffer& data() const override { return m_data; };

virtual void overwrite(const ReadonlyBytes&) override;
virtual void overwrite(const ByteBuffer& buffer) override { overwrite(buffer.bytes()); }
virtual void overwrite(ReadonlyBytes) override;
virtual void overwrite(const ByteBuffer& buffer) override { overwrite(buffer); }
asynts marked this conversation as resolved.
Show resolved Hide resolved
virtual void overwrite(const u8* data, size_t size) override { overwrite({ data, size }); }

virtual void apply_initialization_vector(const u8* ivec) override
Expand Down
4 changes: 2 additions & 2 deletions Libraries/LibCrypto/Cipher/Cipher.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ struct CipherBlock {
virtual ByteBuffer get() const = 0;
virtual const ByteBuffer& data() const = 0;

virtual void overwrite(const ReadonlyBytes&) = 0;
virtual void overwrite(const ByteBuffer& buffer) { overwrite(buffer.bytes()); }
asynts marked this conversation as resolved.
Show resolved Hide resolved
virtual void overwrite(ReadonlyBytes) = 0;
virtual void overwrite(const ByteBuffer& buffer) { overwrite(buffer); }
virtual void overwrite(const u8* data, size_t size) { overwrite({ data, size }); }

virtual void apply_initialization_vector(const u8* ivec) = 0;
Expand Down
2 changes: 1 addition & 1 deletion Userland/test-crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int crc32_tests();

// stop listing tests

static void print_buffer(const ReadonlyBytes& buffer, int split)
static void print_buffer(ReadonlyBytes buffer, int split)
{
for (size_t i = 0; i < buffer.size(); ++i) {
if (split > 0) {
Expand Down