Commit Graph

9 Commits

Author SHA1 Message Date
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
Andrew Poelstra 1591bba3f9 Update bindings to current secp256k1 library
rust-secp256k1 was based off of https://github.com/sipa/secp256k1,
which has been inactive nearly as long as this repository (prior to
a couple days ago anyway). The correct repository is

   https://github.com/bitcoin/secp256k1

This is a major breaking change to the library for one reason: there
are no longer any Nonce types in the safe interface. The signing functions
do not take a nonce; this is generated internally.

This also means that I was able to drop all my RFC6979 code, since
libsecp256k1 has its own implementation.

If you need to generate your own nonces, you need to create an unsafe
function of type `ffi::NonceFn`, then pass it to the appropriate
functions in the `ffi` module. There is no safe interface for doing
this, deliberately: there is basically no need to directly fiddle
with nonces ever.
2015-04-06 00:13:38 -05:00
Andrew Poelstra 5a6c6c8d0a Fix for secp256k1 ffi changes
All tests pass, compile now
2015-01-17 10:38:16 -06:00
Andrew Poelstra 059c72aa60 Do validation in pubkey::from_slice 2014-08-31 16:04:14 -05:00
Andrew Poelstra a5951eff47 Expose tweak functions in FFI, wrap a couple 2014-08-28 09:16:53 -07:00
Andrew Poelstra 83f2ccf5d7 Add verification to SecretKey::from_slice() 2014-08-24 16:13:08 -07:00
Andrew Poelstra db37829904 Add CC0 license and header to all files 2014-08-11 19:26:45 -07:00
Andrew Poelstra 5b15918a9a Move FFI and constants into their own modules; replace outptrs with returns 2014-08-11 19:24:19 -07:00
Andrew Poelstra 448f4829e7 Move FFI functions into separate module; add documentation and style lints 2014-08-11 19:24:19 -07:00