Merge rust-bitcoin/rust-secp256k1#705: Fix ci
33a1893c14
Upgrade cross image for windows (Martin Habovstiak)24e81eeadb
Run cross with --verbose flag (Martin Habovstiak)742c69f975
Compile `no_std` test using xargo (Martin Habovstiak)2572fb6ab0
Migrate `no_std_test` to edition 2021 (Martin Habovstiak)df0523a0a7
Use `libc::abort` instead of `intrinsics::abort` (Martin Habovstiak)924ba381c8
Update panic message handling (Martin Habovstiak)614fe81708
Whitelist known cfgs (Martin Habovstiak)05a4e3963c
Don't use `core::i32::MAX` (Martin Habovstiak) Pull request description: Updated deprecated item and fixed cfg lints. ACKs for top commit: apoelstra: ACK33a1893c14
Tree-SHA512: 8b66f1f404d44916b2a18dbbe829b31ec1915d3fd084164127aa6e5f98ee5de3ea988f5b1ed05e9532c026890a769b4c54e175508fe472beaea5898a477d5c76
This commit is contained in:
commit
30dda2c12c
|
@ -53,4 +53,4 @@ jobs:
|
|||
- name: install cross
|
||||
run: cargo install cross
|
||||
- name: run cross test
|
||||
run: cross test --target ${{ matrix.arch }}
|
||||
run: cross test --target ${{ matrix.arch }} --verbose
|
||||
|
|
|
@ -46,6 +46,8 @@ jobs:
|
|||
uses: dtolnay/rust-toolchain@nightly
|
||||
- name: Install src
|
||||
run: rustup component add rust-src
|
||||
- name: Install xargo
|
||||
run: cargo install xargo
|
||||
- name: Running test script
|
||||
env:
|
||||
DO_FMT: true
|
||||
|
|
|
@ -54,6 +54,8 @@ bincode = "1.3.3"
|
|||
wasm-bindgen-test = "0.3"
|
||||
getrandom = { version = "0.2", features = ["js"] }
|
||||
|
||||
[lints.rust]
|
||||
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(bench)', 'cfg(secp256k1_fuzz)', 'cfg(rust_secp_no_symbol_renaming)'] }
|
||||
|
||||
[[example]]
|
||||
name = "sign_verify_recovery"
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[target.x86_64-pc-windows-gnu]
|
||||
image = "ghcr.io/cross-rs/x86_64-pc-windows-gnu:main"
|
|
@ -101,8 +101,10 @@ if [ "$DO_ASAN" = true ]; then
|
|||
RUSTFLAGS='-Zsanitizer=memory -Zsanitizer-memory-track-origins -Cforce-frame-pointers=yes -Cllvm-args=-msan-eager-checks=0' \
|
||||
cargo test --lib --all --features="$FEATURES" -Zbuild-std --target x86_64-unknown-linux-gnu
|
||||
|
||||
cargo run --release --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified Successfully"
|
||||
cargo run --release --features=alloc --manifest-path=./no_std_test/Cargo.toml | grep -q "Verified alloc Successfully"
|
||||
cd no_std_test
|
||||
xargo run --release --target=x86_64-unknown-linux-gnu | grep -q "Verified Successfully"
|
||||
xargo run --release --target=x86_64-unknown-linux-gnu --features=alloc | grep -q "Verified alloc Successfully"
|
||||
cd -
|
||||
fi
|
||||
|
||||
# Run formatter if told to.
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
name = "no_std_test"
|
||||
version = "0.1.0"
|
||||
authors = ["Elichai Turkel <elichai.turkel@gmail.com>"]
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
alloc = ["secp256k1/alloc", "wee_alloc"]
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
[dependencies]
|
||||
alloc = {}
|
|
@ -28,8 +28,6 @@
|
|||
//!
|
||||
|
||||
#![feature(start)]
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(panic_info_message)]
|
||||
#![feature(alloc_error_handler)]
|
||||
#![no_std]
|
||||
extern crate libc;
|
||||
|
@ -48,8 +46,7 @@ extern crate wee_alloc;
|
|||
#[global_allocator]
|
||||
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
|
||||
|
||||
use core::fmt::{self, write, Write};
|
||||
use core::intrinsics;
|
||||
use core::fmt::{self, Write};
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
use secp256k1::ecdh::{self, SharedSecret};
|
||||
|
@ -62,6 +59,10 @@ use serde_cbor::de;
|
|||
use serde_cbor::ser::SliceWrite;
|
||||
use serde_cbor::Serializer;
|
||||
|
||||
fn abort() -> ! {
|
||||
unsafe { libc::abort() }
|
||||
}
|
||||
|
||||
struct FakeRng;
|
||||
impl RngCore for FakeRng {
|
||||
fn next_u32(&mut self) -> u32 {
|
||||
|
@ -158,7 +159,7 @@ impl Write for Print {
|
|||
if curr + s.len() > MAX_PRINT {
|
||||
unsafe {
|
||||
libc::printf("overflow\n\0".as_ptr() as _);
|
||||
intrinsics::abort();
|
||||
abort();
|
||||
}
|
||||
}
|
||||
self.loc += s.len();
|
||||
|
@ -170,15 +171,15 @@ impl Write for Print {
|
|||
#[panic_handler]
|
||||
fn panic(info: &PanicInfo) -> ! {
|
||||
unsafe { libc::printf("shi1\n\0".as_ptr() as _) };
|
||||
let msg = info.message().unwrap();
|
||||
let msg = info.message();
|
||||
let mut buf = Print::new();
|
||||
write(&mut buf, *msg).unwrap();
|
||||
write!(&mut buf, "{}", msg).unwrap();
|
||||
buf.print();
|
||||
intrinsics::abort()
|
||||
abort()
|
||||
}
|
||||
|
||||
#[alloc_error_handler]
|
||||
fn alloc_error(_layout: Layout) -> ! {
|
||||
unsafe { libc::printf("alloc shi1\n\0".as_ptr() as _) };
|
||||
intrinsics::abort()
|
||||
abort()
|
||||
}
|
||||
|
|
|
@ -32,3 +32,6 @@ recovery = []
|
|||
lowmemory = []
|
||||
std = ["alloc"]
|
||||
alloc = []
|
||||
|
||||
[lints.rust]
|
||||
unexpected_cfgs = { level = "deny", check-cfg = ['cfg(bench)', 'cfg(secp256k1_fuzz)', 'cfg(rust_secp_no_symbol_renaming)'] }
|
||||
|
|
|
@ -638,10 +638,9 @@ impl PublicKey {
|
|||
/// # }
|
||||
/// ```
|
||||
pub fn combine_keys(keys: &[&PublicKey]) -> Result<PublicKey, Error> {
|
||||
use core::i32::MAX;
|
||||
use core::mem::transmute;
|
||||
|
||||
if keys.is_empty() || keys.len() > MAX as usize {
|
||||
if keys.is_empty() || keys.len() > i32::MAX as usize {
|
||||
return Err(InvalidPublicKeySum);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue