Skip to content

Commit

Permalink
QUIC SSL: SSL_set_quiet_shutdown
Browse files Browse the repository at this point in the history
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from #20061)
  • Loading branch information
hlandau authored and paulidale committed Jul 4, 2023
1 parent 3ea30e7 commit f66f0d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/man3/SSL_CTX_set_quiet_shutdown.pod
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ B<mode> may be 0 or 1.

SSL_get_quiet_shutdown() returns the "quiet shutdown" setting of B<ssl>.

These functions are not supported for QUIC SSL objects.

=head1 NOTES

Normally when a SSL connection is finished, the parties must send out
Expand Down
6 changes: 3 additions & 3 deletions ssl/ssl_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ SSL *ossl_ssl_connection_new_int(SSL_CTX *ctx, const SSL_METHOD *method)
if (s->param == NULL)
goto asn1err;
X509_VERIFY_PARAM_inherit(s->param, ctx->param);
s->quiet_shutdown = ctx->quiet_shutdown;
s->quiet_shutdown = IS_QUIC_CTX(ctx) ? 0 : ctx->quiet_shutdown;

if (!IS_QUIC_CTX(ctx))
s->ext.max_fragment_len_mode = ctx->ext.max_fragment_len_mode;
Expand Down Expand Up @@ -5123,7 +5123,7 @@ void SSL_set_quiet_shutdown(SSL *s, int mode)
{
SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL_ONLY(s);

/* TODO(QUIC): Do we want this for QUIC? */
/* TODO(QUIC): Currently not supported for QUIC. */
if (sc == NULL)
return;

Expand All @@ -5134,7 +5134,7 @@ int SSL_get_quiet_shutdown(const SSL *s)
{
const SSL_CONNECTION *sc = SSL_CONNECTION_FROM_CONST_SSL_ONLY(s);

/* TODO(QUIC): Do we want this for QUIC? */
/* TODO(QUIC): Currently not supported for QUIC. */
if (sc == NULL)
return 0;

Expand Down
5 changes: 5 additions & 0 deletions test/quicapitest.c
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ static int test_quic_forbidden_options(void)
SSL_CTX_set_read_ahead(ctx, 1);
SSL_CTX_set_max_early_data(ctx, 1);
SSL_CTX_set_recv_max_early_data(ctx, 1);
SSL_CTX_set_quiet_shutdown(ctx, 1);

if (!TEST_ptr(ssl = SSL_new(ctx)))
goto err;
Expand Down Expand Up @@ -509,6 +510,10 @@ static int test_quic_forbidden_options(void)
if (!TEST_false(SSL_stateless(ssl)))
goto err;

/* Quiet Shutdown */
if (!TEST_false(SSL_get_quiet_shutdown(ssl)))
goto err;

testresult = 1;
err:
SSL_free(ssl);
Expand Down

0 comments on commit f66f0d3

Please sign in to comment.