MINOR: ssl_sock: Set the QUIC application from ssl_sock_advertise_alpn_protos.

Make this function call quic_set_app_ops() if the protocol could be negotiated
by the TLS stack.
This commit is contained in:
Frédéric Lécaille 2021-12-14 19:40:04 +01:00 committed by Amaury Denoyelle
parent b0bd62db23
commit 1761fdf0c6

View File

@ -1974,17 +1974,26 @@ static int ssl_sock_advertise_alpn_protos(SSL *s, const unsigned char **out,
unsigned int server_len, void *arg)
{
struct ssl_bind_conf *conf = arg;
#ifdef USE_QUIC
struct connection *conn = SSL_get_ex_data(s, ssl_app_data_index);
#endif
if (SSL_select_next_proto((unsigned char**) out, outlen, (const unsigned char *)conf->alpn_str,
conf->alpn_len, server, server_len) != OPENSSL_NPN_NEGOTIATED) {
#ifdef USE_QUIC
struct connection *conn = SSL_get_ex_data(s, ssl_app_data_index);
if (conn->qc)
quic_set_tls_alert(conn->qc, SSL_AD_NO_APPLICATION_PROTOCOL);
#endif
return SSL_TLSEXT_ERR_NOACK;
}
#ifdef USE_QUIC
if (conn->qc && !quic_set_app_ops(conn->qc, *out, *outlen)) {
quic_set_tls_alert(conn->qc, SSL_AD_NO_APPLICATION_PROTOCOL);
return SSL_TLSEXT_ERR_NOACK;
}
#endif
return SSL_TLSEXT_ERR_OK;
}
#endif