Skip to content

ext/openssl: Fix SNI certs not used on streams sharing a session SSL_CTX - #25398

Closed
bukka wants to merge 0 commit into
php:PHP-8.6from
bukka:openssl_shared_ctx_sni
Closed

bukka wants to merge 0 commit into
php:PHP-8.6from
bukka:openssl_shared_ctx_sni

Conversation

@bukka

@bukka bukka commented Nov 11, 2026

Copy link
Copy Markdown
Member

Since b1242c3 a server stream seeded from a session stream shares the parent's SSL_CTX and ignores its own context options. The SNI callback registered on that context looks up sni_certs of the stream doing the handshake, but the table stayed only on the parent, so the child always served the default certificate instead of the one matching the requested name.

This gives the child its own table that references the parent's per-name contexts (SSL_CTX_up_ref), so it also stays valid when the parent is closed first. It follows the same approach as the ALPN list copy in GH-25211.

Only 8.6 is affected. In 8.5 a server stream with a session stream still created its own context from its own options.

@iliaal iliaal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@bukka bukka closed this Nov 27, 2026
@bukka
bukka force-pushed the openssl_shared_ctx_sni branch from 91ad65f to 604eaea Compare November 27, 2026 18:34
@bukka

bukka commented Nov 27, 2026

Copy link
Copy Markdown
Member Author

Merged via 604eaea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants