diff --git a/Libraries/LibWebSocket/WebSocket.cpp b/Libraries/LibWebSocket/WebSocket.cpp index 1b05c4def71..f1f484057d7 100644 --- a/Libraries/LibWebSocket/WebSocket.cpp +++ b/Libraries/LibWebSocket/WebSocket.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -183,7 +184,7 @@ void WebSocket::send_client_handshake() // 7. 16-byte nonce encoded as Base64 u8 nonce_data[16]; - fill_with_random(nonce_data); + Crypto::fill_with_secure_random(nonce_data); // FIXME: change to TRY() and make method fallible m_websocket_key = MUST(encode_base64({ nonce_data, 16 })).to_byte_string(); builder.appendff("Sec-WebSocket-Key: {}\r\n", m_websocket_key); @@ -589,7 +590,7 @@ void WebSocket::send_frame(WebSocket::OpCode op_code, ReadonlyBytes payload, boo // > Clients MUST choose a new masking key for each frame, using an algorithm // > that cannot be predicted by end applications that provide data u8 masking_key[4]; - fill_with_random(masking_key); + Crypto::fill_with_secure_random(masking_key); m_impl->send(ReadonlyBytes(masking_key, 4)); // don't try to send empty payload if (payload.size() == 0)