summaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorHugo Landau <hlandau@openssl.org>2023-08-09 17:46:32 +0100
committerHugo Landau <hlandau@openssl.org>2023-09-01 10:45:33 +0100
commit2e1760118b5ba316cdf0b144a21fb4c21f796c71 (patch)
tree1fa351594f411024841c5f836170d4401d0ed972 /ssl
parent549d0a700be311d9a65560cb9eed3f725546b5ed (diff)
QUIC APL: Better error reporting
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/21715)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/quic/quic_impl.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/ssl/quic/quic_impl.c b/ssl/quic/quic_impl.c
index b2ab9d4c67..79011f3387 100644
--- a/ssl/quic/quic_impl.c
+++ b/ssl/quic/quic_impl.c
@@ -1453,32 +1453,39 @@ static int create_channel(QUIC_CONNECTION *qc)
}
/*
- * Creates a channel and configures it with the information we have accumulated
- * via calls made to us from the application prior to starting a handshake
- * attempt.
+ * Configures a channel with the information we have accumulated via calls made
+ * to us from the application prior to starting a handshake attempt.
*/
QUIC_NEEDS_LOCK
-static int ensure_channel_started(QUIC_CONNECTION *qc)
+static int ensure_channel_started(QCTX *ctx)
{
+ QUIC_CONNECTION *qc = ctx->qc;
+
if (!qc->started) {
- if (!configure_channel(qc)
- || !ossl_quic_channel_start(qc->ch))
- goto err;
+ if (!configure_channel(qc)) {
+ QUIC_RAISE_NON_NORMAL_ERROR(ctx, ERR_R_INTERNAL_ERROR,
+ "failed to configure channel");
+ return 0;
+ }
+
+ if (!ossl_quic_channel_start(qc->ch)) {
+ QUIC_RAISE_NON_NORMAL_ERROR(ctx, ERR_R_INTERNAL_ERROR,
+ "failed to start channel");
+ return 0;
+ }
#if !defined(OPENSSL_NO_QUIC_THREAD_ASSIST)
if (qc->is_thread_assisted)
- if (!ossl_quic_thread_assist_init_start(&qc->thread_assist, qc->ch))
- goto err;
+ if (!ossl_quic_thread_assist_init_start(&qc->thread_assist, qc->ch)) {
+ QUIC_RAISE_NON_NORMAL_ERROR(ctx, ERR_R_INTERNAL_ERROR,
+ "failed to start assist thread");
+ return 0;
+ }
#endif
}
qc->started = 1;
return 1;
-
-err:
- ossl_quic_channel_free(qc->ch);
- qc->ch = NULL;
- return 0;
}
QUIC_NEEDS_LOCK
@@ -1515,10 +1522,8 @@ static int quic_do_handshake(QCTX *ctx)
* Start connection process. Note we may come here multiple times in
* non-blocking mode, which is fine.
*/
- if (!ensure_channel_started(qc)) {
- QUIC_RAISE_NON_NORMAL_ERROR(ctx, ERR_R_INTERNAL_ERROR, NULL);
+ if (!ensure_channel_started(qc)) /* raises on failure */
return -1; /* Non-protocol error */
- }
if (ossl_quic_channel_is_handshake_complete(qc->ch))
/* The handshake is now done. */