SSL_CTX_SET_...NDING_CONN_CB(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… SSL_CTX_SET_...NDING_CONN_CB πŸ’…

okay bestie, welcome to the 3ossl manual page for SSL_CTX_set_new_pending_conn_cb, SSL_set_new_pending_conn_cb_fn β€” aka the callback situation that tells your app about brand-new QUIC connection SSL objects the moment they pop into existence. no cap, this is the good stuff ✨


✨ NAME ✨

SSL_CTX_set_new_pending_conn_cb, SSL_set_new_pending_conn_cb_fn β€” the callback function that reports the creation of QUIC connection SSL objects πŸ¦‹


πŸŽ€ 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);

πŸ’– DESCRIPTION πŸ’–

SSL_CTX_set_new_pending_conn_cb() sets the new_pending_conn callback function plus its associated application data argument arg. simple as that, slay πŸ’…

so here's the lore: when you're using the QUIC transport, TLS handshake processing can happen totally independently from the thread that accepts the connection the handshake is establishing. literally separate threads living their separate lives. which means SSL objects representing the connection may get allocated and initialized before anyone even calls SSL_accept_connection(). iconic, but also a vibe check for your code 😭

this registered callback is your moment to shine: use it to decorate that preallocated SSL object, or to create other associations with its parent SSL β€” all prior to a call to SSL_accept_connection(). go off, bestie 🫢


πŸ”₯ RETURN VALUES πŸ”₯

  • SSL_CTX_set_new_pending_conn_cb() β€” returns, uh, no value. void. nothing. it's giving "no thoughts, head empty" πŸ’€
  • SSL_set_new_pending_conn_cb_fn() β€” returns an integer value, and the number matters:
    • a return value of 0 means the QUIC stack must discard this newly created SSL object. yep, throw it out β€” which implies the associated new connection will not be available for handling on a subsequent call to SSL_accept_connection(). bye felicia πŸ‘‹
    • a nonzero return value is treated as success, which allows the new connection to be enqueued to the accept queue. we love a happy ending 🌈

πŸ‘€ SEE ALSO πŸ‘€


⚠️ NOTES ⚠️

okay so there are some limitations with callbacks in QUIC connections and you really need to factor them into your app design. not me warning you twice πŸ™ˆ

  • QUIC connections may begin processing prior to when an application calls SSL_accept_connection() on them. because of this, it can totally happen that callbacks get delivered to your app's registered TLS callbacks before those SSL objects are returned in SSL_accept_connection(). applications should expect this possibility. like, fr fr, plan for it πŸ’€
  • in particular, no references should be held on SSL objects passed to callbacks for QUIC connections until such time as they are returned through a call to SSL_accept_connection. don't be out here holding onto things that aren't yours yet, bestie 😭

🌸 HISTORY 🌸

SSL_CTX_set_new_pending_conn_cb() was added in OpenSSL 3.5. fresh-ish, but we're obsessed πŸŽ€


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 tea, bestie πŸ“ this was version 3.5.6, dated 2026-04-0, straight from the OpenSSL 3ossl manual β€” now go decorate some preallocated SSL objects and slay πŸ’œπŸ§šβœ¨

πŸ“¦ where this page comes from