about summary refs log tree commit diff
path: root/library/std
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-07-13 07:21:19 +0200
committerGitHub <noreply@github.com>2025-07-13 07:21:19 +0200
commit5d5645972ffa96c1e2266d819fae27f9028f7be0 (patch)
tree6c09bda6858e00db56457b7d43cb4d097f4cc868 /library/std
parentb1d2f2c64c6254b2a935d6a2d29b68f4511cf500 (diff)
parent074846289a4f69d8057bc3ee7789728f560e1ec8 (diff)
downloadrust-5d5645972ffa96c1e2266d819fae27f9028f7be0.tar.gz
rust-5d5645972ffa96c1e2266d819fae27f9028f7be0.zip
Rollup merge of #143776 - no1wudi:fix, r=tgross35
std: move NuttX to use arc4random for random number generation

arc4random support in libc merged in https://github.com/rust-lang/libc/pull/4464, so:

* Move `target_os = "nuttx"` from unix_legacy to arc4random section
* This aligns NuttX with other POSIX-compliant systems that support arc4random
* Improves random number generation quality on NuttX by using the system's built-in arc4random implementation instead of legacy fallback methods

NuttX supports arc4random_buf which provides better entropy and security compared to the legacy random number generation methods.
Diffstat (limited to 'library/std')
-rw-r--r--library/std/src/sys/random/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/std/src/sys/random/mod.rs b/library/std/src/sys/random/mod.rs
index 013e886a99b..fc85797dcc2 100644
--- a/library/std/src/sys/random/mod.rs
+++ b/library/std/src/sys/random/mod.rs
@@ -20,6 +20,7 @@ cfg_if::cfg_if! {
         target_os = "rtems",
         target_os = "solaris",
         target_os = "vita",
+        target_os = "nuttx",
     ))] {
         mod arc4random;
         pub use arc4random::fill_bytes;
@@ -44,7 +45,6 @@ cfg_if::cfg_if! {
         target_os = "hurd",
         target_os = "l4re",
         target_os = "nto",
-        target_os = "nuttx",
     ))] {
         mod unix_legacy;
         pub use unix_legacy::fill_bytes;