File tree 5 files changed +32
-1
lines changed
5 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -316,6 +316,8 @@ jobs:
316
316
run : cargo build -Z build-std=core --target=x86_64-wrs-vxworks
317
317
- name : SOLID
318
318
run : cargo build -Z build-std=core --target=aarch64-kmc-solid_asp3
319
+ - name : Nintendo 3DS
320
+ run : cargo build -Z build-std=core --target=armv6k-nintendo-3ds
319
321
320
322
clippy-fmt :
321
323
name : Clippy + rustfmt
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ compiler_builtins = { version = "0.1", optional = true }
18
18
core = { version = " 1.0" , optional = true , package = " rustc-std-workspace-core" }
19
19
20
20
[target .'cfg(unix)' .dependencies ]
21
- libc = { version = " 0.2.64 " , default-features = false }
21
+ libc = { version = " 0.2.120 " , default-features = false }
22
22
23
23
[target .'cfg(target_os = "wasi")' .dependencies ]
24
24
wasi = " 0.10"
Original file line number Diff line number Diff line change
1
+ // Copyright 2021 Developers of the Rand project.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4
+ // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5
+ // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6
+ // option. This file may not be copied, modified, or distributed
7
+ // except according to those terms.
8
+
9
+ //! Implementation for Nintendo 3DS
10
+ use crate :: util_libc:: sys_fill_exact;
11
+ use crate :: Error ;
12
+
13
+ pub fn getrandom_inner ( dest : & mut [ u8 ] ) -> Result < ( ) , Error > {
14
+ sys_fill_exact ( dest, |buf| unsafe {
15
+ libc:: getrandom ( buf. as_mut_ptr ( ) as * mut libc:: c_void , buf. len ( ) , 0 )
16
+ } )
17
+ }
Original file line number Diff line number Diff line change 33
33
//! | Web Browser | `wasm32‑*‑unknown` | [`Crypto.getRandomValues`], see [WebAssembly support]
34
34
//! | Node.js | `wasm32‑*‑unknown` | [`crypto.randomBytes`], see [WebAssembly support]
35
35
//! | SOLID | `*-kmc-solid_*` | `SOLID_RNG_SampleRandomBytes`
36
+ //! | Nintendo 3DS | `armv6k-nintendo-3ds` | [`getrandom`][1]
36
37
//!
37
38
//! There is no blanket implementation on `unix` targets that reads from
38
39
//! `/dev/urandom`. This ensures all supported targets are using the recommended
@@ -223,6 +224,11 @@ cfg_if! {
223
224
} else if #[ cfg( all( feature = "js" ,
224
225
target_arch = "wasm32" , target_os = "unknown" ) ) ] {
225
226
#[ path = "js.rs" ] mod imp;
227
+ } else if #[ cfg( all( target_os = "horizon" , target_arch = "arm" ) ) ] {
228
+ // We check for target_arch = "arm" because the Nintendo Switch also
229
+ // uses Horizon OS (it is aarch64).
230
+ mod util_libc;
231
+ #[ path = "3ds.rs" ] mod imp;
226
232
} else if #[ cfg( feature = "custom" ) ] {
227
233
use custom as imp;
228
234
} else if #[ cfg( all( target_arch = "wasm32" , target_os = "unknown" ) ) ] {
Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ cfg_if! {
20
20
use libc:: __error as errno_location;
21
21
} else if #[ cfg( target_os = "haiku" ) ] {
22
22
use libc:: _errnop as errno_location;
23
+ } else if #[ cfg( all( target_os = "horizon" , target_arch = "arm" ) ) ] {
24
+ extern "C" {
25
+ // Not provided by libc: https://github.com/rust-lang/libc/issues/1995
26
+ fn __errno( ) -> * mut libc:: c_int;
27
+ }
28
+ use __errno as errno_location;
23
29
}
24
30
}
25
31
You can’t perform that action at this time.
0 commit comments