Commit Graph

160 Commits

Author SHA1 Message Date
Joe Richey ff6299dd77 cpu: Add support for CPU-based randomness
This allows freestanding targets to use getrandom.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-02-19 10:21:58 -08:00
Joe Richey cd84484205 target: Drop support for some x86_64 targets
We will use a more generic "cpu" mechanism to support these.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-02-19 10:21:58 -08:00
Joe Richey 4263ac6bc4 custom: Allow no_std custom RNG handlers
Signed-off-by: Joe Richey <joerichey@google.com>
2020-02-19 10:21:58 -08:00
Joe Richey 8365277450 custom: Add Custom RNG for wasm-bindgen 2020-01-10 09:16:20 +00:00
Joe Richey 7d558f1cc3 custom: Add custom RNG for stdweb 2020-01-10 09:16:20 +00:00
Joe Richey 3d7a7b5f06 Remove built-in support for wasm32-unknown-unknown 2020-01-10 09:16:20 +00:00
Joe Richey 448bcac6b1 custom: Add support for Custom RNGs 2020-01-10 09:16:20 +00:00
Joseph Richey d6b75d1c05 log: Remove optional log dependancy (#131)
This feature isn't enabled by rand/rand_core and provides very little
error information that isn't already conveyed through our Error values.

This also simplifies the supported configuration space for getrandom.
We update the docs and CI to match this change.
2020-01-09 13:27:09 -08:00
Joe Richey 0f14f2a186 Merge branch 'master' into 0.2
Signed-off-by: Joe Richey <joerichey@google.com>
2020-01-08 11:11:08 -08:00
Artyom Pavlov 33b859bae1 Prepare release v0.1.14 (#128) 2020-01-07 12:05:23 +00:00
Joe Richey c5e2025d2c util: Remove unused spin-lock interfaces
We no longer use spin-locks anywhere in getrandom, so remove any
interfaces which spin.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-01-07 11:06:56 +00:00
Joe Richey 46963aac74 use_file: Remove use of spin-locks
Don't spin when polling /dev/random. We also remove the use of spin
locks when opening the persistent fd for platforms that require it.

For both these cases, we can just use the pthread lock/unlock methods
in libc. This includes adding Mutex and DropGuard abstractions.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-01-07 11:06:56 +00:00
Joe Richey 245b5b2121 util_libc: open_readonly shoud return a Result
Signed-off-by: Joe Richey <joerichey@google.com>
2020-01-07 11:06:56 +00:00
Joseph Richey a913c9c673 dragonfly: Don't try to read errno value (#129) 2020-01-07 03:54:43 +00:00
Joseph Richey 48781cd9ec wasi: Update and Fix Travis failures (#126) 2020-01-05 20:59:50 +00:00
Joseph Richey 8096bac100 0.2: Error and Testing improvements (#120) 2019-10-28 08:06:05 +00:00
Joseph Richey cf2d81bfff Improve src/lib.rs cfgs (#119)
Right now for each of `util_libc` and `use_file` we have a list of
`target_os` configs to determine if we build the module.

This PR moves these mod declarations into the main `cfg_if` statement
(the one that selects which implementation we use). This way, the mod
statements are kept in-sync with the implementations that use them.

Also, I merged together `target_os` cfgs that have the same
implementation. The downside to this is that the targets are no longer
in alphabetical order.

Also, this is only being applied to `0.2` as the `0.1` cfgs still have
to keep `std` around.
2019-10-25 12:55:12 +00:00
Artyom Pavlov d661aa7e1b Prepare release v0.1.13 (#118) 2019-10-25 12:25:33 +00:00
Joe Richey 1f1f964e4a Merge branch 'master' into 0.2 2019-10-24 02:10:00 -07:00
Joseph Richey 81bd43e5d6 Fix typos and bad doc links. (#117) 2019-10-24 02:06:53 -07:00
Artyom Pavlov 9a385f1923 Add VxWorks support (#86) 2019-10-23 09:35:50 +00:00
nia 2fa1bbac80 Switch to using the arandom sysctl on NetBSD (same as FreeBSD). (#115)
Rename it from freebsd.rs to sysctl_arandom.rs.

NetBSD has been patching rustc for some time to use the FreeBSD
implementation because every single invocation of the compiler
may drain from the entropy pool and cause the next to block.

This can massively inflate build times for rust software, or cause
it to fail entirely, especially in VMs (for example, our Xen package
building cluster).
2019-10-23 09:03:44 +00:00
Joseph Richey add45a3899 Remove dummy implementation (#107)
Removes the “dummy” feature and “wasm32-unknown-unknown” dummy impl
2019-10-15 23:40:05 -07:00
Joseph Richey 605736748a Only impl std traits if feature is specified (#106)
* Fix CI to allow for PRs against 0.2 to be run

* Only impl std traits if feature is specified

* Fix l4re
2019-10-15 23:40:05 -07:00
Diggory Hardy 6b4925a76d Merge pull request #112 from dekellum/min-cfg-if
cfg-if 0.1.2 is minimal version of dependency
2019-10-01 08:43:28 +01:00
Diggory Hardy 7f013b15d8 Merge pull request #114 from josephlr/ci
Fix and Improve WASM CI
2019-10-01 08:39:45 +01:00
Joe Richey 04f65172f5 Remove jq dep 2019-09-30 16:20:13 -07:00
Joe Richey 93312bdca7 Fix CI
- Use latest Firefox
- Explicitly pin wasmtime and cargo-web
- Make sure our `wasm-bindgen-test-runner` and `wasm-bindgen` versions match
2019-09-30 15:45:23 -07:00
David Kellum 2052159fd1 cfg-if 0.1.2 needed as minimal version of dep 2019-09-30 14:06:16 -07:00
Diggory Hardy 6bd6e048ca Merge pull request #111 from josephlr/fmt
Run Rustfmt
2019-09-23 20:48:10 +01:00
Joe Richey 3b6c90ca24 Run Rustfmt and make formatting error fail the CI 2019-09-23 10:21:23 -07:00
Joseph Richey fa6f929aed Improve CI for web targets (#108)
* Simplify CI process for WASM

Run WASI tests, and run both stdweb/wasm-bindgen on both node and in browsers

These changes also remove the need for a separate tests/wasm_bindgen

* Use all pre-built binaries in the CI

* Fix Cargo.toml typo

Co-Authored-By: Artyom Pavlov <newpavlov@gmail.com>

* Fix install location

* Debug CI
2019-09-21 01:46:26 -07:00
Elichai Turkel ccc47748d0 Handle zero-length slices (#104)
Ensure and document that we do nothing when an empty slice is passed.

Note that this changes are for consistency, not to prevent UB.
2019-09-19 16:41:20 -07:00
Artyom Pavlov 5cfa668403 Prepare release v0.1.12 (#103) 2019-09-06 12:01:01 +00:00
Artyom Pavlov 31e5b2fdd6 Update wasi dependency (#100) 2019-08-31 14:32:18 +00:00
Artyom Pavlov 208b318ace Prepare release v0.1.11 (#97) 2019-08-25 02:28:06 +00:00
Joseph Richey 4db1b14074 Fix Redox CI (#85)
* Fix Redox CI

* Bump libc version to fix Redox
2019-08-24 19:23:36 -07:00
Joseph Richey 8197a1824b Add back in std-only trait definitions (#96) 2019-08-24 23:00:44 +00:00
Artyom Pavlov a9b7f92965 Prepare release v0.1.10 (#93) 2019-08-17 23:27:45 +00:00
eV (㋎) f073a9575a Fix CSP error for wasm bindgen (#92) 2019-08-17 23:23:07 +00:00
Joseph Richey 73bbbdcf64 Always build on wasm32-unknown-unknown (#90)
This updates the documentation to explain exactly what we are doing on
this target. Also adds a test that the target builds without features.
2019-08-17 12:24:02 -07:00
Joseph Richey 3d1d2ff313 Wasi does not need libc (#88) 2019-08-15 00:10:22 +00:00
Artyom Pavlov e266249f61 Prepare release v0.1.9 (#83) 2019-08-14 13:55:27 +00:00
Artyom Pavlov bf54eaa557 Deny warnings in CI tests (#82) 2019-08-13 13:52:50 +00:00
Joseph Richey f94b44aa86 Add warning checks (#80) 2019-08-12 13:10:21 +00:00
Artyom Pavlov 7449a087f2 Add dummy feature (#71) 2019-08-08 14:31:41 +00:00
Artyom Pavlov 283f9f8bad Add Windows UWP support (#69) 2019-08-08 14:31:21 +00:00
Artyom Pavlov 86c2cd6265 Use wasi isntead of libc (#64) 2019-08-08 08:02:19 +00:00
Clayton Wilkinson 10e41b22d6 Updating link to Fuchsia documentation (#81) 2019-08-07 16:15:37 +00:00
Joseph Richey 98934cb4ab Add rustc-dep-of-std feature (#78) 2019-08-06 10:08:16 +00:00