mirror of
https://github.com/haproxy/haproxy.git
synced 2026-06-08 16:23:24 -04:00
MINOR: quic: avoid code duplication in TLS alert callback
Both the OpenSSL QUIC API TLS alert callback ha_quic_ossl_alert() does exactly the same thing than the one for quictls API, even if the parameter have different types. Call ha_quic_send_alert() quictls callback from ha_quic_ossl_alert OpenSSL QUIC API callback to avoid such code duplication.
This commit is contained in:
parent
ad101dc3d5
commit
e7b06f5e7a
1 changed files with 14 additions and 24 deletions
|
|
@ -162,6 +162,19 @@ static int qc_ssl_crypto_data_cpy(struct quic_conn *qc, struct quic_enc_level *q
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ha_quic_send_alert(SSL *ssl, enum ssl_encryption_level_t level, uint8_t alert)
|
||||
{
|
||||
struct quic_conn *qc = SSL_get_ex_data(ssl, ssl_qc_app_data_index);
|
||||
|
||||
TRACE_ENTER(QUIC_EV_CONN_SSLALERT, qc);
|
||||
|
||||
TRACE_PROTO("Received TLS alert", QUIC_EV_CONN_SSLALERT, qc, &alert, &level);
|
||||
|
||||
quic_set_tls_alert(qc, alert);
|
||||
TRACE_LEAVE(QUIC_EV_CONN_SSLALERT, qc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* returns 0 on error, 1 on success */
|
||||
static int ha_quic_set_encryption_secrets(SSL *ssl, enum ssl_encryption_level_t level,
|
||||
const uint8_t *read_secret,
|
||||
|
|
@ -628,17 +641,7 @@ leave:
|
|||
*/
|
||||
static int ha_quic_ossl_alert(SSL *ssl, unsigned char alert_code, void *arg)
|
||||
{
|
||||
int ret = 1, alert = alert_code;
|
||||
struct quic_conn *qc = SSL_get_ex_data(ssl, ssl_qc_app_data_index);
|
||||
|
||||
TRACE_ENTER(QUIC_EV_CONN_SSLALERT, qc);
|
||||
|
||||
TRACE_PROTO("Received TLS alert", QUIC_EV_CONN_SSLALERT, qc, &alert);
|
||||
quic_set_tls_alert(qc, alert_code);
|
||||
|
||||
TRACE_LEAVE(QUIC_EV_CONN_SSLALERT, qc);
|
||||
|
||||
return ret;
|
||||
return ha_quic_send_alert(ssl, -1, alert_code);
|
||||
}
|
||||
|
||||
static const OSSL_DISPATCH ha_quic_dispatch[] = {
|
||||
|
|
@ -702,19 +705,6 @@ static int ha_quic_flush_flight(SSL *ssl)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int ha_quic_send_alert(SSL *ssl, enum ssl_encryption_level_t level, uint8_t alert)
|
||||
{
|
||||
struct quic_conn *qc = SSL_get_ex_data(ssl, ssl_qc_app_data_index);
|
||||
|
||||
TRACE_ENTER(QUIC_EV_CONN_SSLALERT, qc);
|
||||
|
||||
TRACE_PROTO("Received TLS alert", QUIC_EV_CONN_SSLALERT, qc, &alert, &level);
|
||||
|
||||
quic_set_tls_alert(qc, alert);
|
||||
TRACE_LEAVE(QUIC_EV_CONN_SSLALERT, qc);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* QUIC TLS methods */
|
||||
#if defined(OPENSSL_IS_AWSLC)
|
||||
/* write/read set secret split */
|
||||
|
|
|
|||
Loading…
Reference in a new issue