Skip to content

Windows 7 support? Missing ProcessPrng #1997

@0blu

Description

@0blu

Problem:

I actually came here from aws-lc-rust. I tried to use the following minimal example with x86_64-win7-windows-msvc but as soon as the library tries to access ProcessPrng the program aborts.

use aws_lc_rs::rand::{SecureRandom, SystemRandom};

fn main() {
    let rng = SystemRandom::new();

    let mut buffer = [0u8; 32];
    println!("Going to fill bytes...");
    if rng.fill(&mut buffer).is_err() { // <-- Crash in `init_processprng`
        println!("Error filling random bytes");
    } else {
        println!("Everything is okay");
    }
}

Erroneous line:

g_processprng_fn = (ProcessPrngFunction)(void(*)(void))GetProcAddress(hmod, "ProcessPrng");

Solution:

Rust recently switched from BCryptGenRandom to ProcessPrng but allowed a path for Windows 7.
rust-lang/rust#121337

Is a similar solution also possible in this project?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions