Skip to content

Commit d97ae1f

Browse files
committed
wasm32: Make wasm32_c the default and only mode; remove the "wasm32_c" feature.
Always require a C compilare for wasm32, instead of trying to provide a subset of the functionality.
1 parent fe23432 commit d97ae1f

10 files changed

+5
-34
lines changed

.github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ jobs:
430430
matrix:
431431
features:
432432
- # Default
433-
- --features=wasm32_c
433+
434434
host_os:
435435
- ubuntu-18.04
436436
mode:

Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,6 @@ dev_urandom_fallback = ["once_cell"]
199199
slow_tests = []
200200
std = ["alloc"]
201201
test_logging = []
202-
wasm32_c = []
203202

204203
# XXX: debug = false because of https://github.com/rust-lang/rust/issues/34122
205204

build.rs

-7
Original file line numberDiff line numberDiff line change
@@ -427,13 +427,6 @@ fn build_c_code(
427427
) {
428428
println!("cargo:rustc-env=RING_CORE_PREFIX={}", ring_core_prefix);
429429

430-
#[cfg(not(feature = "wasm32_c"))]
431-
{
432-
if &target.arch == "wasm32" {
433-
return;
434-
}
435-
}
436-
437430
let asm_target = ASM_TARGETS.iter().find(|asm_target| {
438431
asm_target.arch == target.arch && asm_target.oss.contains(&target.os.as_ref())
439432
});

mk/install-build-tools.sh

+1-7
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,7 @@ case $target in
6969
# The version of wasm-bindgen-cli must match the wasm-bindgen version.
7070
wasm_bindgen_version=$(cargo metadata --format-version 1 | jq -r '.packages | map(select( .name == "wasm-bindgen")) | map(.version) | .[0]')
7171
cargo install wasm-bindgen-cli --vers "$wasm_bindgen_version" --bin wasm-bindgen-test-runner
72-
case ${features-} in
73-
*wasm32_c*)
74-
use_clang=1
75-
;;
76-
*)
77-
;;
78-
esac
72+
use_clang=1
7973
;;
8074
--target=*)
8175
;;

src/lib.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,7 @@
3333
//! <tr><td><code>std</code>
3434
//! <td>Enable features that use libstd, in particular
3535
//! <code>std::error::Error</code> integration. Implies `alloc`.
36-
//! <tr><td><code>wasm32_c</code>
37-
//! <td>Enables features that require a C compiler on wasm32 targets, such as
38-
//! the <code>constant_time</code> module, HMAC verification, and PBKDF2
39-
//! verification. Without this feature, only a subset of functionality
40-
//! is provided to wasm32 targets so that a C compiler isn't needed. A
41-
//! typical invocation would be:
42-
//! <code>TARGET_CC=clang-10 TARGET_AR=llvm-ar-10 cargo test --target=wasm32-unknown-unknown --features=wasm32_c</code>
43-
//! with <code>llvm-ar-10</code> and <code>clang-10</code> in <code>$PATH</code>.
44-
//! (Going forward more functionality should be enabled by default, without
45-
//! requiring these hacks, and without requiring a C compiler.)
36+
//!
4637
//! </table>
4738
4839
// When running mk/package.sh, don't actually build any code.

tests/aead_tests.rs

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1313
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414

15-
#![cfg(any(not(target_arch = "wasm32"), feature = "wasm32_c"))]
16-
1715
#[cfg(target_arch = "wasm32")]
1816
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
1917

tests/constant_time_tests.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
1313
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1414

15-
#![cfg(any(not(target_arch = "wasm32"), feature = "wasm32_c"))]
1615
use ring::{constant_time, error, rand};
1716

1817
#[cfg(target_arch = "wasm32")]

tests/hmac_tests.rs

-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ fn hmac_test_case_inner(
7777
{
7878
let signature = hmac::sign(&key, input);
7979
assert_eq!(is_ok, signature.as_ref() == output);
80-
81-
#[cfg(any(not(target_arch = "wasm32"), feature = "wasm32_c"))]
8280
assert_eq!(is_ok, hmac::verify(&key, input, output).is_ok());
8381
}
8482

tests/pbkdf2_tests.rs

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ pub fn pbkdf2_tests() {
5858
assert_eq!(dk == out, verify_expected_result.is_ok() || dk.is_empty());
5959
}
6060

61-
#[cfg(any(not(target_arch = "wasm32"), feature = "wasm32_c"))]
6261
assert_eq!(
6362
pbkdf2::verify(algorithm, iterations, &salt, &secret, &dk),
6463
verify_expected_result

tests/rsa_tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ use ring::{
2323
};
2424
use std::convert::TryFrom;
2525

26-
#[cfg(all(target_arch = "wasm32", feature = "wasm32_c"))]
26+
#[cfg(target_arch = "wasm32")]
2727
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
2828

29-
#[cfg(all(target_arch = "wasm32", feature = "wasm32_c"))]
29+
#[cfg(target_arch = "wasm32")]
3030
wasm_bindgen_test_configure!(run_in_browser);
3131

3232
#[test]

0 commit comments

Comments
 (0)