Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple libraries in the same process using s2n-tls / calling s2n_init #4870

Open
maddeleine opened this issue Nov 4, 2024 · 1 comment

Comments

@maddeleine
Copy link
Contributor

maddeleine commented Nov 4, 2024

Security issue notifications

If you discover a potential security issue in s2n we ask that you notify
AWS Security via our vulnerability reporting page. Please do not create a public github issue.

Problem:

Users currently have difficulties when trying to use two libraries that both attempt to initialize s2n-tls in the same process. What occurs is that the second call to s2n_init will error. Right now people do things like ignore failures from the s2n_init call, which is unsafe.

Solution:

One solution is to make s2n_is_initialized() public so users can check if they need to call s2n_init. Another solution is to make s2n_init() idempotent. This should be safe because all of our APIs that configure s2n_init behavior error if the library is already initialized. I'm not exactly sure how cleanup would work in this situation though so we might need an investigation if there are any issues that might arise from this. Probably the safest thing here is to not clean up s2n-tls in this situation?

Requirements / Acceptance Criteria:

Out of scope:

@maddeleine
Copy link
Contributor Author

maddeleine commented Nov 4, 2024

I guess another way of currently dealing with this issue is to gate the call to s2n_init like:

if (s2n_init() ==  -1 && s2n_errno != S2N_ERR_INITIALIZED) {
    // Fail for any s2n_init error that isn't the already initialized error
}

But I don't think the errors are public so I don't think users can actually branch on them.

@lrstewart lrstewart changed the title Make s2n_is_initialized an API Handle multiple libraries in the same process using s2n-tls / calling s2n_init Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants