Commit Graph

364 Commits

Author SHA1 Message Date
Joseph Richey 74a2021ee1 ci: Don't use rust-cache for Cross Build/Link (#338)
I think the caching isn't interacting well with the libc build script.

Lets see if this fixes things.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-22 13:01:58 -08:00
Chris H-C c526c898b3 Add in a RtlGenRandom fallback for non-UWP Windows (#337)
* Add in a RtlGenRandom fallback for non-UWP Windows

In some instances BCryptRandom will fail when RtlGenRandom will work.
On UWP, we might be unable to actually use RtlGenRandom.

Thread the needle and use RtlGenRandom when we have to, when we're able.

See also rust-lang/rust#108060

Fixes #314

* style suggestion

Co-authored-by: Artyom Pavlov <newpavlov@gmail.com>

* appease clippy

---------

Co-authored-by: Artyom Pavlov <newpavlov@gmail.com>
2023-02-22 12:42:52 -08:00
Artyom Pavlov 7c83ea0e57 Hermit: use sys_read_entropy syscall (#333)
* Hermit: use sys_read_entropy syscall

* Add doc link
2023-02-09 14:00:32 -08:00
Joseph Richey c65522b5c6 Merge pull request #336 from rust-random/ci
Reenable cross build/link tests and update cross
2023-02-09 03:29:01 -08:00
Joe Richey 8d8a882eb6 Move Web Tests to Ubuntu 22.04
Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 17:12:14 -08:00
Joe Richey a2b48866b9 Reenable cross build/link tests and update cross
My not caching the build results, we should hopefuly prevent the linking
errors we were seeing before.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 17:02:53 -08:00
Joseph Richey 8e46d0c055 Merge pull request #335 from rust-random/rdrand
rdrand: Remove checking for 0 and !0 and instead check CPU family and do a self-test
2023-02-08 16:24:46 -08:00
Joe Richey 5f7aadf0ea Make rdrand_exact #[target_feature(enable = "rdrand")]
Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 14:42:06 -08:00
Joe Richey 6a3fac8a01 Remove comment implying this code only runs on SGX
Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 14:42:06 -08:00
Joe Richey f39423084c Use !0 instead of usize::MAX
We could use core::usize::MAX, but that is deprecated.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 14:42:06 -08:00
Joe Richey 82c3cb8901 rdrand: Add CPUID feature detection and self-test
Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 14:42:06 -08:00
Joe Richey c4f7f45351 rdrand: Remove check for 0 and !0 values
Also makes rdrand() return an integer instead of an array of bytes. This
will make the self-test implementation easier. As we can just return a
`usize` we no longer need the `WORD_SIZE` constant.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 14:42:06 -08:00
Joe Richey a56faa8ca5 Use correct flag name
The flag name is +rdrand not +rdrnd

Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-08 14:42:06 -08:00
Artyom Pavlov 9ceb7e56ec Eliminate potential panic in sys_fill_exact (#334) 2023-01-27 15:30:37 -08:00
Joseph Richey 6536b9e60c Remove #cfg from bsd_arandom.rs (#332)
Followup to #331, we don't need the condidtional compilation anymore,
because this file is only used if
`any(target_os = "freebsd", target_os = "netbsd")` anyway.

Also cleans up `use` statements and type declarations to look like those
in macos.rs

Signed-off-by: Joe Richey <joerichey@google.com>
2023-01-26 12:13:27 -08:00
Tobias Klauser 6e3bbdebaa Add support for getrandom syscall on NetBSD ≥ 10.0 (#331)
NetBSD supports the getrandom system call since version 10.0 [1].
Use it if available, otherwise fall back to kern.arandom like on FreeBSD.

[1] https://man.netbsd.org/getrandom.2
2023-01-25 17:10:56 +00:00
Khem Raj 7f73e3ccc1 Use open instead of open64 (#326)
glibc is providing open64 and other lfs64 functions but musl aliases
them to normal equivalents since off_t is always 64-bit on musl,
therefore check for target env along when target OS is linux before
using open64, this is more available. Latest Musl has made these
namespace changes [1]

There is no need for using LFS64 open explicitly as we are only using it
for opening device files and not real files

[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Signed-off-by: Khem Raj <raj.khem@gmail.com>
2023-01-06 08:43:34 +00:00
Artyom Pavlov 698a6d1a06 Disable cross build/link tests (#328) 2023-01-04 00:44:52 -08:00
Kian-Meng Ang ea5ef25714 Fix typos (#327) 2023-01-04 06:58:29 +00:00
Qiu Chaofan e0e406df8a Support random file of AIX (#282) 2022-12-30 10:44:40 +00:00
Joseph Richey beb65e241e Merge pull request #325 from flba-eb/add_qnx_nto_support
Add QNX/nto support
2022-12-23 23:49:19 -08:00
Florian Bartels 993505c17f Enable tests for QNX/Neutrino, integrate new libc version 2022-12-23 07:50:53 +01:00
Florian Bartels 52c2780646 Add QNX/nto support 2022-11-15 08:43:26 +01:00
Joseph Richey 759a9d743c Merge pull request #324 from rust-random/ci
Improve CI and update runners
2022-10-31 13:28:04 -07:00
Joe Richey f096c04523 Update all runners to macOS 12
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:09:06 -07:00
Joe Richey 2e66e5921f Programaticly select iOS simulator Runtime/Device
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:09:06 -07:00
Joe Richey 62e697f9ca Run web tests on 20.04
This is necessary to get Firefox to work.

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:09:06 -07:00
Joe Richey b04bd03e14 Explicitly use windows-2022
Currently this is the same as `windows-latest` so this is not a
functional change.

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:09:06 -07:00
Joe Richey 9d4a91f9a1 Remove workaround not needed on Ubuntu 22.04
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:09:06 -07:00
Joe Richey 941c2fff69 Update tests to run on Ubuntu 22.04 (instead of 20.04)
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:09:06 -07:00
Joe Richey 5ddec2a8f4 Check OS using runner.os instead of matrix.os
This makes it easier to later update the OS verions

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:09:06 -07:00
Joe Richey 8e4ecdb72f Use "host" instead of "target" in Web Tests
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-31 00:08:59 -07:00
Joseph Richey 5a4a8eafe5 Fix iOS simulator CI (#323)
The upgrade to macOS 12 broke this iOS simulator CI (as support for the
iPhone 7 was dropped I think).

We should have a follow up PR to see if we can just test against a more
recent iPhone.

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-30 20:31:26 -07:00
Jared Ramon Elizan 8b36b3e634 README.md (#322)
fixed typo
2022-10-30 17:13:52 -07:00
Joseph Richey c93c2603f0 Merge pull request #321 from rust-random/webtest
CI: Add Web Tests for Edge on Windows
2022-10-26 01:23:35 -07:00
Joe Richey c3d9797a0b Just Pin Versions for compiled downloads
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-25 23:44:36 -07:00
Joe Richey 03f6688195 Cleanup other binary download steps
Be consistent and always use wget

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-25 23:31:56 -07:00
Joe Richey f84a061151 Add additional Web Tests
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-25 23:05:32 -07:00
Joseph Richey 8e44d13ebf Merge pull request #317 from thomcc/tvos-watchos
Add tvOS and watchOS support, identical to iOS support
2022-10-25 02:50:29 -07:00
Thom Chiovoloni e32ea822c3 Add tvOS and watchOS to CI 2022-10-24 23:24:56 -07:00
Thom Chiovoloni e6ed8e1a55 Add tvOS and watchOS support, identical to iOS support 2022-10-24 18:21:50 -07:00
Joseph Richey 2aabb63d2c Merge pull request #316 from rust-random/ci
CI: Run iOS targets and other improvements
2022-10-24 12:22:23 -07:00
Joe Richey 4917673cd2 Break up Tier 3 builds
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-24 01:56:17 -07:00
Joe Richey b35add2bb7 Uptade to Swatinem/rust-cache@v2
Also move the cache step to be right before we start running cargo
commands.

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-24 01:56:17 -07:00
Joe Richey a91ad48d8c Update to actions/checkout@v3
Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-24 01:56:17 -07:00
Joe Richey b1da11b850 Run iOS Simulator Tests
This builds, links, and runs the tests on `x86_64-apple-ios` using
[`dinghy`](https://github.com/sonos/dinghy). It moves the targets
which only Build/Link to their own job.

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-24 01:56:10 -07:00
Joe Richey 14b461fa39 Make job names consistent
This makes it easier to tell on which targets we:
  - Build
  - Link
  - Run

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-24 01:50:03 -07:00
Joe Richey 762c95dd7a Move from actions-rs/toolchain to dtolnay/rust-toolchain
The current action we are using is unmantained:
https://github.com/actions-rs/toolchain/issues/216

This replacement is faster, smaller, and more cachable.

We can also completely remove the toolchain step when testing with
cross, as cross handles configuration of its own toolchain.

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-23 21:32:21 -07:00
Joseph Richey 52a4c3cbad Remove buffer zeroing from Node.js implementation (#315)
We can use
[`Uint8Array::view_mut_raw`](https://rustwasm.github.io/wasm-bindgen/api/js_sys/struct.Uint8Array.html#method.view_mut_raw)
which was
[added](https://github.com/rustwasm/wasm-bindgen/pull/1850) in version
`0.2.54` of `wasm-bindgen`. This method was introduced to deal with
uninitialized memory, see the Safety comment for more info.

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-23 16:22:28 -07:00
Joseph Richey 710b24dd27 Use getentropy on Emscripten (#307)
Signed-off-by: Joe Richey <joerichey@google.com>

Signed-off-by: Joe Richey <joerichey@google.com>
2022-10-23 15:09:31 -07:00