Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasm32: Enable more tests and clarify rand logic #1747

Merged
merged 3 commits into from
Oct 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/ec/keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ impl KeyPair {
pub struct Seed {
bytes: [u8; SEED_MAX_BYTES],
curve: &'static Curve,
#[cfg_attr(target_arch = "wasm32", allow(dead_code))]
pub(crate) cpu_features: cpu::Features,
}

Expand Down
6 changes: 4 additions & 2 deletions src/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,11 @@ impl crate::sealed::Sealed for SystemRandom {}
target_os = "vita",
target_os = "wasi",
all(
feature = "wasm32_unknown_unknown_js",
target_arch = "wasm32",
target_os = "unknown",
any(
target_os = "wasi",
all(target_os = "unknown", feature = "wasm32_unknown_unknown_js")
)
),
))]
impl sealed::SecureRandom for SystemRandom {
Expand Down
4 changes: 0 additions & 4 deletions tests/digest_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ mod digest_shavs {
macro_rules! test_i_u_f {
( $test_name:ident, $alg:expr) => {
#[cfg(not(debug_assertions))]
// TODO: Get this working on WebAssembly
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn $test_name() {
let mut input = [0; (digest::MAX_BLOCK_LEN + 1) * 3];
Expand Down Expand Up @@ -241,9 +239,7 @@ test_i_u_f!(digest_test_i_u_f_sha512, digest::SHA512);
/// This is not run in dev (debug) builds because it is too slow.
macro_rules! test_large_digest {
( $test_name:ident, $alg:expr, $len:expr, $expected:expr) => {
// TODO: get this working on WebAssembly.
#[cfg(not(debug_assertions))]
#[cfg(not(target_arch = "wasm32"))]
#[test]
fn $test_name() {
let chunk = vec![123u8; 16 * 1024];
Expand Down