Commit Graph

58 Commits

Author SHA1 Message Date
Andrew Poelstra eddfe03dbc
Merge pull request #151 from elichai/2019-08-Cptr-null
Explicit checks for ZST + null fallbacks
2019-08-21 23:03:30 +00:00
Elichai Turkel 66ab70f991
Added a C Ptr trait that returns a null pointer for ZSTs 2019-08-21 13:09:20 -04:00
Tim Ruffing 255d1ddd60 Remove TODOs for ffi functions for setting secp256k1 callbacks
We would not want to use these functions internally because we rely on
USE_EXTERNAL_DEFAULT_CALLBACKS to provide the callbacks at link time,
see f7a4a7ef57. Moreover, we would not
want to export the functions either.
2019-08-20 14:47:33 +02:00
Elichai Turkel 389e1e2449
Removing usage of `mem::uninitialized()` and deprecating the `blank()` functions
Signed-off-by: Elichai Turkel <elichai.turkel@gmail.com>
2019-08-16 14:15:27 -04:00
Elichai Turkel 75784ec26f Implemented context create/destroy in rust 2019-07-14 16:35:47 -04:00
Elichai Turkel 49f0cc1c46
Updated the fuzzing dummy functions 2019-07-04 19:13:26 -04:00
Elichai Turkel 811e8d24e9
Removed context_create/destroy/clone and scratch_create/destroy/clone functions. 2019-07-04 19:09:04 -04:00
Elichai Turkel 5f93474512
Added the preallocated FFI 2019-07-04 18:40:04 -04:00
Elichai Turkel 68c5c5edbf
implemented strlen to deref the callback message 2019-07-03 17:50:16 -04:00
Elichai Turkel f7a4a7ef57
Added manual external callbacks that panics 2019-07-03 17:48:35 -04:00
Jonas Nick 0e6ff34009 Fix imports when using recovery with fuzztarget feature 2019-05-29 00:02:11 +00:00
Jonas Nick 16da1a854c Move recovery ffi into recovery module and feature gate C-secp recovery module 2019-05-21 07:52:08 +00:00
Elichai Turkel 312b9a55fc
Added Error::description copied c_void impl from core::ffi::c_void 2019-04-30 22:07:27 +03:00
Elichai Turkel e98975a1c0
Added backwards support without the crate keyword 2019-04-14 12:09:43 +03:00
Elichai Turkel ab8066eb1a
Replaced the std::os::raw c types with types.rs 2019-04-14 12:09:42 +03:00
François Garillot a8a3afe8db
Fix clippy errors
Changes include cargo-fix generated, Default impls
2019-02-25 20:12:25 -08:00
Matt Corallo f90e9f3454 Stop checking context flags for secp256k1_ecdh as its not required 2019-01-16 16:02:24 -05:00
Matt Corallo a74cbb6781 Sync fuzztarget combine with tweak_add since real functions do that
Some new fuzz tests I was writing ended up failing because two
nodes came up with different keys because adding public keys and
adding a tweak to a private key and multiplying by the generator
should get the same thing.
2019-01-08 16:12:40 -05:00
Pierre Krieger 9c45944a5f
Remove dependency on libc 2018-12-27 14:39:54 +01:00
Andrew Poelstra 93abca5896 remove `without_caps` and every function that used a cap-less context 2018-11-06 22:16:24 +00:00
Andrew Poelstra 4653100b7a update upstream libsecp256k1 to 314a61d72474aa29ff4afba8472553ad91d88e9d 2018-11-06 22:16:13 +00:00
Roman Zeyde 5442e710a8 Remove Schnorr support
It was removed from bitcoin-core/libsecp256k1 at e06e878fd7dcc99825025fa99aedb86bc7d5c29f
2018-07-09 15:10:38 +03:00
Matt Corallo 207ccdf803 impl fuzztarget secp256k1_ecdsa_signature_serialize_der 2018-04-25 13:11:15 -04:00
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 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 dba0d67912 remove arrayvec dependency; rename PublicKey::serialize_vec 2017-12-19 20:36:46 +00:00
Andrew Poelstra b6887b44a0
add compact signature encoding 2017-07-12 19:55:06 +00:00
Andrew Poelstra 458a3d9417 Update libsecp to latest master, c18b869e58aa4d3bff6958f370f6b643d1223c44 2016-01-14 18:35:54 +00:00
Dawid Ciężarkiewicz 6686c213dd Implement Hash for PublicKey. 2016-01-05 21:01:40 -08: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 8aa2569818 Expose Schnorr sign/verify 2015-12-15 12:47:07 -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 ec0e8407f2 Minor documentation fixes 2015-10-09 11:39:42 -05:00
Andrew Poelstra 4012281a2d Fix for upstream API changes 2015-09-20 14:52:29 -05:00
Andrew Poelstra cc68cf8b9e Update serde dep to 0.6 from 0.3 2015-09-20 13:29:09 -05:00
Andrew Poelstra 016d781f2e Fix for upstream API changes; add ECDH support
I didn't mean for both of these to go into the same commit, but given how
small the ECDH code was, and the fact that no commit prior to this one will
compile (as both libsecp256k1 and rustc have changed so much), I'm letting
it slide.
2015-09-18 15:40:42 -05:00
Andrew Poelstra 8d6f384dac Update Travis to use travis-cargo 2015-07-28 13:21:12 -05:00
Andrew Poelstra 77f6b6bf21 [API BREAK] Update for new libsecp256k1 API 2015-07-28 11:05:13 -05:00
Andrew Poelstra 5602d6f988 Expose `secp256k1_context_randomize`
This is a new libsecp256k1 function which does additive blinding
for nonce generation during signing.
2015-05-03 18:22:30 -05:00
Andrew Poelstra d7c7230f28 Impl `Send` and `Sync` for secp256k1 contexts 2015-04-13 20:41:24 -05:00
Andrew Poelstra 9a01401746 Add missing implementations; update FFI for libsecp256k1's new cloning fn 2015-04-12 09:36:49 -05:00
Andrew Poelstra e52faee98f [API BREAK] update for libsecp256k1 "explicit context" API break
Rather than have global initialization functions, which required
expensive synchronization on the part of the Rust library,
libsecp256k1 now carries its context in thread-local data which
must be passed to every function.

What this means for the rust-secp256k1 API is:
  - Most functions on `PublicKey` and `SecretKey` now require a
    `Secp256k1` to be given to them.

  - `Secp256k1::verify` and `::verify_raw` now take a `&self`

  - `SecretKey::new` now takes a `Secp256k1` rather than a Rng; a
    future commit will allow specifying the Rng in the `Secp256k1`
    so that functionality is not lost.

  - The FFI functions have all changed to take a context argument

  - `secp256k1::init()` is gone, as is the dependency on std::sync

  - There is a `ffi::Context` type which must be handled carefully
    by anyone using it directly (hopefully nobody :))
2015-04-11 12:52:54 -05:00