diff options
author | Matt Caswell <matt@openssl.org> | 2023-02-06 15:34:05 +0000 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-02-22 05:34:06 +0000 |
commit | c12e11133625569f5b92a2a78486ecb70cd23df7 (patch) | |
tree | 191dd5e0f8c4bf28017de91adf61171b0864e5ef /ssl | |
parent | d6cf4b59a0f3c32d61828ee82c193494e13ff969 (diff) |
Rename various functions OSSL_QUIC_FAULT -> QTEST_FAULT
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20030)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/quic/quic_channel.c | 44 | ||||
-rw-r--r-- | ssl/quic/quic_impl.c | 6 | ||||
-rw-r--r-- | ssl/quic/quic_tserver.c | 15 |
3 files changed, 33 insertions, 32 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index cb820fffc8..1a95c0e10d 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -398,34 +398,32 @@ int ossl_quic_channel_is_active(const QUIC_CHANNEL *ch) return ch != NULL && ch->state == QUIC_CHANNEL_STATE_ACTIVE; } -int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch, - QUIC_TERMINATE_CAUSE *cause) +int ossl_quic_channel_is_terminating(const QUIC_CHANNEL *ch) { if (ch->state == QUIC_CHANNEL_STATE_TERMINATING_CLOSING - || ch->state == QUIC_CHANNEL_STATE_TERMINATING_DRAINING) { - if (cause != NULL) - *cause = ch->terminate_cause; + || ch->state == QUIC_CHANNEL_STATE_TERMINATING_DRAINING) return 1; - } + return 0; } -int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch, - QUIC_TERMINATE_CAUSE *cause) +int ossl_quic_channel_is_terminated(const QUIC_CHANNEL *ch) { - if (ch->state == QUIC_CHANNEL_STATE_TERMINATED) { - if (cause != NULL) - *cause = ch->terminate_cause; + if (ch->state == QUIC_CHANNEL_STATE_TERMINATED) return 1; - } + return 0; } -int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch, - QUIC_TERMINATE_CAUSE *cause) +int ossl_quic_channel_is_term_any(const QUIC_CHANNEL *ch) +{ + return ossl_quic_channel_is_terminating(ch) + || ossl_quic_channel_is_terminated(ch); +} + +QUIC_TERMINATE_CAUSE ossl_quic_channel_get_terminate_cause(const QUIC_CHANNEL *ch) { - return ossl_quic_channel_is_terminating(ch, cause) - || ossl_quic_channel_is_terminated(ch, cause); + return ch->terminate_cause; } int ossl_quic_channel_is_handshake_complete(const QUIC_CHANNEL *ch) @@ -1213,7 +1211,7 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg) */ /* If we are in the TERMINATED state, there is nothing to do. */ - if (ossl_quic_channel_is_terminated(ch, NULL)) { + if (ossl_quic_channel_is_terminated(ch)) { res->net_read_desired = 0; res->net_write_desired = 0; res->tick_deadline = ossl_time_infinite(); @@ -1224,7 +1222,7 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg) * If we are in the TERMINATING state, check if the terminating timer has * expired. */ - if (ossl_quic_channel_is_terminating(ch, NULL)) { + if (ossl_quic_channel_is_terminating(ch)) { now = ossl_time_now(); if (ossl_time_compare(now, ch->terminate_deadline) >= 0) { @@ -1295,11 +1293,11 @@ static void ch_tick(QUIC_TICK_RESULT *res, void *arg) * errors in ch_rx_pre() or ch_tx() may have caused us to transition to the * Terminated state. */ - res->net_read_desired = !ossl_quic_channel_is_terminated(ch, NULL); + res->net_read_desired = !ossl_quic_channel_is_terminated(ch); /* We want to write to the network if we have any in our queue. */ res->net_write_desired - = (!ossl_quic_channel_is_terminated(ch, NULL) + = (!ossl_quic_channel_is_terminated(ch) && ossl_qtx_get_queue_len_datagrams(ch->qtx) > 0); } @@ -1603,7 +1601,7 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch) OSSL_TIME deadline; uint32_t pn_space; - if (ossl_quic_channel_is_terminated(ch, NULL)) + if (ossl_quic_channel_is_terminated(ch)) return ossl_time_infinite(); deadline = ossl_ackm_get_loss_detection_deadline(ch->ackm); @@ -1621,7 +1619,7 @@ static OSSL_TIME ch_determine_next_tick_deadline(QUIC_CHANNEL *ch) ch->cc_method->get_next_credit_time(ch->cc_data)); /* Is the terminating timer armed? */ - if (ossl_quic_channel_is_terminating(ch, NULL)) + if (ossl_quic_channel_is_terminating(ch)) deadline = ossl_time_min(deadline, ch->terminate_deadline); else if (!ossl_time_is_infinite(ch->idle_deadline)) @@ -1751,7 +1749,7 @@ void ossl_quic_channel_local_close(QUIC_CHANNEL *ch, uint64_t app_error_code) { QUIC_TERMINATE_CAUSE tcause = {0}; - if (ossl_quic_channel_is_term_any(ch, NULL)) + if (ossl_quic_channel_is_term_any(ch)) return; tcause.app = 1; diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index bb9132eb75..5448e32e73 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -646,7 +646,7 @@ int ossl_quic_do_handshake(QUIC_CONNECTION *qc) /* Handshake already completed. */ return 1; - if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch, NULL)) + if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch)) return QUIC_RAISE_NON_NORMAL_ERROR(qc, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL); if (BIO_ADDR_family(&qc->init_peer_addr) == AF_UNSPEC) { @@ -1012,7 +1012,7 @@ int ossl_quic_write(SSL *s, const void *buf, size_t len, size_t *written) if (!expect_quic_conn(qc)) return 0; - if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch, NULL)) + if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch)) return QUIC_RAISE_NON_NORMAL_ERROR(qc, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL); /* @@ -1133,7 +1133,7 @@ static int quic_read(SSL *s, void *buf, size_t len, size_t *bytes_read, int peek if (!expect_quic_conn(qc)) return 0; - if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch, NULL)) + if (qc->ch != NULL && ossl_quic_channel_is_term_any(qc->ch)) return QUIC_RAISE_NON_NORMAL_ERROR(qc, SSL_R_PROTOCOL_IS_SHUTDOWN, NULL); /* If we haven't finished the handshake, try to advance it. */ diff --git a/ssl/quic/quic_tserver.c b/ssl/quic/quic_tserver.c index 4c120d0d58..566d2c37ac 100644 --- a/ssl/quic/quic_tserver.c +++ b/ssl/quic/quic_tserver.c @@ -154,17 +154,20 @@ int ossl_quic_tserver_tick(QUIC_TSERVER *srv) } /* Returns 1 if the server is in any terminating or terminated state */ -int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv, - QUIC_TERMINATE_CAUSE *cause) +int ossl_quic_tserver_is_term_any(QUIC_TSERVER *srv) { - return ossl_quic_channel_is_term_any(srv->ch, cause); + return ossl_quic_channel_is_term_any(srv->ch); +} + +QUIC_TERMINATE_CAUSE ossl_quic_tserver_get_terminate_cause(QUIC_TSERVER *srv) +{ + return ossl_quic_channel_get_terminate_cause(srv->ch); } /* Returns 1 if the server is in a terminated state */ -int ossl_quic_tserver_is_terminated(QUIC_TSERVER *srv, - QUIC_TERMINATE_CAUSE *cause) +int ossl_quic_tserver_is_terminated(QUIC_TSERVER *srv) { - return ossl_quic_channel_is_terminated(srv->ch, cause); + return ossl_quic_channel_is_terminated(srv->ch); } int ossl_quic_tserver_is_handshake_confirmed(QUIC_TSERVER *srv) |