mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-09 09:34:57 +09:00
LibTLS+LibCrypto: More ByteBuffer -> Span conversion
This commit is contained in:
parent
8e20208dd6
commit
f82b0a78ef
Notes:
sideshowbarker
2024-07-19 00:44:34 +09:00
Author: https://github.com/awesomekling
Commit: f82b0a78ef
13 changed files with 45 additions and 40 deletions
|
@ -33,7 +33,7 @@ namespace TLS {
|
|||
bool TLSv12::expand_key()
|
||||
{
|
||||
u8 key[192]; // soooooooo many constants
|
||||
auto key_buffer = ByteBuffer::wrap(key, 192);
|
||||
auto key_buffer = Bytes { key, sizeof(key) };
|
||||
|
||||
auto is_aead = this->is_aead();
|
||||
|
||||
|
@ -108,7 +108,7 @@ bool TLSv12::expand_key()
|
|||
return true;
|
||||
}
|
||||
|
||||
void TLSv12::pseudorandom_function(ByteBuffer& output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b)
|
||||
void TLSv12::pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b)
|
||||
{
|
||||
if (!secret.size()) {
|
||||
dbg() << "null secret";
|
||||
|
@ -124,7 +124,7 @@ void TLSv12::pseudorandom_function(ByteBuffer& output, ReadonlyBytes secret, con
|
|||
|
||||
auto l_seed_size = label_length + seed.size() + seed_b.size();
|
||||
u8 l_seed[l_seed_size];
|
||||
auto label_seed_buffer = ByteBuffer::wrap(l_seed, l_seed_size);
|
||||
auto label_seed_buffer = Bytes { l_seed, l_seed_size };
|
||||
label_seed_buffer.overwrite(0, label, label_length);
|
||||
label_seed_buffer.overwrite(label_length, seed.data(), seed.size());
|
||||
label_seed_buffer.overwrite(label_length + seed.size(), seed_b.data(), seed_b.size());
|
||||
|
@ -133,7 +133,7 @@ void TLSv12::pseudorandom_function(ByteBuffer& output, ReadonlyBytes secret, con
|
|||
|
||||
u8 digest[digest_size];
|
||||
|
||||
auto digest_0 = ByteBuffer::wrap(digest, digest_size);
|
||||
auto digest_0 = Bytes { digest, digest_size };
|
||||
|
||||
digest_0.overwrite(0, hmac.process(label_seed_buffer).immutable_data(), digest_size);
|
||||
|
||||
|
|
|
@ -644,7 +644,7 @@ void TLSv12::ensure_hmac(size_t digest_size, bool local)
|
|||
break;
|
||||
}
|
||||
|
||||
auto hmac = make<Crypto::Authentication::HMAC<Crypto::Hash::Manager>>(ByteBuffer::wrap(local ? m_context.crypto.local_mac : m_context.crypto.remote_mac, digest_size), hash_kind);
|
||||
auto hmac = make<Crypto::Authentication::HMAC<Crypto::Hash::Manager>>(ReadonlyBytes { local ? m_context.crypto.local_mac : m_context.crypto.remote_mac, digest_size }, hash_kind);
|
||||
if (local)
|
||||
m_hmac_local = move(hmac);
|
||||
else
|
||||
|
|
|
@ -375,7 +375,7 @@ private:
|
|||
|
||||
size_t asn1_length(ReadonlyBytes, size_t* octets);
|
||||
|
||||
void pseudorandom_function(ByteBuffer& output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b);
|
||||
void pseudorandom_function(Bytes output, ReadonlyBytes secret, const u8* label, size_t label_length, ReadonlyBytes seed, ReadonlyBytes seed_b);
|
||||
|
||||
size_t key_length() const
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue