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>
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>
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>
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>
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>
* 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>
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>
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>
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>
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
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>