Hi,
I'm trying to write Rust (rust-lang.org) wrappers for this library. I'm not a cryptography expert and Rust is still under heavy development, so this might not be problem with a secp256k1 library itself, but when I'm giving random array as inputs like this (Rust syntax):
#[test]
fn sign_and_verify_fail() {
let s = Secp256k1::new();
let mut msg = Vec::from_elem(64, 0u8);
let mut seckey = [0u8, ..32];
let mut nonce = [0u8, ..32];
rand::task_rng().fill_bytes(msg.as_mut_slice());
rand::task_rng().fill_bytes(nonce);
rand::task_rng().fill_bytes(seckey);
let pubkey = s.pubkey_create(seckey, false).unwrap();
let sig = s.sign(&msg, seckey, nonce).unwrap();
rand::task_rng().fill_bytes(msg.as_mut_slice());
assert_eq!(s.verify(msg, sig, pubkey), Ok(false));
}
I'm getting assert abort:
secp256k1: src/num_gmp_impl.h:200: secp256k1_num_mul: Assertion `a->limbs + b->limbs <= 2*((256+(64 - 0)-1)/(64 - 0))+1' failed.
Generally, it seems the randomness of msg is triggering the problem. Are there some messages / private keys that are not valid? Is this assert ringing a bell what is possibly wrong?