diff options
author | Hugo Landau <hlandau@openssl.org> | 2023-04-26 15:57:18 +0100 |
---|---|---|
committer | Hugo Landau <hlandau@openssl.org> | 2023-05-12 14:47:14 +0100 |
commit | 59c5c016e53256e949225a2dd751b3450129cd72 (patch) | |
tree | 4f81bb73563a5afa0f12ef50998f4f07f085dac7 /ssl | |
parent | 22b1a96ff798cf73f4b573bff1d9f80236d3f102 (diff) |
QUIC APL: Fix logic of SSL_get_stream_type
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/20765)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/quic/quic_impl.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c index 581117d537..d7ef8963f6 100644 --- a/ssl/quic/quic_impl.c +++ b/ssl/quic/quic_impl.c @@ -2009,18 +2009,21 @@ int ossl_quic_get_stream_type(SSL *s) QCTX ctx; if (!expect_quic(s, &ctx)) - return SSL_STREAM_TYPE_NONE; + return SSL_STREAM_TYPE_BIDI; if (ctx.xso == NULL) { /* - * If we are deferring XSO creation, assume single stream mode and - * default to BIDI, as the deferred XSO which will be created will be - * bidirectional. + * If deferred XSO creation has yet to occur, proceed according to the + * default stream mode. If AUTO_BIDI or AUTO_UNI is set, we cannot know + * what kind of stream will be created yet, so return BIDI on the basis + * that at this time, the client still has the option of calling + * SSL_read() or SSL_write() first. */ - if (!ctx.qc->default_xso_created) - return SSL_STREAM_TYPE_BIDI; - else + if (ctx.qc->default_xso_created + || ctx.qc->default_stream_mode == SSL_DEFAULT_STREAM_MODE_NONE) return SSL_STREAM_TYPE_NONE; + else + return SSL_STREAM_TYPE_BIDI; } if (ossl_quic_stream_is_bidi(ctx.xso->stream)) |