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

no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point #286

Open
Jonathan-Landeed opened this issue Aug 22, 2024 · 6 comments · May be fixed by #306
Labels
question Further information is requested

Comments

@Jonathan-Landeed
Copy link

Related to snapview/tokio-tungstenite#336

I solved it by adding rustls = ">=0.23.x" to my Cargo.toml and let _ = rustls::crypto::aws_lc_rs::default_provider().install_default(); before calling slack morphism stuff, but that doesn't seem ideal.

@abdolence
Copy link
Owner

Hey, thanks for letting me know there are some issues.
I've removed my Cargo.lock to verify it with the latest builds (rustls v0.27.2 there) and It seems working with socket_mode example without changing anything. I would guess it is related to some specific features configuration in your app?

@abdolence abdolence added the question Further information is requested label Aug 23, 2024
@Jonathan-Landeed
Copy link
Author

I think it might be when tonic v0.12.1 enables the ring feature, but I'm a bit over my head on this.

I also have multiple versions of rustls installed because aws-smithy-runtime is still on rustls v0.21.12, but that shouldn't matter.

@jiangxiaoqiang
Copy link

add this code to fixed this:

rustls::crypto::ring::default_provider().install_default().expect("Failed to install rustls crypto provider");

@abcdabcd987
Copy link

I also run into this issue. After introducing slack-morphism to one project, the other project in the same Cargo workspace run into this problem.

I think the reason is that -- by default, rustls crate installs aws-lc-rs crate but not ring crate. When only one of them exists, rustls can automatically use it as the default. On the other hand, when both exists, it requires users to explicitly setup the default provider, hence @jiangxiaoqiang 's fix is required.

I guess most applications don't explicitly depend on rustls, ring, or aws-lc-rs. Rather, rustls are pulled in by other dependencies (and subsequently aws-lc-rs). When use slack-morphism with hyper feature, since signature_verifier.rs uses ring, ring got pulled in.

I'd say this would really be a big surprise for users.

I wonder if you'd consider using other crates to implement signature_verifier.rs and drop the dependency of ring? For example, you can use a combination of hmac::{Hmac, Mac}, sha2::Sha256, hex, subtle::ConstantTimeEq.

@abcdabcd987 abcdabcd987 linked a pull request Jan 11, 2025 that will close this issue
@abdolence
Copy link
Owner

I think the reason is that -- by default, rustls crate installs aws-lc-rs crate but not ring crate. When only one of them exists, rustls can automatically use it as the default. On the other hand, when both exists, it requires users to explicitly setup the default provider, hence @jiangxiaoqiang 's fix is required.

I see, now it least it understandable why it affects only some of us. Thanks for digging!

I wonder if you'd consider using other crates to implement signature_verifier.rs and drop the dependency of ring? For example, you can use a combination of hmac::{Hmac, Mac}, sha2::Sha256, hex, subtle::ConstantTimeEq.

I need to verify those links first, let me do some due diligence of those dependencies and will check the PR. I have no objections against simplifying people's life in general, just need to understand the consequences of new deps.

@abdolence
Copy link
Owner

Thanks for the contributions and digging again @abcdabcd987 👍🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants