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

Expose API to enable certificate compression. #241

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mstyura
Copy link
Contributor

@mstyura mstyura commented Jun 18, 2024

As a user of tokio-boring I'd like to control certificate compression feature using high-level Rust-friendly API instead of directly calling C functions form boring-sys.
I'm ready to adjust implementation if necessary to match the style of the rest of the crate.

@mstyura
Copy link
Contributor Author

mstyura commented Jun 18, 2024

Hello @inikulin!
Could you please review once you have time?
Thanks a lot in advance!

return 0;
}
if cursor.position() != uncompressed_len as u64 {
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This leaks decompressed?

let success = unsafe {
self.replace_ex_data(SslContext::cached_ex_index::<C>(), compressor);

ffi::SSL_CTX_add_cert_compression_alg(
Copy link
Collaborator

Choose a reason for hiding this comment

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

The callbacks are per algorithm, but the ex data is per type. If can_compress/can_decompress were set dynamically, it could get the callbacks out of sync with the implementation.

Maybe this function should fail if the ex data for C already exists?

Also SSL_CTX_add_cert_compression_alg will fail if the same algorithm is set more than once, but keeps the previous callbacks still set. In the current implementation that would use old callbacks, but replace the instance of C regardless. It's not strictly speaking unsound since the callbacks are type-specific, but it may be surprising.

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