Commit Graph

121 Commits

Author SHA1 Message Date
Matt Corallo 730da80f0b Ensure fuzztarget pubkey deserialize-serialize roundtrips are same 2018-03-29 15:41:28 -04:00
Matt Corallo eee25f6265 Fix fuzztarget ECDH to be symmetric 2018-03-29 11:21:13 -04:00
Matt Corallo e1878c4522 Remove all serde/rustc-serialize stuff 2018-03-21 18:01:33 -04:00
Matt Corallo 86af2dc0d2 Fix missing include on older rustcs 2018-03-21 18:01:33 -04:00
Matt Corallo 5a7c88b9c7 Add fuzztarget feature that replaces crypto with memcpys 2018-03-20 11:58:59 -04:00
Matt Corallo 7b396112fd Correct ptr type in ffi 2018-03-19 15:49:16 -04:00
Andrew Poelstra 6d4f64f901 fix potential unsafety bug for non-u8 types in macros
We don't have any non-u8 newtypes but better safe than sorry. See
https://github.com/apoelstra/rust-bitcoin/pull/45/
2018-02-14 16:25:45 +00:00
Andrew Poelstra f14e747431 expose key::{Secret, Public}Key in the crate root for ease of use 2018-01-17 15:38:11 +00:00
Andrew Poelstra 2c5f45e165 expose 2-key version of PublicKey::combine 2017-12-21 01:04:07 +00:00
Andrew Poelstra 5c54698bf9 make `serde` optional 2017-12-19 22:40:06 +00:00
Andrew Poelstra 12e9f4b90b make `rustc-serialize` crate optional 2017-12-19 22:36:30 +00:00
Andrew Poelstra 298929600b make `rand` crate optional 2017-12-19 22:36:27 +00:00
Andrew Poelstra dba0d67912 remove arrayvec dependency; rename PublicKey::serialize_vec 2017-12-19 20:36:46 +00:00
Tim Ruffing e71ed3b6d2 Implement serde traits for Signature 2017-07-21 23:58:19 +02:00
Tim Ruffing b1d8b09f25 Add tests for trailing bytes during deserilization 2017-07-21 22:21:37 +02:00
Tim Ruffing 76d160344b Update serde to 1.0 2017-07-21 22:15:00 +02:00
Andrew Poelstra b6887b44a0
add compact signature encoding 2017-07-12 19:55:06 +00:00
Andrew Poelstra f88eb1d6d7 Merge pull request #14 from petertodd/2017-05-08-use-copy_from_slice
Use safe copy_from_slice() rather than unsafe copy_nonoverlapping()
2017-05-08 12:53:19 +00:00
Peter Todd 20c5b903db
Replace unsafe copy_nonoverlapping() with safe copy_from_slice() 2017-05-08 07:31:08 -04:00
Peter Todd eccd625828
Implement From<[u8;32]> for Message 2017-05-08 07:10:51 -04:00
Peter Todd 70fd5a9e27
Improve Error::InvalidMessage comment 2017-05-08 06:12:25 -04:00
Christian Nyumbayire ab0493e46a Use DefaultHasher in place of the deprecated SipHasher 2017-04-27 21:46:28 +02:00
Andrew Poelstra 5b906ec069 expose *_tweak_mul functions 2016-08-20 17:00:39 +00:00
Andrew Poelstra 9e3b93d572 Add ZERO_KEY and ONE_KEY constants
Turns out you cannot initialize constant SecretKeys in any way; these
two constants should cover most sane use cases (other good choices
are the SECG generator and the Alpha CT generator, but these will
wait for a major CT-supporting upgrade, unless demand for them appears.)
2016-08-07 21:33:38 +00:00
Andrew Poelstra 458a3d9417 Update libsecp to latest master, c18b869e58aa4d3bff6958f370f6b643d1223c44 2016-01-14 18:35:54 +00:00
Dawid Ciężarkiewicz 16b36f18e1 key: Add PubKey hashing test. 2016-01-08 20:04:10 -08:00
Dawid Ciężarkiewicz 6686c213dd Implement Hash for PublicKey. 2016-01-05 21:01:40 -08:00
Andrew Poelstra cfde1f9925 Add missing schnorr.rs 2015-12-20 13:47:53 -06:00
Andrew Poelstra 4f83a83308 cleanup: remove unused attributes; add `dev` compile feature that'll run clippy 2015-12-19 20:20:47 -06:00
Andrew Poelstra f613dbbc00 Fix nonce doccoments 2015-12-15 12:48:01 -06:00
Andrew Poelstra 8aa2569818 Expose Schnorr sign/verify 2015-12-15 12:47:07 -06:00
Andrew Poelstra 9a91b69fad Remove side-effect from assertion; add release build to travis 2015-11-18 18:22:16 -06:00
Andrew Poelstra d35168d626 [BREAKING CHANGE] Fix FFI 2015-11-15 17:00:07 -06:00
Andrew Poelstra 2df3c0b37c Minor changes for problems `cargo clippy` found 2015-10-28 07:48:28 -05:00
Andrew Poelstra a65f4cf01f Expose normalize_s function to convert signatures to low-S form 2015-10-26 14:25:18 -05:00
Andrew Poelstra 8e984c5912 Add "lax DER" support; bump major version number for recent build system changes 2015-10-26 12:59:40 -05:00
Andrew Poelstra e7ca836c2b Switch to static linking of secp256k1
Pieter moved some stuff I need into the contrib/ directory which does
not expose anything through the shared lib, so I need to statically
link.

I might also use this to do evil things to expose the SHA256 code
in libsecp, but not for now ;).
2015-10-26 10:28:01 -05:00
Andrew Poelstra f1e1da1213 Update for breaking changes in underlying rustc.
This should be a major version number since I changed public constants
in the ffi module. I'm not doing so as the invariant "will the constants
be meaningful to the underlying library" has not changed.

In general this library's version numbers do not map well to the
underlying library, which is as-yet not versioned at all, so users
need to always be running "the lastest" rust-secp256k1 anyway, and
semantic versioning can't really be used meaninfully. So this is a
bit of a judgement call.
2015-10-25 18:26:08 -05:00
Andrew Poelstra d49db8167e impl Error for error type; remove `Unknown` error variant 2015-10-17 09:49:19 -05:00
Andrew Poelstra 32107132f0 Improve unit tests for bad secp context 2015-10-14 12:21:15 -05:00
Andrew Poelstra c84cfb193f [BREAKING CHANGE] Make PK::from_secret_key() return a Result; change from_ffi functions to From impls
If you try to call PublicKey::from_secret() key with an incapable context it will
now return an error. Before it would pass through to the underlying library which
would terminate the process, something we strive to never expose.

Also change the from_ffi functions on various types to impl's of From to be more
Rustic. We cannot change the from_slice functions because they have error returns.

Also add a Secp256k1::without_caps() function which creates a capability-less
context. I find myself using this in so many places downstream that it seems
appropriate.
2015-10-14 09:38:43 -05:00
Matt Quinn 595f64bca6 Adding to_i32 and from_i32 functions to RecoveryId in order to give
library users the ability to create RecoveryId objects and convert them to i32 equivalents, without allowing users to create invalid ones.
2015-10-11 15:24:44 -07:00
Matt Quinn ebde999634 RecoverableSignature now supports compact serialization via FFI, with additional test case added. 2015-10-11 00:04:28 -07:00
Andrew Poelstra 701c5e5e08 Expose serialization of Signature; move copy_nonoverlapping for rustc stable 2015-10-09 14:20:21 -05:00
Andrew Poelstra ec0e8407f2 Minor documentation fixes 2015-10-09 11:39:42 -05:00
Andrew Poelstra 2748dae7eb Remove `hex_slice` macro as it was never used 2015-09-21 08:30:06 -05:00
Andrew Poelstra b978e76934 Drop some unused imports; bump version no 2015-09-20 15:30:43 -05:00
Andrew Poelstra 5ce825398a Fix benchmarks 2015-09-20 15:24:25 -05:00
Andrew Poelstra b42b1f9408 Bugfix for nightly 2015-09-20 15:13:42 -05:00
Andrew Poelstra 4012281a2d Fix for upstream API changes 2015-09-20 14:52:29 -05:00