SSL_CTX_SET_...NDING_CONN_CB(3SSL)
β¨ NAME β¨
SSL_CTX_set_new_pending_conn_cb, SSL_set_new_pending_conn_cb_fn β bestie, this is the callback function that reports when a QUIC connection SSL object gets created ππ
From the 3SSL manual, obviously, we stay documented around here π
π¦ SYNOPSIS π¦
typedef int (*SSL_set_new_pending_conn_cb_fn)(SSL_CTX *c, SSL *new_ssl,
void *arg);
void SSL_CTX_set_new_pending_conn_cb(SSL_CTX *c,
SSL_set_new_pending_conn_cb_fn *f,
void *arg);
no cap, that's the whole signature, copy it exactly bestie π«Ά
πΈ DESCRIPTION πΈ
okay so SSL_CTX_set_new_pending_conn_cb() sets the new_pending_conn callback function, plus its lil buddy the associated application data arg. π
So here's the tea: when you're using the QUIC transport, TLS handshake processing can happen independently from the thread that accepts the connection the handshake is establishing. meaning?? the <italic>SSL</italic> objects representing the connection may get allocated and initialized before anyone even calls SSL_accept_connection(). π³
That's why this registered callback exists β you can use it to decorate that preallocated <italic>SSL</italic> object, or create other associations with its parent <italic>SSL</italic>, all before a call to SSL_accept_connection(). iconic behavior, honestly. β¨
π RETURN VALUES π
SSL_CTX_set_new_pending_conn_cb()β returns no value. nothing. void. empty. she gives nothing and that's fine πSSL_set_new_pending_conn_cb_fn()β returns an<italic>integer</italic>value. π- A return value of
0means the QUIC stack must discard this newly created<italic>SSL</italic>object π β which implies the associated new connection will not be available for handling on a subsequent call toSSL_accept_connection(). - A nonzero return value is treated as success π₯, letting the new connection get enqueued to the accept queue.
- A return value of
π SEE ALSO π
β οΈ NOTES β οΈ
Callbacks in QUIC connections have some limitations to them that you really should take into consideration when writing an application. not to be dramatic but this part matters π«£
- QUIC connections may begin processing prior to when an application calls
SSL_accept_connection()on them. As such, it may occur that callbacks are delivered to applications' registered TLS callbacks prior to those<italic>SSL</italic>objects being returned inSSL_accept_connection(). Applications should expect this possibility. fr fr, prepare yourself. π - In particular, no references should be held on
<italic>SSL</italic>objects passed to callbacks for QUIC connections until such time as they are returned through a call toSSL_accept_connection(). do not hold that reference bestie, I'm begging π€
the way that these notes are literally the whole plot... read them twice. π
π HISTORY π
SSL_CTX_set_new_pending_conn_cb() was added in OpenSSL 3.5 β she's new here but she's already main character energy β
π COPYRIGHT π
Copyright 2025 The OpenSSL Project Authors. All Rights Reserved. π
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the page bestie!! π§ this was OpenSSL 4.0.3, dated 2026-09-29 β go forth and register your callbacks responsibly, mwah ππ
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms