diff --git a/Libraries/LibTLS/ClientHandshake.cpp b/Libraries/LibTLS/ClientHandshake.cpp index e111c7c8254..5068977510e 100644 --- a/Libraries/LibTLS/ClientHandshake.cpp +++ b/Libraries/LibTLS/ClientHandshake.cpp @@ -279,8 +279,11 @@ void TLSv12::build_random(PacketBuilder& builder) ssize_t TLSv12::handle_payload(const ByteBuffer& vbuffer) { if (m_context.connection_status == ConnectionStatus::Established) { - auto packet = build_alert(false, (u8)AlertDescription::NoRenegotiation); - write_packet(packet); + dbg() << "Renegotiation attempt ignored"; + // FIXME: We should properly say "NoRenegotiation", but that causes a handshake failure + // so we just roll with it and pretend that we _did_ renegotiate + // This will cause issues when we decide to have long-lasting connections, but + // we do not have those at the moment :^) return 1; } auto buffer = vbuffer; @@ -530,6 +533,9 @@ ssize_t TLSv12::handle_payload(const ByteBuffer& vbuffer) write_packet(packet); break; } + case Error::NeedMoreData: + // Ignore this, as it's not an "error" + break; default: dbg() << "Unknown TLS::Error with value " << payload_res; ASSERT_NOT_REACHED(); diff --git a/Libraries/LibTLS/Handshake.cpp b/Libraries/LibTLS/Handshake.cpp index 1294e5f19f8..1f059d52262 100644 --- a/Libraries/LibTLS/Handshake.cpp +++ b/Libraries/LibTLS/Handshake.cpp @@ -129,10 +129,17 @@ ByteBuffer TLSv12::build_hello() ByteBuffer TLSv12::build_alert(bool critical, u8 code) { - dbg() << "FIXME: build_alert"; - (void)critical; - (void)code; - return {}; + PacketBuilder builder(MessageType::Alert, (u16)m_context.version); + builder.append((u8)(critical ? AlertLevel::Critical : AlertLevel::Warning)); + builder.append(code); + + if (critical) + m_context.critical_error = code; + + auto packet = builder.build(); + update_packet(packet); + + return packet; } ByteBuffer TLSv12::build_finished()