Open jpavco-quadient opened 11 months ago
The error you are hitting is this error in ssl_tlsext_ocsp_client_parse():
if (ssl_effective_tls_version(s) >= TLS1_3_VERSION) {
if (msg_type == SSL_TLSEXT_MSG_CR) {
/*
* RFC 8446, 4.4.2.1 - the server may request an OCSP
* response with an empty status_request.
*/
if (CBS_len(cbs) == 0)
return 1;
SSLerror(s, SSL_R_LENGTH_MISMATCH);
return 0;
}
...
If you comment out the SSLerror
and the return 0
the handshake completes. The point is that the server sends its OCSP response data as part of the CertificateRequest
.
However, RFC 8446, section 4.4.2.1 says this:
In TLS 1.3, the server's OCSP information is carried in an extension in
the CertificateEntry containing the associated certificate.
The definition of the CertificateRequest
does not mention CertificateEntry
. There is the exception mentioned in the comment that the server may request an OCSP status for the client's cert by sending an empty OCSP extension as part of the CertificateRequest
.
Now we seem to be stricter than OpenSSL who complete the handshake, but gnutls-cli
doesn't seem to be able to connect to this server either:
$ gnutls-cli --ocsp -V api.communicalia.com
Processed 134 CA certificate(s).
Resolving 'api.communicalia.com:443'...
Connecting to '52.50.170.116:443'...
*** Fatal error: Error decoding the received TLS packet.
So I'd argue this is the server misbehaving, not a LibreSSL bug.
Added: Running gnutls-cli
with -d 3
, we see this:
...
|<3>| ASSERT: buffers.c[get_last_packet]:1139
|<3>| ASSERT: buffers.c[get_last_packet]:1139
|<3>| ASSERT: tls13/certificate_request.c[parse_cert_extension]:125
|<3>| ASSERT: extv.c[_gnutls_extv_parse]:71
|<3>| ASSERT: tls13/certificate_request.c[_gnutls13_recv_certificate_request_int]:201
|<3>| ASSERT: handshake-tls13.c[_gnutls13_handshake_client]:123
*** Fatal error: Error decoding the received TLS packet.
Which points at this code in tls13/certificate_request.c
:
} else if (tls_id == ext_mod_status_request.tls_id) {
if (data_size != 0)
return gnutls_assert_val(
GNUTLS_E_TLS_PACKET_DECODING_ERROR);
which is precisely the same check as we have.
I will turn to server's provider. Thank you very much for your help.
I don't know what TLS library the server provider is running, but I can reproduce this with a LibreSSL-backed Apache http2 server, so this may well involve a LibreSSL server-side bug. I can work around it, but then there are other issues...
I'll get back to you when I have time to look more deeply into it.
Hello,
I can't connect to server https://api.communicalia.com with LibreSSL. Connection failed on handshake:
I have simple c++ application to try it:
I built it by:
I linked it with different version of LibreSSL (v3.5.3, v3.6.3, v3.7.3, v3.8.2), but handshake to this server has failed with every tested version:
I found in curl output, that server requires client certificate:
Handshake failed with TLSv1.3. When I downgrade tls version to 1.2, handshake successes.
Why does handshake fail in connection to this server? It is bug in implementation of TLSv1.3 in LibreSSL?
Thanks, Jakub