diff options
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/quic/quic_channel.c | 2 | ||||
-rw-r--r-- | ssl/quic/quic_impl.c | 21 | ||||
-rw-r--r-- | ssl/ssl_lib.c | 13 |
3 files changed, 31 insertions, 5 deletions
diff --git a/ssl/quic/quic_channel.c b/ssl/quic/quic_channel.c index 3b9993b96a..8e75eda539 100644 --- a/ssl/quic/quic_channel.c +++ b/ssl/quic/quic_channel.c @@ -635,7 +635,7 @@ int ossl_quic_channel_is_active(const QUIC_CHANNEL *ch) return ch != NULL && ch->state == QUIC_CHANNEL_STATE_ACTIVE; } -static int ossl_quic_channel_is_closing(const QUIC_CHANNEL *ch) +int ossl_quic_channel_is_closing(const QUIC_CHANNEL *ch) { return ch->state == QUIC_CHANNEL_STATE_TERMINATING_CLOSING; } diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 29a283dca0..bdf5d5fea8 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -3572,6 +3572,27 @@ const SSL_CIPHER *ossl_quic_get_cipher(unsigned int u) } /* + * SSL_get_shutdown() + * ------------------ + */ +int ossl_quic_get_shutdown(const SSL *s) +{ + QCTX ctx; + int shut = 0; + + if (!expect_quic_conn_only(s, &ctx)) + return 0; + + if (ossl_quic_channel_is_term_any(ctx.qc->ch)) { + shut |= SSL_SENT_SHUTDOWN; + if (!ossl_quic_channel_is_closing(ctx.qc->ch)) + shut |= SSL_RECEIVED_SHUTDOWN; + } + + return shut; +} + +/* * Internal Testing APIs * ===================== */ diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index f15fe126a2..bd9160b756 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -5142,7 +5142,7 @@ void SSL_set_quiet_shutdown(SSL *s, int mode) { SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s); - /* TODO(QUIC): Currently not supported for QUIC. */ + /* Not supported with QUIC */ if (sc == NULL) return; @@ -5153,7 +5153,7 @@ int SSL_get_quiet_shutdown(const SSL *s) { const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL_ONLY(s); - /* TODO(QUIC): Currently not supported for QUIC. */ + /* Not supported with QUIC */ if (sc == NULL) return 0; @@ -5164,7 +5164,7 @@ void SSL_set_shutdown(SSL *s, int mode) { SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s); - /* TODO(QUIC): Do we want this for QUIC? */ + /* Not supported with QUIC */ if (sc == NULL) return; @@ -5175,7 +5175,12 @@ int SSL_get_shutdown(const SSL *s) { const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL_ONLY(s); - /* TODO(QUIC): Do we want this for QUIC? */ +#ifndef OPENSSL_NO_QUIC + /* QUIC: Just indicate whether the connection was shutdown cleanly. */ + if (IS_QUIC(s)) + return ossl_quic_get_shutdown(s); +#endif + if (sc == NULL) return 0; |