Skip to content

Commit b111209

Browse files
committed
Merge #840: ci: delete broken wasm job
471cd63 ci: delete broken WASM job (Andrew Poelstra) 0d0263e secp-sys: update raw pointer deref syntax in fuzz version of the crate (Andrew Poelstra) d477198 ci: remove now-removed 'hashes' feature from tests (Andrew Poelstra) Pull request description: The incorrectly-indented wasm test from #819 is causing Github to silently disable all of our checks. If you click through to the "Actions" tab of this repo you can see it failing (with a "syntax error on line 1" nonsense error). For example https://github.com/apoelstra/rust-secp256k1/actions/runs/17178718613/workflow Delete the test, and also fix everything else that broke in the meantime. ACKs for top commit: tcharding: ACK 471cd63 Tree-SHA512: b52f86a203cb08f66ecbe2afc6e85d973193373da9d5a8bc7e10ca4f9b0991a69cf30e851b439ad6c463b468d10a35c87540fabc6b9ed877fadd82df74221fe8
2 parents 1fc9906 + 471cd63 commit b111209

File tree

3 files changed

+34
-48
lines changed

3 files changed

+34
-48
lines changed

.github/workflows/rust.yml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -253,20 +253,6 @@ jobs:
253253
- name: "Run test on i686"
254254
run: cargo test --target i686-unknown-linux-gnu
255255

256-
WASM:
257-
name: WASM - stable toolchain
258-
runs-on: ubuntu-latest
259-
strategy:
260-
fail-fast: false
261-
# Note we do not use the recent lock file for wasm testing.
262-
steps:
263-
- name: "Checkout repo"
264-
uses: actions/checkout@v4
265-
- name: "Select toolchain"
266-
uses: dtolnay/rust-toolchain@stable
267-
- name: "Run wasm script"
268-
run: ./contrib/wasm.sh
269-
270256
NoStd: # 1 job, run no-std test from script.
271257
name: no-std - nightly toolchain
272258
needs: Prepare

contrib/test_vars.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
# shellcheck disable=SC2034
66

77
# Test all these features with "std" enabled.
8-
FEATURES_WITH_STD="hashes global-context global-context-less-secure lowmemory rand recovery serde"
8+
FEATURES_WITH_STD="global-context global-context-less-secure lowmemory rand recovery serde"
99

1010
# Test all these features without "std" enabled.
11-
FEATURES_WITHOUT_STD="hashes global-context global-context-less-secure lowmemory rand recovery serde alloc"
11+
FEATURES_WITHOUT_STD="global-context global-context-less-secure lowmemory rand recovery serde alloc"
1212

1313
# Run these examples.
14-
EXAMPLES="sign_verify:hashes,std sign_verify_recovery:hashes,std,recovery generate_keys:rand,std"
14+
EXAMPLES="sign_verify:std sign_verify_recovery:std,recovery generate_keys:rand,std"

