PSA: Release of getrandom v0.3.0-rc.0

getrandom is a Rust library for retrieving random data from (operating) system sources. Most users rely on it implicitly via higher-level crates like rand.

We plan to use getrandom v0.3 (crate docs) as a dependency for the upcoming rand v0.9 release. The new getrandom release includes important changes that may affect downstream users. To ensure that users are aware of these changes, we aim to draw attention to the new release with the release candidate.

The most significant change is the handing of optional backends, particularly for Web WASM. Previously, we used the js crate feature to enable wasm-bindgen-based backend. For various reasons, we have replaced it with the getrandom_backend configuration flag. This new flag not only allows users to select the backend but also permits overwriting the default backend, which was previously restricted for security reasons. For more information, please refer to the relevant documentation section.

Full changelog:

Breaking Changes

Changed

  • Bump MSRV to 1.63 #542
  • Rename getrandom and getrandom_uninit functions to fill and fill_uninit respectively #532

Removed

  • wasm32-wasi target support (use wasm32-wasip1 or wasm32-wasip2 instead) #499
  • linux_disable_fallback, rdrand, js, test-in-browser, and custom crate features
    in favor of configuration flags #504
  • register_custom_getrandom! macro #504
  • Implementation of From<NonZeroU32> for Error and Error::code method #507

Changed

  • Use ProcessPrng on Windows 10 and up, and use RtlGenRandom on older legacy Windows versions #415
  • Do not use locale-specific strerror_r for retrieving error code descriptions #440
  • Avoid assuming usize is the native word size in the rdrand backend #442
  • Do not read from errno when libc did not indicate error on Solaris #448
  • Switch from libpthread's mutex to futex on Linux and to nanosleep-based wait loop
    on other targets in the use_file backend #490
  • Do not retry on EAGAIN while polling /dev/random on Linux #522

Added

  • wasm32-wasip1 and wasm32-wasip2 support #499
  • getrandom_backend configuration flag for selection of opt-in backends #504
  • Error::new_custom method #507
  • rndr opt-in backend #512
  • linux_rustix opt-in backend #520
  • Memory sanitizer support gated behind getrandom_sanitize configuration flag #521
  • u32 and u64 functions for generating random values of the respective type #544
4 Likes