diff --git a/Libraries/LibTLS/Handshake.cpp b/Libraries/LibTLS/Handshake.cpp index 0c2d42b1bee..c74825b8c78 100644 --- a/Libraries/LibTLS/Handshake.cpp +++ b/Libraries/LibTLS/Handshake.cpp @@ -11,13 +11,14 @@ #include #include +#include #include namespace TLS { ByteBuffer TLSv12::build_hello() { - fill_with_random(m_context.local_random); + ::Crypto::fill_with_secure_random(m_context.local_random); auto packet_version = (u16)m_context.options.version; auto version = (u16)m_context.options.version; diff --git a/Libraries/LibTLS/HandshakeClient.cpp b/Libraries/LibTLS/HandshakeClient.cpp index a823f9407f7..bd2b8502dde 100644 --- a/Libraries/LibTLS/HandshakeClient.cpp +++ b/Libraries/LibTLS/HandshakeClient.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include namespace TLS { @@ -160,7 +161,7 @@ void TLSv12::build_rsa_pre_master_secret(PacketBuilder& builder) u8 random_bytes[48]; size_t bytes = 48; - fill_with_random(random_bytes); + Crypto::fill_with_secure_random(random_bytes); // remove zeros from the random bytes for (size_t i = 0; i < bytes; ++i) { diff --git a/Libraries/LibTLS/Record.cpp b/Libraries/LibTLS/Record.cpp index 907421b10dc..eb3ef549686 100644 --- a/Libraries/LibTLS/Record.cpp +++ b/Libraries/LibTLS/Record.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include namespace TLS { @@ -157,7 +158,7 @@ void TLSv12::update_packet(ByteBuffer& packet) u8 iv[12]; Bytes iv_bytes { iv, 12 }; Bytes { m_context.crypto.local_aead_iv, 4 }.copy_to(iv_bytes); - fill_with_random(iv_bytes.slice(4, 8)); + Crypto::fill_with_secure_random(iv_bytes.slice(4, 8)); // write the random part of the iv out iv_bytes.slice(4, 8).copy_to(ct.bytes().slice(header_size)); @@ -204,7 +205,7 @@ void TLSv12::update_packet(ByteBuffer& packet) VERIFY_NOT_REACHED(); } auto iv = iv_buffer_result.release_value(); - fill_with_random(iv); + Crypto::fill_with_secure_random(iv); // write it into the ciphertext portion of the message ct.overwrite(header_size, iv.data(), iv.size());