Skip to content

Commit f8e4746

Browse files
committed
Add arc4random and arc4random_buf to NuttX
* Declare `arc4random` and `arc4random_buf` as extern "C" functions in the NuttX module * Enable access to system-provided random number generation for NuttX targets * Aligns NuttX FFI with other Unix platforms that expose these functions This change allows Rust code targeting NuttX to use `arc4random` and `arc4random_buf` for secure random number generation, improving compatibility and feature parity with other targets.
1 parent 1ee0549 commit f8e4746

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/unix/nuttx/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,4 +591,6 @@ extern "C" {
591591
pub fn pthread_setname_np(thread: pthread_t, name: *const c_char) -> i32;
592592
pub fn pthread_getname_np(thread: pthread_t, name: *mut c_char, len: usize) -> i32;
593593
pub fn getrandom(buf: *mut c_void, buflen: usize, flags: u32) -> isize;
594+
pub fn arc4random() -> u32;
595+
pub fn arc4random_buf(bytes: *mut c_void, nbytes: usize);
594596
}

0 commit comments

Comments
 (0)