Skip to content

Load system CA certificates once per SSLContext on Linux - #246

Open
luccabb wants to merge 1 commit into
sethmlarson:mainfrom
luccabb:lucca/load-system-certs-once
Open

luccabb wants to merge 1 commit into
sethmlarson:mainfrom
luccabb:lucca/load-system-certs-once

Conversation

@luccabb

@luccabb luccabb commented Oct 17, 2026

Copy link
Copy Markdown

CPU for one handshake after N connections on the same context, Ubuntu 24.04 (OpenSSL 3.0.13):

N 0.10.5 this PR
1 12 ms 12 ms
1,000 42 ms 2 ms
5,000 152 ms 2 ms
20,000 579 ms 2 ms

_configure_context() ran on every wrap_socket()/wrap_bio() and called
set_default_verify_paths() on the same context each time. On OpenSSL 3.0
that re-parses the CA file and appends the default cert directory to the
X509_LOOKUP_store URI list without deduplication, so every later handshake
scans that directory once per previous connection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@notatallshaw

Copy link
Copy Markdown
Collaborator

Reused contexts miss newly added CAs (same as reviewed in #213 (comment)). And updated CRLs are ignored (same as reviewed in #244 (comment))

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants