LibTLS: Add signature verification for DHE and ECDHE key exchange

This will verify that the signature of the ephemeral key used in the
DHE and ECDHE key exchanges is actually generated by the server.

This verification is done using the first certificate provided by the
server, however the validity of this certificate is not checked here.
Instead this code expects the validity to be checked earlier by
`TLSv12::handle_certificate`.
This commit is contained in:
Michiel Visser 2022-02-18 10:58:56 +01:00 committed by Ali Mohammad Pur
commit 898be38517
Notes: sideshowbarker 2024-07-17 18:22:16 +09:00
5 changed files with 108 additions and 9 deletions

View file

@ -489,6 +489,11 @@ ssize_t TLSv12::handle_handshake_payload(ReadonlyBytes vbuffer)
write_packet(packet);
break;
}
case Error::NotSafe: {
auto packet = build_alert(true, (u8)AlertDescription::DecryptError);
write_packet(packet);
break;
}
case Error::NeedMoreData:
// Ignore this, as it's not an "error"
dbgln_if(TLS_DEBUG, "More data needed");