1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:47:34 +00:00

LibTLS+LibCrypto: Remove all remaining uses of ByteBuffer::wrap()

This commit is contained in:
Andreas Kling 2020-12-19 18:14:38 +01:00
parent 050eb5afa8
commit d5600e966a
6 changed files with 29 additions and 24 deletions

View file

@ -290,7 +290,7 @@ void TLSv12::build_random(PacketBuilder& builder)
Crypto::PK::RSA_PKCS1_EME rsa(certificate.public_key.modulus(), 0, certificate.public_key.public_exponent());
u8 out[rsa.output_size()];
auto outbuf = ByteBuffer::wrap(out, rsa.output_size());
auto outbuf = Bytes { out, rsa.output_size() };
rsa.encrypt(m_context.premaster_key, outbuf);
#ifdef TLS_DEBUG
@ -305,7 +305,7 @@ void TLSv12::build_random(PacketBuilder& builder)
builder.append_u24(outbuf.size() + 2);
builder.append((u16)outbuf.size());
builder.append(outbuf.bytes());
builder.append(outbuf);
}
ssize_t TLSv12::handle_payload(ReadonlyBytes vbuffer)

View file

@ -153,14 +153,14 @@ ByteBuffer TLSv12::build_finished()
builder.append_u24(out_size);
u8 out[out_size];
auto outbuffer = ByteBuffer::wrap(out, out_size);
auto outbuffer = Bytes { out, out_size };
auto dummy = ByteBuffer::create_zeroed(0);
auto digest = m_context.handshake_hash.digest();
auto hashbuf = ReadonlyBytes { digest.immutable_data(), m_context.handshake_hash.digest_size() };
pseudorandom_function(outbuffer, m_context.master_key, (const u8*)"client finished", 15, hashbuf, dummy);
builder.append(outbuffer.bytes());
builder.append(outbuffer);
auto packet = builder.build();
update_packet(packet);