From 7d70f6d7c841a51112444f06c264611ee2c5ade8 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Wed, 8 Feb 2023 17:46:24 +0100 Subject: [PATCH] LibCrypto: Do a simple copy for buffered GHash bytes Using a Stream to copy over a single span is kind of overkill. --- Userland/Libraries/LibCrypto/Authentication/GHash.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp index 253c138f6d..abbab417ed 100644 --- a/Userland/Libraries/LibCrypto/Authentication/GHash.cpp +++ b/Userland/Libraries/LibCrypto/Authentication/GHash.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -45,11 +44,9 @@ GHash::TagType GHash::process(ReadonlyBytes aad, ReadonlyBytes cipher) } if (i > buf.size()) { - static u8 buffer[16]; + u8 buffer[16] = {}; Bytes buffer_bytes { buffer, 16 }; - DeprecatedOutputMemoryStream stream { buffer_bytes }; - stream.write(buf.slice(i - 16)); - stream.fill_to_end(0); + buf.slice(i - 16).copy_to(buffer_bytes); for (auto j = 0; j < 4; ++j) { tag[j] ^= to_u32(buffer_bytes.offset(j * 4));