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

How I use CryptoProvider::install_default() ? #1938

Closed
incker opened this issue May 3, 2024 · 3 comments
Closed

How I use CryptoProvider::install_default() ? #1938

incker opened this issue May 3, 2024 · 3 comments

Comments

@incker
Copy link

incker commented May 3, 2024

Hello, I receive panic
PanicInfo { payload: Any { .. }, message: Some(no process-level CryptoProvider available -- call CryptoProvider::install_default() before this point), location: Location { file: "/home/incker/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-0.23.5/src/crypto/mod.rs", line: 260, col: 14 }, can_unwind: true, force_no_backtrace: false }

But there is no example how to use CryptoProvider::install_default()

Cargo.toml:
rustls = {version = "0.23.5", default-features = false, features = ["std"]}

If I remove default-features = false it requires
Please enable the 'bindgen' feature on aws-lc-rs or aws-lc-sys.For more information, see the aws-lc-rs User Guide: https://aws.github.io/aws-lc-rs/index.html

but adding this:
aws-lc-rs = {version = "1.7.0", features = ["bindgen"]}
requires:
/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found
thread 'main' panicked at /home/builder/.cargo/registry/src/index.crates.io-6f17d22bba15001f/aws-lc-sys-0.15.0/builder/bindgen.rs:155:10:
Unable to generate bindings.: ClangDiagnostic("/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found\n")

And i haven't found package gcc-multilib for arm-buildroot-linux-musleabihf ((

Forward thank you!

@ctz
Copy link
Member

ctz commented May 3, 2024

But there is no example how to use CryptoProvider::install_default()

See https://docs.rs/rustls/latest/rustls/index.html#crate-features

/usr/include/stdio.h:27:10: fatal error: 'bits/libc-header-start.h' file not found

https://rust-lang.github.io/rust-bindgen/requirements.html#requirements aside from that, yes, you will need a working sysroot for the target and to tell bindgen where it is.

@KarstenB
Copy link

KarstenB commented May 8, 2024

Ok, maybe it is just me, but the simplest solution boils down to using the ring feature of rustls:

cargo add rustls --features ring

And then, early in your main fn call:

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

Correct?

@incker
Copy link
Author

incker commented May 18, 2024

Installing just gcc-multilib helped me
Thanks for everyone!

@incker incker closed this as completed May 18, 2024
@djc djc closed this as not planned Won't fix, can't repro, duplicate, stale May 18, 2024
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

No branches or pull requests

4 participants