Skip to content

Commit c0ea54e

Browse files
committed
Remove RtlGenRandom implementation
Also remove outdated comment from windows_uwp.rs
1 parent cadf11e commit c0ea54e

File tree

4 files changed

+4
-40
lines changed

4 files changed

+4
-40
lines changed

build.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ use std::env;
44

55
fn main() {
66
let target = env::var("TARGET").expect("TARGET was not set");
7-
if target.contains("-uwp-windows-") {
7+
if target.contains("windows") {
88
// for BCryptGenRandom
99
println!("cargo:rustc-link-lib=bcrypt");
10-
} else if target.contains("windows") {
11-
// for RtlGenRandom (aka SystemFunction036)
12-
println!("cargo:rustc-link-lib=advapi32");
1310
} else if target.contains("apple-ios") {
1411
// for SecRandomCopyBytes and kSecRandomDefault
1512
println!("cargo:rustc-link-lib=framework=Security");

src/lib.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
//! | Target | Target Triple | Implementation
1414
//! | ----------------- | ------------------ | --------------
1515
//! | Linux, Android | `*‑linux‑*` | [`getrandom`][1] system call if available, otherwise [`/dev/urandom`][2] after successfully polling `/dev/random` |
16-
//! | Windows | `*‑pc‑windows‑*` | [`RtlGenRandom`][3] |
17-
//! | [Windows UWP][22] | `*‑uwp‑windows‑*` | [`BCryptGenRandom`][23] |
16+
//! | Windows | `*‑pc‑windows‑*` | [`BCryptGenRandom`][3] |
1817
//! | macOS | `*‑apple‑darwin` | [`getentropy()`][19] if available, otherwise [`/dev/random`][20] (identical to `/dev/urandom`)
1918
//! | iOS | `*‑apple‑ios` | [`SecRandomCopyBytes`][4]
2019
//! | FreeBSD | `*‑freebsd` | [`getrandom()`][21] if available, otherwise [`kern.arandom`][5]
@@ -121,7 +120,7 @@
121120
//!
122121
//! [1]: http://man7.org/linux/man-pages/man2/getrandom.2.html
123122
//! [2]: http://man7.org/linux/man-pages/man4/urandom.4.html
124-
//! [3]: https://docs.microsoft.com/en-us/windows/desktop/api/ntsecapi/nf-ntsecapi-rtlgenrandom
123+
//! [3]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
125124
//! [4]: https://developer.apple.com/documentation/security/1399291-secrandomcopybytes?language=objc
126125
//! [5]: https://www.freebsd.org/cgi/man.cgi?query=random&sektion=4
127126
//! [6]: https://man.openbsd.org/getentropy.2
@@ -139,8 +138,6 @@
139138
//! [19]: https://www.unix.com/man-page/mojave/2/getentropy/
140139
//! [20]: https://www.unix.com/man-page/mojave/4/random/
141140
//! [21]: https://www.freebsd.org/cgi/man.cgi?query=getrandom&manpath=FreeBSD+12.0-stable
142-
//! [22]: https://docs.microsoft.com/en-us/windows/uwp/
143-
//! [23]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
144141
145142
#![doc(
146143
html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png",
@@ -201,10 +198,8 @@ cfg_if! {
201198
} else if #[cfg(target_os = "vxworks")] {
202199
mod util_libc;
203200
#[path = "vxworks.rs"] mod imp;
204-
} else if #[cfg(all(windows, target_vendor = "uwp"))] {
205-
#[path = "windows_uwp.rs"] mod imp;
206201
} else if #[cfg(windows)] {
207-
#[path = "windows.rs"] mod imp;
202+
#[path = "windows_uwp.rs"] mod imp;
208203
} else if #[cfg(all(target_arch = "x86_64", target_env = "sgx"))] {
209204
#[path = "rdrand.rs"] mod imp;
210205
} else if #[cfg(all(feature = "rdrand",

src/windows.rs

-26
This file was deleted.

src/windows_uwp.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9-
//! Implementation for Windows UWP targets. After deprecation of Windows XP
10-
//! and Vista, this can supersede the `RtlGenRandom`-based implementation.
119
use crate::Error;
1210
use core::{ffi::c_void, num::NonZeroU32, ptr};
1311

0 commit comments

Comments
 (0)