From a55ea8dcb8daef83a95603e77a563a346b4a2785 Mon Sep 17 00:00:00 2001 From: Yuyi Wang Date: Tue, 22 Apr 2025 19:53:24 +0800 Subject: [PATCH 1/2] Backport Cygwin support (#654) --- CHANGELOG.md | 6 ++++++ src/lib.rs | 4 ++++ src/util_libc.rs | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b6763b58..b20634ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.2.16] - 2025-04-22 +### Added +- Backport cygwin support [#654] + +[#654]: https://github.com/rust-random/getrandom/pull/654 + ## [0.2.15] - 2024-05-06 ### Added - Apple visionOS support [#410] diff --git a/src/lib.rs b/src/lib.rs index bc3695b6..22bffd32 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,7 @@ //! | PS Vita | `*-vita-*` | [`getentropy`][13] //! | QNX Neutrino | `*‑nto-qnx*` | [`/dev/urandom`][14] (identical to `/dev/random`) //! | AIX | `*-ibm-aix` | [`/dev/urandom`][15] +//! | Cygwin | `*-cygwin` | [`getrandom`][19] (based on [`RtlGenRandom`]) //! //! Pull Requests that add support for new targets to `getrandom` are always welcome. //! @@ -181,8 +182,10 @@ //! [16]: https://man.netbsd.org/getrandom.2 //! [17]: https://www.gnu.org/software/libc/manual/html_mono/libc.html#index-getrandom //! [18]: https://github.com/rust3ds/shim-3ds/commit/b01d2568836dea2a65d05d662f8e5f805c64389d +//! [19]: https://github.com/cygwin/cygwin/blob/main/winsup/cygwin/libc/getentropy.cc //! //! [`BCryptGenRandom`]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom +//! [`RtlGenRandom`]: https://learn.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom //! [`Crypto.getRandomValues`]: https://www.w3.org/TR/WebCryptoAPI/#Crypto-method-getRandomValues //! [`RDRAND`]: https://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide //! [`CCRandomGenerateBytes`]: https://opensource.apple.com/source/CommonCrypto/CommonCrypto-60074/include/CommonRandom.h.auto.html @@ -251,6 +254,7 @@ cfg_if! { // Check for target_arch = "arm" to only include the 3DS. Does not // include the Nintendo Switch (which is target_arch = "aarch64"). all(target_os = "horizon", target_arch = "arm"), + target_os = "cygwin", ))] { mod util_libc; #[path = "getrandom.rs"] mod imp; diff --git a/src/util_libc.rs b/src/util_libc.rs index 129362d5..f488b415 100644 --- a/src/util_libc.rs +++ b/src/util_libc.rs @@ -9,7 +9,7 @@ use core::{ use libc::c_void; cfg_if! { - if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android"))] { + if #[cfg(any(target_os = "netbsd", target_os = "openbsd", target_os = "android", target_os = "cygwin"))] { use libc::__errno as errno_location; } else if #[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "hurd", target_os = "redox", target_os = "dragonfly"))] { use libc::__errno_location as errno_location; From ce4144b2c16fe1422037c93e267e6a52336e0834 Mon Sep 17 00:00:00 2001 From: Artyom Pavlov Date: Tue, 22 Apr 2025 23:23:57 +0400 Subject: [PATCH 2/2] Release v0.2.16 (#655) ## [0.2.16] - 2025-04-22 ### Added - Cygwin support (backport of [#626]) [#654] [#626]: https://github.com/rust-random/getrandom/pull/626 [#654]: https://github.com/rust-random/getrandom/pull/654 [0.2.16]: https://github.com/rust-random/getrandom/compare/v0.2.15...v0.2.16 --- CHANGELOG.md | 4 +++- Cargo.toml | 2 +- src/lib.rs | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b20634ff..209d2e98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [0.2.16] - 2025-04-22 ### Added -- Backport cygwin support [#654] +- Cygwin support (backport of [#626]) [#654] +[#626]: https://github.com/rust-random/getrandom/pull/626 [#654]: https://github.com/rust-random/getrandom/pull/654 ## [0.2.15] - 2024-05-06 @@ -460,6 +461,7 @@ Publish initial implementation. ## [0.0.0] - 2019-01-19 Publish an empty template library. +[0.2.16]: https://github.com/rust-random/getrandom/compare/v0.2.15...v0.2.16 [0.2.15]: https://github.com/rust-random/getrandom/compare/v0.2.14...v0.2.15 [0.2.14]: https://github.com/rust-random/getrandom/compare/v0.2.13...v0.2.14 [0.2.13]: https://github.com/rust-random/getrandom/compare/v0.2.12...v0.2.13 diff --git a/Cargo.toml b/Cargo.toml index 4de6dcfd..0365734d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "getrandom" -version = "0.2.15" # Also update html_root_url in lib.rs when bumping this +version = "0.2.16" # Also update html_root_url in lib.rs when bumping this edition = "2018" authors = ["The Rand Project Developers"] license = "MIT OR Apache-2.0" diff --git a/src/lib.rs b/src/lib.rs index 22bffd32..68b5af98 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -204,7 +204,7 @@ #![doc( html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk.png", html_favicon_url = "https://www.rust-lang.org/favicon.ico", - html_root_url = "https://docs.rs/getrandom/0.2.15" + html_root_url = "https://docs.rs/getrandom/0.2.16" )] #![no_std] #![warn(rust_2018_idioms, unused_lifetimes, missing_docs)]