Commit Graph

210 Commits

Author SHA1 Message Date
Joe Richey 5d2a4a2e56 Update Changelog for 0.2
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 03:18:46 -07:00
Joe Richey 5f4886bce1 Merge branch 'master' into 0.2 2020-09-10 00:57:38 -07:00
Joe Richey b9299988ea docs: add target triple to docs table
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey e0c155e201 docs: Clarify deps of root binary crate
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey b8c0c8d006 custom: Add check for function type
This makes sure we get a good compiler error if we give a bad path.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey 1ebd2ce0e3 docs: Clarify intended usage for Custom RNGs
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey a6fa63c607 docs: Update section headers
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey bf6d124d53 travis: Make sure to run docs tests for all features
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey b4160604d7 docs: Clarify when/where to use custom implementations
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey e8ff222285 docs: Update wasm32 support section
Include more links, exampales, and clarify wording

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey 4f4009a10f Format compile_error!
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey 99260dfaef Update docs for 0.2
The main things here are clarifying how fallback functionatliy works.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-10 00:45:13 -07:00
Joe Richey 4d750dd240 travis: Enable Firefox testing
https://github.com/rustwasm/wasm-bindgen/pull/2305 released the bugfix for wasm-bindgen.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-09 00:53:31 -07:00
Joe Richey c36dc821e1 travis: Stop pinning nightly on 0.2
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 06:02:32 -07:00
Joe Richey 7dcb167694 travis: Stop Pinning nightly
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 05:53:45 -07:00
Joe Richey 9ec7d217a8 travis: Move cloudabi to xbuild section
Cloud ABI [is now Tier 3](https://github.com/rust-lang/rust/pull/75568),
so its libstd is no longer distributed with Rust.

Firefox testing is also disabled due to:
  https://github.com/rustwasm/wasm-bindgen/issues/2261

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 05:53:45 -07:00
Joe Richey d8679fbf5e travis: Update pinned dependancies
Also, pin the version of rustc, so that nightly updates don't break
our build. This means that we can add the nightlies back into the
blocking set of tests.

Update the Ubuntu version to 20.04
Don't run any cargo-web tests (upstream is broken)

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 05:53:45 -07:00
Joe Richey 0a5017eadb Update MSRV to 1.34
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 05:31:43 -07:00
Joe Richey 2723e7f1d7 travis: Apply #157 to 0.2 branch
Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 03:08:19 -07:00
Joe Richey 24e588619e bsd_arandom: Read only 256 bytes at a time
Older NetBSD kernels cannot handle buffers bigger than 256 bytes, and
all FreeBSD and NetBSD kernels only return up to 256 bytes per call.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-08-14 05:04:08 -07:00
Joe Richey fc83790262 rustfmt: Run cargo fmt 2020-07-21 21:08:56 -07:00
Artyom Pavlov 2b03b0e0b8 Remove workaround for older Linux kernels
Minimum supported kernel version got bumped to 2.6.32 in rust-lang/rust#74163
2020-07-21 20:52:02 -07:00
Joe Richey f6af828725 ci: Remove old reference to wasm-bindgen-getrandom
Signed-off-by: Joe Richey <joerichey@google.com>
2020-07-21 13:31:17 -07:00
Joe Richey 706a4298fc stdweb: Remove CI runs with cargo-web
Right now "cargo web test" is broken due to upstream changes. We will
disable stdweb tests until the stdweb project fixes things.

See: https://github.com/koute/cargo-web/issues/243

Signed-off-by: Joe Richey <joerichey@google.com>
2020-07-21 13:31:17 -07:00
Joe Richey 11b4f9e406 wasm: Update testing framework
Add back the "test-in-browser" feature. This makes it easier to manage
a single file containing all of the test code.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-29 01:11:13 -07:00
Joe Richey eacffd578a wasm: Move JS-based Custom RNGs back into the main crate
They will be gated behind the "js" feature, as we can now do detect,
at compile-time, which implementation (wasm-bindgen vs stdweb) we
should use.

The "js" implementation takes precedence over the "custom"
implementation. This prevents issues that arise from the buggy way
Cargo handles features across multiple targets.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-29 01:11:13 -07:00
Joe Richey 6aba12ccdb Rename "cpu" feature to "rdrand"
Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-28 19:03:02 -07:00
Joe Richey 618593ca03 cpu: Have "cpu" feature take precedence over "custom"
Right now, features are always enabled across all targets. This means
that if _any_ Custom RNG is used _anywhere_ in a crate's dependancy
graph on _any_ target. The "custom" feature will be active on all
targets.

This makes it impossible to have a bare metal target that uses "cpu" on
x86_64 and a Custom RNG on aarch64. This solution also makes sure that
any implementation `getrandom` itself provides cannot be overridden.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-28 19:03:02 -07:00
Joe Richey a29180afcd wasm32: Unify error codes an implementations
Right now, while our implementations for stdweb and wasm-bindgen use
similar APIs, they do not use similar implementations. This change:

  - Switches to using the same error codes for both implementations
  - Uses error codes that detail exactly what API is missing
  - Cleans up the implemetnations to make them much more readable
  - Consitantly use thread_local in both implementations

This makes issues easier to debug and the code easier to understand.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-25 13:20:12 -07:00
Joe Richey 10df5588c2 AppVeyor: Run CI on 0.2 branch
Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-25 12:13:57 -07:00
Joe Richey 7631f75292 ci: Pin the Cross binary to avoid breaking the CI
Signed-off-by: Joe Richey <joerichey@google.com>
2020-05-25 03:00:58 -07:00
Diggory Hardy 8191d7f26b Merge pull request #143 from josephlr/fixing-webpack-warning
Apply #137 to 0.2 branch
2020-04-28 08:45:26 +01:00
Pauan ec4a3e1f03 Fixing Webpack require warning 2020-04-27 15:57:14 -07:00
zer0x64 7bfdabf358 wasm-bindgen: Added support for Internet Explorer 11 2020-04-27 06:22:44 -07:00
zer0x64 0ad1c77214 wasm-bindgen: Added support for Internet Explorer 11 2020-04-27 06:22:04 -07:00
Pauan f1c264d476 Fixing Webpack require warning 2020-04-27 02:45:09 -07:00
Joe Richey 54b4c8d1b6 travis: Allow nightly builds to fail 2020-04-27 02:15:05 -07:00
Joe Richey b44da72a01 travis: Fix wasm32 CI
Split emscripten stuff into its own target and stop relying on cargo web
to download/manage then emscripten toolchain. We can just get it
ourselves. We also now run the emscripten tests.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-04-27 02:15:05 -07:00
Diggory Hardy 717b5cc654 Merge pull request #145 from josephlr/nightly
travis: Allow nightly builds to fail
2020-04-27 09:38:01 +01:00
Joe Richey c7862af490 travis: Allow nightly builds to fail 2020-04-27 00:51:12 -07:00
Joe Richey 74eca5e871 fmt: Use consistent include style 2020-04-27 00:14:53 -07:00
Joe Richey 138d903318 ios: Don't use SecRandom type
The type of the `rnd` parameter is SecRandomRef which is an alias for an
"Opaque Pointer". This is better represented in Rust as a c_void pointer.

We also know that kSecRandomDefault is NULL, so we can simplify the code.

https://developer.apple.com/documentation/security/1399291-secrandomcopybytes
https://developer.apple.com/documentation/security/secrandomref
https://developer.apple.com/documentation/swift/imported_c_and_objective-c_apis/using_imported_c_functions_in_swift
2020-04-27 00:14:53 -07:00
Joe Richey afcfcd1525 build: Remove getrandom_uwp cfg
As our minimum rust version is 1.33, we can just use `target_vendor`.
2020-04-27 00:14:53 -07:00
Joe Richey b3d3fbcb10 assert: Make use of asserts consistent
- Use debug asserts in code
- Use normal asserts in tests
- Use *assert_eq! methods when possible
- Remove unnecessary asserts
2020-04-27 00:14:53 -07:00
Joe Richey d1a84dbd0d error: Make internal_error! a function
Also make Error::code a const fn. These increase the Min Rust version to 1.33
2020-04-27 00:14:53 -07:00
Diggory Hardy 3d17318c59 Merge pull request #141 from josephlr/travis
travis: Fix wasm32 CI
2020-04-26 14:47:36 +01:00
Joe Richey c25d0a81eb travis: Fix wasm32 CI
Split emscripten stuff into its own target and stop relying on cargo web
to download/manage then emscripten toolchain. We can just get it
ourselves. We also now run the emscripten tests.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-04-25 02:44:08 -07:00
Joe Richey 2e39004c4b rdrand: Add 32-bit x86 support
Also add tests for 32-bit x86
2020-02-20 15:24:57 -08:00
Joe Richey 52e7e9fe23 tests: Test CPU-based RNG on all x86 targets
This allows us to verify the RDRAND implementation on Linux.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-02-19 10:21:58 -08:00
Joe Richey 1375181832 tests: Improve testing infrastructure
- Cleanup .travis.yml
  - Loops over std/no_std targets
  - Remove deprecated/useless keys
  - No more `cd`, we just use `--package`.
- Improve tests
  - Main `getrandom` tests are now unit test modules instead of
    integration tests, making the code cleaner.
  - The custom RNG crates now use this common module as part of their
    integration tests.
  - No more weird test-only features needed to get the crate to build.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-02-19 10:21:58 -08:00