secp256k1-sys/src/lib.rs

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,21 +1617,21 @@ mod fuzz_dummy {
16171617
/// Checks that pk != 0xffff...ffff and pk[1..32] == pk[33..64]
16181618
unsafe fn test_pk_validate(cx: *const Context, pk: *const PublicKey) -> c_int {
16191619
check_context_flags(cx, 0);
1620-
if (*pk).0[1..32] != (*pk).0[33..64]
1621-
|| ((*pk).0[32] != 0 && (*pk).0[32] != 0xff)
1622-
|| secp256k1_ec_seckey_verify(cx, (*pk).0[0..32].as_ptr()) == 0
1620+
if (&*pk).0[1..32] != (&*pk).0[33..64]
1621+
|| ((*pk).0[32] != 0 && (&*pk).0[32] != 0xff)
1622+
|| secp256k1_ec_seckey_verify(cx, (&*pk).0[0..32].as_ptr()) == 0
16231623
{
16241624
0
16251625
} else {
16261626
1
16271627
}
16281628
}
16291629
unsafe fn test_cleanup_pk(pk: *mut PublicKey) {
1630-
(*pk).0[32..].copy_from_slice(&(*pk).0[..32]);
1631-
if (*pk).0[32] <= 0x7f {
1632-
(*pk).0[32] = 0;
1630+
(&mut *pk).0[32..].copy_from_slice(&(&*pk).0[..32]);
1631+
if (&*pk).0[32] <= 0x7f {
1632+
(&mut *pk).0[32] = 0;
16331633
} else {
1634-
(*pk).0[32] = 0xff;
1634+
(&mut *pk).0[32] = 0xff;
16351635
}
16361636
}
16371637

@@ -1648,8 +1648,8 @@ mod fuzz_dummy {
16481648
if *input != 2 && *input != 3 {
16491649
0
16501650
} else {
1651-
ptr::copy(input.offset(1), (*pk).0[0..32].as_mut_ptr(), 32);
1652-
ptr::copy(input.offset(2), (*pk).0[33..64].as_mut_ptr(), 31);
1651+
ptr::copy(input.offset(1), (&mut *pk).0[0..32].as_mut_ptr(), 32);
1652+
ptr::copy(input.offset(2), (&mut *pk).0[33..64].as_mut_ptr(), 31);
16531653
if *input == 3 {
16541654
(*pk).0[32] = 0xff;
16551655
} else {
@@ -1661,7 +1661,7 @@ mod fuzz_dummy {
16611661
if *input != 4 && *input != 6 && *input != 7 {
16621662
0
16631663
} else {
1664-
ptr::copy(input.offset(1), (*pk).0.as_mut_ptr(), 64);
1664+
ptr::copy(input.offset(1), (&mut *pk).0.as_mut_ptr(), 64);
16651665
test_cleanup_pk(pk);
16661666
test_pk_validate(cx, pk)
16671667
},
@@ -1708,7 +1708,7 @@ mod fuzz_dummy {
17081708
if secp256k1_ec_seckey_verify(cx, sk) != 1 {
17091709
return 0;
17101710
}
1711-
ptr::copy(sk, (*pk).0[0..32].as_mut_ptr(), 32);
1711+
ptr::copy(sk, (&mut *pk).0[0..32].as_mut_ptr(), 32);
17121712
test_cleanup_pk(pk);
17131713
assert_eq!(test_pk_validate(cx, pk), 1);
17141714
1
@@ -1717,7 +1717,7 @@ mod fuzz_dummy {
17171717
pub unsafe fn secp256k1_ec_pubkey_negate(cx: *const Context, pk: *mut PublicKey) -> c_int {
17181718
check_context_flags(cx, 0);
17191719
assert_eq!(test_pk_validate(cx, pk), 1);
1720-
if secp256k1_ec_seckey_negate(cx, (*pk).0[..32].as_mut_ptr()) != 1 {
1720+
if secp256k1_ec_seckey_negate(cx, (&mut *pk).0[..32].as_mut_ptr()) != 1 {
17211721
return 0;
17221722
}
17231723
test_cleanup_pk(pk);
@@ -1733,7 +1733,7 @@ mod fuzz_dummy {
17331733
) -> c_int {
17341734
check_context_flags(cx, SECP256K1_START_VERIFY);
17351735
assert_eq!(test_pk_validate(cx, pk), 1);
1736-
if secp256k1_ec_seckey_tweak_add(cx, (*pk).0[..32].as_mut_ptr(), tweak) != 1 {
1736+
if secp256k1_ec_seckey_tweak_add(cx, (&mut *pk).0[..32].as_mut_ptr(), tweak) != 1 {
17371737
return 0;
17381738
}
17391739
test_cleanup_pk(pk);
@@ -1749,7 +1749,7 @@ mod fuzz_dummy {
17491749
) -> c_int {
17501750
check_context_flags(cx, 0);
17511751
assert_eq!(test_pk_validate(cx, pk), 1);
1752-
if secp256k1_ec_seckey_tweak_mul(cx, (*pk).0[..32].as_mut_ptr(), tweak) != 1 {
1752+
if secp256k1_ec_seckey_tweak_mul(cx, (&mut *pk).0[..32].as_mut_ptr(), tweak) != 1 {
17531753
return 0;
17541754
}
17551755
test_cleanup_pk(pk);
@@ -1770,8 +1770,8 @@ mod fuzz_dummy {
17701770
assert_eq!(test_pk_validate(cx, *ins.offset(i as isize)), 1);
17711771
if secp256k1_ec_seckey_tweak_add(
17721772
cx,
1773-
(*out).0[..32].as_mut_ptr(),
1774-
(**ins.offset(i as isize)).0[..32].as_ptr(),
1773+
(&mut *out).0[..32].as_mut_ptr(),
1774+
(&**ins.offset(i as isize)).0[..32].as_ptr(),
17751775
) != 1
17761776
{
17771777
return 0;
@@ -1798,7 +1798,7 @@ mod fuzz_dummy {
17981798
}
17991799

18001800
let scalar_slice = slice::from_raw_parts(scalar, 32);
1801-
let pk_slice = &(*point).0[..32];
1801+
let pk_slice = &(&*point).0[..32];
18021802

18031803
let mut res_arr = [0u8; 32];
18041804
for i in 0..32 {
@@ -1827,7 +1827,7 @@ mod fuzz_dummy {
18271827
// Actually verify
18281828
let sig_sl = slice::from_raw_parts(sig as *const u8, 64);
18291829
let msg_sl = slice::from_raw_parts(msg32 as *const u8, 32);
1830-
if &sig_sl[..32] == msg_sl && sig_sl[32..] == (*pk).0[0..32] {
1830+
if &sig_sl[..32] == msg_sl && sig_sl[32..] == (&*pk).0[0..32] {
18311831
1
18321832
} else {
18331833
0
@@ -1873,7 +1873,7 @@ mod fuzz_dummy {
18731873
// Actually verify
18741874
let sig_sl = slice::from_raw_parts(sig64 as *const u8, 64);
18751875
let msg_sl = slice::from_raw_parts(msg32 as *const u8, msglen);
1876-
if &sig_sl[..32] == msg_sl && sig_sl[32..] == (*pubkey).0[..32] {
1876+
if &sig_sl[..32] == msg_sl && sig_sl[32..] == (&*pubkey).0[..32] {
18771877
1
18781878
} else {
18791879
0
@@ -1932,8 +1932,8 @@ mod fuzz_dummy {
19321932
}
19331933

19341934
let seckey_slice = slice::from_raw_parts(seckey, 32);
1935-
(*keypair).0[..32].copy_from_slice(seckey_slice);
1936-
(*keypair).0[32..].copy_from_slice(&pk.0);
1935+
(&mut *keypair).0[..32].copy_from_slice(seckey_slice);
1936+
(&mut *keypair).0[32..].copy_from_slice(&pk.0);
19371937
1
19381938
}
19391939

@@ -1944,8 +1944,8 @@ mod fuzz_dummy {
19441944
) -> c_int {
19451945
check_context_flags(cx, 0);
19461946
let inslice = slice::from_raw_parts(input32, 32);
1947-
(*pubkey).0[..32].copy_from_slice(inslice);
1948-
(*pubkey).0[32..].copy_from_slice(inslice);
1947+
(&mut *pubkey).0[..32].copy_from_slice(inslice);
1948+
(&mut *pubkey).0[32..].copy_from_slice(inslice);
19491949
test_cleanup_pk(pubkey as *mut PublicKey);
19501950
test_pk_validate(cx, pubkey as *mut PublicKey)
19511951
}
@@ -1957,7 +1957,7 @@ mod fuzz_dummy {
19571957
) -> c_int {
19581958
check_context_flags(cx, 0);
19591959
let outslice = slice::from_raw_parts_mut(output32, 32);
1960-
outslice.copy_from_slice(&(*pubkey).0[..32]);
1960+
outslice.copy_from_slice(&(&*pubkey).0[..32]);
19611961
1
19621962
}
19631963

@@ -1971,7 +1971,7 @@ mod fuzz_dummy {
19711971
if !pk_parity.is_null() {
19721972
*pk_parity = ((*pubkey).0[32] == 0).into();
19731973
}
1974-
(*xonly_pubkey).0.copy_from_slice(&(*pubkey).0);
1974+
(*xonly_pubkey).0.copy_from_slice(&(&*pubkey).0);
19751975
assert_eq!(test_pk_validate(cx, pubkey), 1);
19761976
1
19771977
}
@@ -1995,9 +1995,9 @@ mod fuzz_dummy {
19951995
) -> c_int {
19961996
check_context_flags(cx, 0);
19971997
if !pk_parity.is_null() {
1998-
*pk_parity = ((*keypair).0[64] == 0).into();
1998+
*pk_parity = ((&*keypair).0[64] == 0).into();
19991999
}
2000-
(*pubkey).0.copy_from_slice(&(*keypair).0[32..]);
2000+
(&mut *pubkey).0.copy_from_slice(&(&*keypair).0[32..]);
20012001
1
20022002
}
20032003

@@ -2008,13 +2008,13 @@ mod fuzz_dummy {
20082008
) -> c_int {
20092009
check_context_flags(cx, SECP256K1_START_VERIFY);
20102010
let mut pk = PublicKey::new();
2011-
pk.0.copy_from_slice(&(*keypair).0[32..]);
2011+
pk.0.copy_from_slice(&(&*keypair).0[32..]);
20122012
let mut sk = [0u8; 32];
2013-
sk.copy_from_slice(&(*keypair).0[..32]);
2013+
sk.copy_from_slice(&(&*keypair).0[..32]);
20142014
assert_eq!(secp256k1_ec_pubkey_tweak_add(cx, &mut pk, tweak32), 1);
20152015
assert_eq!(secp256k1_ec_seckey_tweak_add(cx, (&mut sk[..]).as_mut_ptr(), tweak32), 1);
2016-
(*keypair).0[..32].copy_from_slice(&sk);
2017-
(*keypair).0[32..].copy_from_slice(&pk.0);
2016+
(&mut *keypair).0[..32].copy_from_slice(&sk);
2017+
(&mut *keypair).0[32..].copy_from_slice(&pk.0);
20182018
1
20192019
}
20202020

0 commit comments

Comments
 (0)