Skip to content

Commit

Permalink
Adopt no-std tests to new preacllocated_* functions
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai committed Aug 28, 2020
1 parent fa1d673 commit 2249cbf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions no_std_test/src/main.rs
Expand Up @@ -53,6 +53,7 @@ use core::intrinsics;
use core::panic::PanicInfo;

use secp256k1::ecdh::SharedSecret;
use secp256k1::ffi::types::AlignedType;
use secp256k1::rand::{self, RngCore};
use secp256k1::serde::Serialize;
use secp256k1::*;
Expand Down Expand Up @@ -82,7 +83,7 @@ impl RngCore for FakeRng {

#[start]
fn start(_argc: isize, _argv: *const *const u8) -> isize {
let mut buf = [0u8; 600_000];
let mut buf = [AlignedType::zeroed(); 37_000];
let size = Secp256k1::preallocate_size();
unsafe { libc::printf("needed size: %d\n\0".as_ptr() as _, size) };

Expand Down Expand Up @@ -161,5 +162,5 @@ fn panic(info: &PanicInfo) -> ! {
let mut buf = Print::new();
write(&mut buf, *msg).unwrap();
buf.print();
unsafe { intrinsics::abort() }
intrinsics::abort()
}

0 comments on commit 2249cbf

Please sign in to comment.