tls-peer: Don't initiate TLS connection if no cipher suites are supported

If zero cipher suites are left after all filters, tls-peer does not
try to establish a connection to the server anymore.
This commit is contained in:
Pascal Knecht 2020-09-03 21:53:52 +02:00 committed by Tobias Brunner
parent 06aad98ff0
commit f920125304

View File

@ -1237,6 +1237,12 @@ static status_t send_client_hello(private_tls_peer_t *this,
/* add TLS cipher suites */
count = this->crypto->get_cipher_suites(this->crypto, &suites);
if (count <= 0)
{
DBG1(DBG_TLS, "no supported TLS cipher suite available");
this->alert->add(this->alert, TLS_FATAL, TLS_INTERNAL_ERROR);
return NEED_MORE;
}
writer->write_uint16(writer, count * 2);
for (i = 0; i < count; i++)
{