From 232c230d4f8490a83fc55eae3c0e86424502bcbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Thu, 8 Jan 2026 00:33:41 +0300 Subject: [PATCH 1/2] windows: fix `BCryptGenRandom` signature --- src/windows.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/windows.rs b/src/windows.rs index 2d1c48351..fa4ba03cf 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -11,7 +11,7 @@ extern "system" { pBuffer: *mut u8, cbBuffer: u32, dwFlags: u32, - ) -> u32; + ) -> i32; } // Forbidden when targetting UWP @@ -34,6 +34,7 @@ pub fn getrandom_inner(dest: &mut [MaybeUninit]) -> Result<(), Error> { BCRYPT_USE_SYSTEM_PREFERRED_RNG, ) }; + let ret = ret as u32; // NTSTATUS codes use the two highest bits for severity status. if ret >> 30 == 0b11 { // Failed. Try RtlGenRandom as a fallback. From df2712b7fa65cbfdeede247004b14dcd5edd43e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=9F=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=BE=D0=B2=20=5BArtyom=20Pavlov=5D?= Date: Thu, 8 Jan 2026 00:37:25 +0300 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 209d2e989..19aea09c5 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.17] - unreleased +### Fixed +- `BCryptGenRandom` signature [#778] + +[#778]: https://github.com/rust-random/getrandom/pull/778 + ## [0.2.16] - 2025-04-22 ### Added - Cygwin support (backport of [#626]) [#654] @@ -461,6 +467,7 @@ Publish initial implementation. ## [0.0.0] - 2019-01-19 Publish an empty template library. +[0.2.17]: https://github.com/rust-random/getrandom/compare/v0.2.16...v0.2.17 [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