Skip to content

Conversation

@nox
Copy link
Collaborator

@nox nox commented Jun 2, 2025

We introduce X509StoreContextRef::init_without_cleanup.

Function X509_STORE_CTX_init requires its arguments to outlive the store context, which is why X509StoreContextRef::init takes a closure which is guaranteed to be followed by a call to X509_STORE_CTX_cleanup.

We can avoid that by using the store context's ex data to store and own the arguments that were passed to X509_STORE_CTX_init.

@nox nox force-pushed the improve-verify branch 2 times, most recently from 9411cde to 194a13b Compare June 2, 2025 08:20
@nox nox force-pushed the improve-verify branch from 194a13b to 1ca97b4 Compare June 3, 2025 06:11
@nox nox force-pushed the improve-verify branch from 1ca97b4 to 04ac586 Compare June 3, 2025 06:13
As X509_STORE_CTX_init requires its arguments to outlive
the store context, we take ownership of all of them
and put them in the store context's ex data, ensuring
the soundness of the operation without the mandatory
call to X509_STORE_CTX_cleanup after a closure
is run.
@nox nox force-pushed the improve-verify branch from 04ac586 to faeb12f Compare June 3, 2025 06:14
@kornelski kornelski merged commit 05f798a into master Jun 5, 2025
25 checks passed
@kornelski kornelski deleted the improve-verify branch June 5, 2025 00:06
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