]> git.ipfire.org Git - thirdparty/openssl.git/commit
Revert "Preserve connection custom extensions in SSL_set_SSL_CTX()"
authorMatt Caswell <matt@openssl.foundation>
Tue, 12 May 2026 13:19:35 +0000 (14:19 +0100)
committerTomas Mraz <tomas@openssl.foundation>
Wed, 13 May 2026 16:23:16 +0000 (18:23 +0200)
commit7836b7d5b6a6b27a441c4e4c8564be6b270580c4
tree68311664398d1f4c80a9fbc714d8a5372acff9da
parent5b2abf8f9c4083478e7e1ae6832d9ddfbdaf98b2
Revert "Preserve connection custom extensions in SSL_set_SSL_CTX()"

This reverts commit 403ba31a02e47d37070036529966d5a94d98c6fd.

PR #27706 (that this PR reverts) was intended to fix nginx/nginx#711

The problem was that when calling SSL_set_SSL_CTX() from an SNI callback
when using a QUIC object, the QUIC custom extensions were not being
handled correctly. The fix attempted to resolve this to make sure that
they were correctly being copied.

However, in reality there was a bug in the SNI callback code that meant when
we called it from a QUIC connection we were passing the *inner* TLS
object instead of the real QUIC one. The *inner* TLS object should be
entirely internal and not exposed to user callbacks. This bug was fixed in
dc84829cc5.

Once the above fix was in place `SSL_set_SSL_CTX()` immediately fails when
called with a QUIC object via the SNI callback. This was always the
intended behaviour - its use with a QUIC object was blocked since the very
beginning - but the fact that we passed the inner TLS object by mistake
circumvented the check when it was invoked from the SNI callback.

The fix in dc84829cc5 actually landed *before* the commit that this PR
reverts. So, in reality the nginx bug was already "fixed" by the time
that PR #27706 was merged (fixed in the sense that the invocation of
`SSL_set_SSL_CTX()` fails gracefully). The code that it introduced can not
be reached (and never could be) because calling `SSL_set_SSL_CTX()` is
explicitly blocked when using a QUIC object. Therefore we should remove
this dead code.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Saša Nedvědický <sashan@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed May 13 16:23:24 2026
(Merged from https://github.com/openssl/openssl/pull/31159)
ssl/ssl_lib.c
ssl/ssl_local.h
ssl/statem/extensions_cust.c
test/sslapitest.c