mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-24 18:28:57 +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:
parent
caedd05bd8
commit
bc7a149039
Notes:
sideshowbarker
2024-07-19 03:52:51 +09:00
Author: https://github.com/alimpfard
Commit: bc7a149039
Pull-request: https://github.com/SerenityOS/serenity/pull/3094
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/nico
11 changed files with 182 additions and 153 deletions
|
@ -68,12 +68,13 @@ public:
|
|||
|
||||
typename CipherType::CTRMode cipher(m_key, KeySize);
|
||||
|
||||
auto wrapped_buffer = ByteBuffer::wrap(buffer, n);
|
||||
m_counter = cipher.key_stream(wrapped_buffer, m_counter).value();
|
||||
Bytes buffer_span { buffer, n };
|
||||
auto counter_span = m_counter.span();
|
||||
cipher.key_stream(buffer_span, counter_span, &counter_span);
|
||||
|
||||
// Extract a new key from the prng stream.
|
||||
|
||||
m_counter = cipher.key_stream(m_key, m_counter).value();
|
||||
cipher.key_stream(buffer_span, counter_span, &counter_span);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue