|
15 | 15 | //! # secp256k1 no-std test.
|
16 | 16 | //! This binary is a short smallest rust code to produce a working binary *without libstd*.
|
17 | 17 | //! This gives us 2 things:
|
18 |
| -//! 1. Test that the parts of the code that should work in a no-std enviroment actually work. |
| 18 | +//! 1. Test that the parts of the code that should work in a no-std enviroment actually work. Note that this is not a comprehensive list. |
19 | 19 | //! 2. Test that we don't accidentally import libstd into `secp256k1`.
|
20 | 20 | //!
|
21 | 21 | //! The first is tested using the following command `cargo run --release | grep -q "Verified Successfully"`.
|
@@ -96,6 +96,13 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
96 | 96 | let sig = secp.sign(&message, &secret_key);
|
97 | 97 | assert!(secp.verify(&message, &sig, &public_key).is_ok());
|
98 | 98 |
|
| 99 | + let rec_sig = secp.sign_recoverable(&message, &secret_key); |
| 100 | + assert!(secp.verify(&message, &rec_sig.to_standard(), &public_key).is_ok()); |
| 101 | + assert_eq!(public_key, secp.recover(&message, &rec_sig).unwrap()); |
| 102 | + let (rec_id, data) = rec_sig.serialize_compact(); |
| 103 | + let new_rec_sig = recovery::RecoverableSignature::from_compact(&data, rec_id).unwrap(); |
| 104 | + assert_eq!(rec_sig, new_rec_sig); |
| 105 | + |
99 | 106 | let mut cbor_ser = [0u8; 100];
|
100 | 107 | let writer = SliceWrite::new(&mut cbor_ser[..]);
|
101 | 108 | let mut ser = Serializer::new(writer);
|
|
0 commit comments