mirror of
https://github.com/openssl/openssl.git
synced 2024-12-15 06:01:37 +08:00
QUIC APL: Adjust expect_quic_conn_only
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21915)
This commit is contained in:
parent
8c792b0ccd
commit
56df4cf24f
@ -277,12 +277,11 @@ err:
|
||||
* Like expect_quic(), but fails if called on a QUIC_XSO. ctx->xso may still
|
||||
* be non-NULL if the QCSO has a default stream.
|
||||
*/
|
||||
static int ossl_unused expect_quic_conn_only(const SSL *s, int in_io, QCTX *ctx)
|
||||
static int ossl_unused expect_quic_conn_only(const SSL *s, QCTX *ctx)
|
||||
{
|
||||
if (!expect_quic(s, ctx))
|
||||
return 0;
|
||||
|
||||
ctx->in_io = in_io;
|
||||
if (ctx->is_stream)
|
||||
return QUIC_RAISE_NON_NORMAL_ERROR(ctx, SSL_R_CONN_USE_ONLY, NULL);
|
||||
|
||||
@ -1985,7 +1984,7 @@ SSL *ossl_quic_conn_stream_new(SSL *s, uint64_t flags)
|
||||
{
|
||||
QCTX ctx;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return NULL;
|
||||
|
||||
return quic_conn_stream_new(&ctx, flags, /*need_lock=*/1);
|
||||
@ -2835,7 +2834,7 @@ int ossl_quic_set_default_stream_mode(SSL *s, uint32_t mode)
|
||||
{
|
||||
QCTX ctx;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return 0;
|
||||
|
||||
quic_lock(ctx.qc);
|
||||
@ -2872,7 +2871,7 @@ SSL *ossl_quic_detach_stream(SSL *s)
|
||||
QCTX ctx;
|
||||
QUIC_XSO *xso = NULL;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return NULL;
|
||||
|
||||
quic_lock(ctx.qc);
|
||||
@ -2897,7 +2896,7 @@ int ossl_quic_attach_stream(SSL *conn, SSL *stream)
|
||||
QUIC_XSO *xso;
|
||||
int nref;
|
||||
|
||||
if (!expect_quic_conn_only(conn, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(conn, &ctx))
|
||||
return 0;
|
||||
|
||||
if (stream == NULL || stream->type != SSL_TYPE_QUIC_XSO)
|
||||
@ -2977,7 +2976,7 @@ int ossl_quic_set_incoming_stream_policy(SSL *s, int policy,
|
||||
int ret = 1;
|
||||
QCTX ctx;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return 0;
|
||||
|
||||
quic_lock(ctx.qc);
|
||||
@ -3041,7 +3040,7 @@ SSL *ossl_quic_accept_stream(SSL *s, uint64_t flags)
|
||||
QUIC_XSO *xso;
|
||||
OSSL_RTT_INFO rtt_info;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return NULL;
|
||||
|
||||
quic_lock(ctx.qc);
|
||||
@ -3104,7 +3103,7 @@ size_t ossl_quic_get_accept_stream_queue_len(SSL *s)
|
||||
QCTX ctx;
|
||||
size_t v;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return 0;
|
||||
|
||||
quic_lock(ctx.qc);
|
||||
@ -3331,7 +3330,7 @@ int ossl_quic_get_conn_close_info(SSL *ssl,
|
||||
QCTX ctx;
|
||||
const QUIC_TERMINATE_CAUSE *tc;
|
||||
|
||||
if (!expect_quic_conn_only(ssl, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(ssl, &ctx))
|
||||
return -1;
|
||||
|
||||
tc = ossl_quic_channel_get_terminate_cause(ctx.qc->ch);
|
||||
@ -3357,7 +3356,7 @@ int ossl_quic_key_update(SSL *ssl, int update_type)
|
||||
{
|
||||
QCTX ctx;
|
||||
|
||||
if (!expect_quic_conn_only(ssl, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(ssl, &ctx))
|
||||
return 0;
|
||||
|
||||
switch (update_type) {
|
||||
@ -3417,7 +3416,7 @@ long ossl_quic_callback_ctrl(SSL *s, int cmd, void (*fp) (void))
|
||||
{
|
||||
QCTX ctx;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return 0;
|
||||
|
||||
switch (cmd) {
|
||||
@ -3468,7 +3467,7 @@ QUIC_CHANNEL *ossl_quic_conn_get_channel(SSL *s)
|
||||
{
|
||||
QCTX ctx;
|
||||
|
||||
if (!expect_quic_conn_only(s, /*io=*/0, &ctx))
|
||||
if (!expect_quic_conn_only(s, &ctx))
|
||||
return NULL;
|
||||
|
||||
return ctx.qc->ch;
|
||||
|
Loading…
Reference in New Issue
Block a user