From 47a6cb81753850a92500b1327fc51c0190fa7c5d Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 14 Oct 2023 16:55:50 -0700 Subject: [PATCH 1/3] NFC: Don't treat wasm32 differently w.r.t. dead-code warnings. --- src/ec/keys.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ec/keys.rs b/src/ec/keys.rs index 83917ed226..7831571f0e 100644 --- a/src/ec/keys.rs +++ b/src/ec/keys.rs @@ -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, } From d8444bdf88f3e8817471c0a9eff6333da0d7bc4a Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 14 Oct 2023 17:36:58 -0700 Subject: [PATCH 2/3] Digest tests: Don't disable tests for wasm32 targets. --- tests/digest_tests.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/tests/digest_tests.rs b/tests/digest_tests.rs index 8a7fec2656..631f86f79b 100644 --- a/tests/digest_tests.rs +++ b/tests/digest_tests.rs @@ -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]; @@ -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]; From 117af21658a52d6beb62ae68d6491f87b60461a5 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Sat, 14 Oct 2023 17:39:05 -0700 Subject: [PATCH 3/3] rand: Clarify wasm32-logic logic. Require `target_arch = "wasm32"` for `target_os = "wasi"`. --- src/rand.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rand.rs b/src/rand.rs index 09302c95fc..9448386ef4 100644 --- a/src/rand.rs +++ b/src/rand.rs @@ -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 {