briansmith / ring

Safe, fast, small crypto using Rust
Other
3.64k stars 683 forks source link

Attempted to use functionality that requires system randomness!! #2025

Closed gcp-development closed 2 months ago

gcp-development commented 2 months ago

Hello,

In theory I should not get this message. if I am using the feature "less-safe-getrandom-custom-or-rdrand" for a xtensa-esp32s3-espidf (STD).

I am wrong ? Should I go via the old fashioned way and use esp_fill_random ?

Make less-safe work on espidf #1944

ring = { git = "https://github.com/briansmith/ring.git", branch="master", default-features = false,  features = ["alloc", "less-safe-getrandom-custom-or-rdrand"] }
#[cfg(any(
    all(feature = "less-safe-getrandom-custom-or-rdrand", any(target_os = "none", target_os = "espidf")),
    target_os = "aix",
    target_os = "android",
    target_os = "dragonfly",
    target_os = "freebsd",
    target_os = "haiku",
    target_os = "hermit",
    target_os = "illumos",
    target_os = "ios",
    target_os = "linux",
    target_os = "macos",
    target_os = "netbsd",
    target_os = "openbsd",
    target_os = "redox",
    target_os = "solaris",
    target_os = "tvos",
    target_os = "vita",
    target_os = "windows",
    all(
        target_arch = "wasm32",
        any(
            target_os = "wasi",
            all(target_os = "unknown", feature = "wasm32_unknown_unknown_js")
        )
    ),
))]
impl sealed::SecureRandom for SystemRandom {
    #[inline(always)]
    fn fill_impl(&self, dest: &mut [u8]) -> Result<(), error::Unspecified> {
        getrandom::getrandom(dest).map_err(|_| error::Unspecified)
    }
}
lorenzo-pirchio commented 1 month ago

Hi @gcp-development , have you fixed your problem? I'm working on a project for xtensa-esp32s3-espidf as well, but when I add rustls as dependency in cargo.toml, I have problems with ring. I have different warnings: