373 Commits

Author SHA1 Message Date
Artyom Pavlov
abe7ef3107
Release v0.2.9 (#354) 2023-04-06 16:20:27 -07:00
Joe Richey
03defac1e5
ci: use minimal permissions for Github Actions (#351)
Fixes #348

we only need to read the contents of the repo to run our tests, no other
permissions are needed, as we currently do not publish via our CI jobs.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-03-24 19:30:06 -07:00
Joe Richey
8eb9c2d5a6
Merge pull request #350 from rust-random/android
Disable cross build/tests on Android
2023-03-24 14:35:47 -07:00
Joe Richey
5042b09742 Update wasm-pack
Signed-off-by: Joe Richey <joerichey@google.com>
2023-03-24 14:23:06 -07:00
Joe Richey
6cd1a12ef2 Disable cross build/tests on Android
Cross is currently broken on Android, see https://github.com/cross-rs/cross/issues/1222

The bug is fixed on master, but a new release of cross hasn't come out
yet.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-03-23 18:04:35 -07:00
Artyom Pavlov
41cc07a099
Switch the custom backend to Rust ABI (#347)
Closes #345

This change makes the code safe against potential panics in custom functions.
2023-03-13 21:14:47 -07:00
Joseph Richey
2f9989fba1
Move __getrandom_custom definition into a const block (#344)
This supersedes #341, and makes the following changes
  - All the code for implementing `__getrandom_custom` is now in an
    **named** `const` block (unnamed consts require Rust 1.37)
    - I found this approch [here](https://internals.rust-lang.org/t/anonymous-modules/15441)
    - Nothing inside the block can be referenced outside of it
  - `__getrandom_custom` is marked `unsafe`
    - It can't be accessed externally, but is "logically" unsafe as it
      dereferences raw pointers
  - The type of the function is moved to a typedef, so we can check that
    the defined type matches that of `getrandom:getrandom`.
  - Use `::core::result::Result` instead of `Result`
    - Similar to use use of `from_raw_parts_mut` this prevents
      compilation errors if `Result` is redefined.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-03-09 20:36:20 -08:00
Joseph Richey
75252bca49
ci: Fix the fuchsia tests (#343)
The target triple name was changed in https://github.com/rust-lang/rust/pull/106429

While `rustc` known the old spelling of the triple, `rustup` does not,
so the toolchain download was not working.

Signed-off-by: Joe Richey <joerichey@google.com>
2023-03-09 20:35:51 -08:00
Joseph Richey
41b89814e3
Allow Edge tests to fail (#339)
Window's `msedgedriver` seems to be unreliable, as port binding will
occasionally fail. Instead of wasting time trying to debug this, just
let the tests fail.

We take a similar approch for Safari's webdriver, we will allow the
tests to fail, but will hopefully see when they start succeeding (when
Safari fixes the COOP bug).

Signed-off-by: Joe Richey <joerichey@google.com>
2023-02-23 11:56:11 -08:00
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