Skip to content

10.1.x: ocsp: add single-cert stapling fast path and certinfo RAII (#13229) - #13467

Open
moonchen wants to merge 1 commit into
apache:10.1.xfrom
moonchen:backport-13229-10.1.x
Open

10.1.x: ocsp: add single-cert stapling fast path and certinfo RAII (#13229)#13467
moonchen wants to merge 1 commit into
apache:10.1.xfrom
moonchen:backport-13229-10.1.x

Conversation

@moonchen

@moonchen moonchen commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Backport of #13229 (30d8fcad44) to 10.1.x, because this fixes a leak this fixes a leak in the OCSP stapling code: under BoringSSL the certinfo map's reference on the leaf certificate is never released, so a leaf leaks per certificate on every config reload.


Skip the SSL_get_certificate() lookup and X509_cmp() DER re-parse in the stapling callback when an SSL_CTX has a single certificate. The shortcut is gated to non-dual-cert builds; under HAVE_NATIVE_DUAL_CERT_SUPPORT a CTX can hold multiple certs where only one has OCSP info, so map size alone cannot identify the negotiated cert.

Give certinfo a constructor/destructor so its resources are managed by RAII, and allocate it with make_unique. This consolidates the cleanup that was duplicated across certinfo_map_free and the init error path, and fixes two pre-existing leaks (cid and the BoringSSL cert ref) plus an error path that could delete a certinfo_map still owned by the SSL_CTX.

)

Skip the SSL_get_certificate() lookup and X509_cmp() DER re-parse in the stapling callback when an SSL_CTX has a single certificate. The shortcut is gated to non-dual-cert builds; under HAVE_NATIVE_DUAL_CERT_SUPPORT a CTX can hold multiple certs where only one has OCSP info, so map size alone cannot identify the negotiated cert.

Give certinfo a constructor/destructor so its resources are managed by RAII, and allocate it with make_unique. This consolidates the cleanup that was duplicated across certinfo_map_free and the init error path, and fixes two pre-existing leaks (cid and the BoringSSL cert ref) plus an error path that could delete a certinfo_map still owned by the SSL_CTX.

(cherry picked from commit 30d8fca)

Conflicts resolved to the upstream RAII form; the certinfo_free() helper
added by a5a2c8a is removed because ~certinfo now performs that cleanup.
@moonchen moonchen self-assigned this Jul 31, 2026
@moonchen moonchen added TLS Backport Marked for backport for an LTS patch release Leak labels Jul 31, 2026
@cmcfarlen cmcfarlen moved this to For v10.1.1 in ATS v10.1.x Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backport Marked for backport for an LTS patch release Leak TLS

Projects

Status: For v10.1.1

Development

Successfully merging this pull request may close these issues.

3 participants