Skip to content

Commit

Permalink
Update crate metadata and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaseizinger committed Dec 15, 2020
1 parent 844a7a2 commit b2a7d2a
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 207 deletions.
8 changes: 5 additions & 3 deletions .dprintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
"$schema": "https://dprint.dev/schemas/v0.json",
"projectType": "openSource",
"incremental": true,
"includes": ["**/*.{rs}"],
"includes": ["**/*.{rs,md}"],
"excludes": [
"secp256k1-zkp-sys/build.rs"
"secp256k1-zkp-sys/build.rs",
"secp256k1-zkp-sys/depend/**"
],
"plugins": [
"https://plugins.dprint.dev/rustfmt-0.3.0.wasm"
"https://plugins.dprint.dev/rustfmt-0.3.0.wasm",
"https://plugins.dprint.dev/markdown-0.4.3.wasm"
]
}
131 changes: 4 additions & 127 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,6 @@
# [Unreleased]

# 0.19.0 - 2020-08-27

* **Update MSRV to 1.29.0**

# 0.18.0 - 2020-08-26

* Add feature-gated `bitcoin_hashes` dependency and [`ThirtyTwoByteHash` trait](https://github.com/rust-bitcoin/rust-secp256k1/pull/206/)
* Add feature-gated [global static context](https://github.com/rust-bitcoin/rust-secp256k1/pull/224)
* Allow [all-zero messages](https://github.com/rust-bitcoin/rust-secp256k1/pull/207) to be constructed
* Bump rust-secp-sys to 0.2.0

# 0.17.2
- Fix linking in the `fuzztarget` feature.

# 0.17.1

- Correctly prefix the secp256k1-sys links field in Cargo.toml.

# 0.17.0

- Move FFI into secp256k1-sys crate.
- Add `external-symbols` feature for not building upstream.
- Add functions to create a context from a raw pointer.
- Support passing custom hash functions to ECDH.
- Wrap Secp256k1 from raw context in a ManuallyDrop.

# 0.15.4 - 2019-09-06

- Add `rand-std` feature.
- Pin the cc build-dep version to `< 1.0.42` to remain
compatible with rustc 1.22.0.
- Changed all `as_*ptr()` to a new safer `CPtr` trait

# 0.15.2 - 2019-08-08

- Add feature `lowmemory` that reduces the EC mult window size to require
significantly less memory for the validation context (~680B instead of
~520kB), at the cost of slower validation. It does not affect the speed of
signing, nor the size of the signing context.

# 0.15.0 - 2019-07-25

* Implement hex human-readable serde for PublicKey
* Implement fmt::LowerHex for SecretKey and PublicKey
* Relax `cc` dependency requirements
* Add links manifest key to prevent cross-version linkage

# 0.14.1 - 2019-07-14

* Implemented FFI functions: `secp256k1_context_create` and `secp256k1_context_destroy` in rust.

# 0.14.0 - 2019-07-08

* [Feature-gate endormorphism optimization](https://github.com/rust-bitcoin/rust-secp256k1/pull/120)
because of a lack of clarity with respect to patents
* Got full no-std support including eliminating all use of libc in C bindings.
[PR 1](https://github.com/rust-bitcoin/rust-secp256k1/pull/115)
[PR 2](https://github.com/rust-bitcoin/rust-secp256k1/pull/125).
This library should be usable in bare-metal environments and with rust-wasm.
Thanks to Elichai Turkel for driving this forward!
* Update upstream libsecp256k1 version to 143dc6e9ee31852a60321b23eea407d2006171da

# 0.13.0 - 2019-05-21

* Update minimum supported rust compiler 1.22.
* Replace `serialize_der` function with `SerializedSignature` struct.
* Allow building without a standard library (`no_std`). `std` feature is on by default.
* Add human readable serialization to `Signatures` and `SecretKeys`.
* Stop displaying 0 bytes if a `Signature` is less than 72 bytes.
* Only compile recovery module if feature `recovery` is set (non-default).
* Update `rand` dependency from 0.4 to 0.6 and add `rand_core` 0.4 dependency.
* Relax `cc` dependency requirements.

# 0.12.2 - 2019-01-18

* Fuzzer bug fix

# 0.12.1 - 2019-01-15

* Minor bug fixes
* Fixed `cc` crate version to maintain minimum compiler version without breakage
* Removed `libc` dependency as it our uses have been subsumed into stdlib

# 0.12.0 - 2018-12-03

* **Overhaul API to remove context object when no precomputation is needed**
* Add `ThirtyTwoByteHash` trait which allows infallible conversions to `Message`s
* Disallow 0-valued `Message` objects since signatures on them are forgeable for all keys
* Remove `ops::Index` implementations for `Signature`
* Remove depecated constants and unsafe `ZERO_KEY` constant

# 0.11.5 - 2018-11-09

* Use `pub extern crate` to export dependencies whose types are exported

# 0.11.4 - 2018-11-04

* Add `FromStr` and `Display` for `Signature` and both key types
* Fix `build.rs` for Windows and rustfmt configuration for docs.rs
* Correct endianness issue for `Signature` `Debug` output

# 0.11.3 - 2018-10-28

* No changes, just fixed docs.rs configuration

# 0.11.2 - 2018-09-11

* Correct endianness issue in RFC6979 nonce generation

# 0.11.1 - 2018-08-22

* Put `PublicKey::combine` back because it is currently needed to implement Lightning BOLT 3

# 0.11.0 - 2018-08-22

* Update `rand` to 0.4 and `gcc` 0.3 to `cc` 1.0. (`rand` 0.5 exists but has a lot of breaking changes and no longer compiles with 1.14.0.)
* Remove `PublicKey::combine` from API since it cannot be used with anything else in the API
* Detect whether 64-bit compilation is possible, and do it if we can (big performance improvement)

# 0.10.0 - 2018-07-25

* A [complete API overhaul](https://github.com/rust-bitcoin/rust-secp256k1/pull/27) to move many runtime errors into compiletime errors
* Update [libsecp256k1 to `1e6f1f5ad5e7f1e3ef79313ec02023902bf8`](https://github.com/rust-bitcoin/rust-secp256k1/pull/32). Should be no visible changes.
* [Remove `PublicKey::new()` and `PublicKey::is_valid()`](https://github.com/rust-bitcoin/rust-secp256k1/pull/37) since `new` was unsafe and it should now be impossible to create invalid `PublicKey` objects through the API
* [Reintroduce serde support](https://github.com/rust-bitcoin/rust-secp256k1/pull/38) behind a feature gate using serde 1.0
* Clean up build process and various typos

## Added

- Initialize repository from [`rust-secp256k1`](https://github.com/rust-bitcoin/rust-secp256k1)
- Add bindings for generators, pedersen commitments and range proofs
14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
name = "secp256k1-zkp"
version = "0.1.0"
authors = [ "Dawid Ciężarkiewicz <[email protected]>",
"Andrew Poelstra <[email protected]>" ]
"Andrew Poelstra <[email protected]>",
"Lucas Soriano <[email protected]>",
"Thomas Eizinger <[email protected]>" ]
license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-secp256k1/"
repository = "https://github.com/rust-bitcoin/rust-secp256k1/"
documentation = "https://docs.rs/secp256k1/"
description = "Rust bindings for Pieter Wuille's `libsecp256k1` library. Implements ECDSA for the SECG elliptic curve group secp256k1 and related utilities."
keywords = [ "crypto", "ECDSA", "secp256k1", "libsecp256k1", "bitcoin" ]
homepage = "https://github.com/comit-network/rust-secp256k1-zkp/"
repository = "https://github.com/comit-network/rust-secp256k1-zkp/"
description = "Rust bindings for the `libsecp256k1-zkp` library."
keywords = [ "crypto", "ECDSA", "secp256k1-zkp", "libsecp256k1-zkp", "elements" ]
readme = "README.md"
autoexamples = false # Remove when edition 2018 https://github.com/rust-lang/cargo/issues/5330

Expand Down Expand Up @@ -42,7 +43,6 @@ bitcoin_hashes = { version = "0.9", optional = true }
rand = { version = "0.6", default-features = false, optional = true }
serde = { version = "1.0", default-features = false, optional = true }


[dev-dependencies]
rand = "0.6"
rand_core = "0.4"
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
[![Build Status](https://travis-ci.org/rust-bitcoin/rust-secp256k1.png?branch=master)](https://travis-ci.org/rust-bitcoin/rust-secp256k1)
![Continuous integration](https://github.com/comit-network/rust-secp256k1-zkp/workflows/Continuous%20integration/badge.svg)

[Full documentation](https://docs.rs/secp256k1/)
### rust-secp256k1-zkp

### rust-secp256k1
`rust-secp256k1-zkp` is a wrapper around [libsecp256k1-zkp](https://github.com/ElementsProject/secp256k1-zkp) that also
re-exports all bindings from [`rust-secp256k1`](https://github.com/rust-bitcoin/rust-secp256k1).
As such, all of its types - `SecretKey`, `Context`, etc - are interoperable with the ones defined in `rust-secp256k1`.

`rust-secp256k1` is a wrapper around [libsecp256k1](https://github.com/bitcoin-core/secp256k1),
a C library by Pieter Wuille for producing ECDSA signatures using the SECG curve
`secp256k1`. This library
* exposes type-safe Rust bindings for all `libsecp256k1` functions
* implements key generation
* implements deterministic nonce generation via RFC6979
* implements many unit tests, adding to those already present in `libsecp256k1`
* makes no allocations (except in unit tests) for efficiency and use in freestanding implementations
In addition to everything from `rust-secp256k1`, this library adds type-safe Rust bindings for the following modules:

- generators
- range proofs
- pedersen commitments

### Contributing

Contributions to this library are welcome. A few guidelines:

* Any breaking changes must have an accompanied entry in CHANGELOG.md
* No new dependencies, please.
* No crypto should be implemented in Rust, with the possible exception of hash functions. Cryptographic contributions should be directed upstream to libsecp256k1.
* This library should always compile with any combination of features on **Rust 1.29**.
- Any breaking changes must have an accompanied entry in CHANGELOG.md
- No new dependencies, please.
- No crypto should be implemented in Rust, with the possible exception of hash functions. Cryptographic contributions should be directed upstream to libsecp256k1.
- This library should always compile with any combination of features on **Rust 1.29**.

## A note on Rust 1.29 support

Expand All @@ -29,6 +28,7 @@ To ensure compilation with Rust 1.29.0, pin its version in your `Cargo.lock`
with `cargo update -p cc --precise 1.0.41`. If you're using `secp256k1` in a library,
to make sure it compiles in CI, you'll need to generate a lockfile first.
Example for Travis CI:

```yml
before_script:
- if [ "$TRAVIS_RUST_VERSION" == "1.29.0" ]; then
Expand Down
17 changes: 4 additions & 13 deletions secp256k1-zkp-sys/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# [Unreleased]

# 0.3.0 - 2020-08-27

* **Update MSRV to 1.29.0**

# 0.2.0 - 2020-08-26

* Update upstream to `670cdd3f8be25f81472b2d16dcd228b0d24a5c45`
* [Add missing return](https://github.com/rust-bitcoin/rust-secp256k1/pull/195) `c_int` to `NonceFn`
* [Got wasm support working again](https://github.com/rust-bitcoin/rust-secp256k1/pull/208)
* Removed `cc` restriction, rustc 1.22 support [now requires some downstream effort](https://github.com/rust-bitcoin/rust-secp256k1/pull/204)
* [Exposed a reference to the underlying byte array](https://github.com/rust-bitcoin/rust-secp256k1/pull/219) for all byte-array-wrapping types
* Allow all-zeroes `Message` [to be constructed](https://github.com/rust-bitcoin/rust-secp256k1/pull/207)
* Expose `secp256k1_ec_pubkey_negate` [from upstream](https://github.com/rust-bitcoin/rust-secp256k1/pull/222)
## Added

- Initialize repository from [`rust-secp256k1-sys`](https://github.com/rust-bitcoin/rust-secp256k1/tree/master/secp256k1-sys)
- Add bindings for generators, range proofs and pedersen commitments
13 changes: 7 additions & 6 deletions secp256k1-zkp-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ name = "secp256k1-zkp-sys"
version = "0.1.0"
authors = [ "Dawid Ciężarkiewicz <[email protected]>",
"Andrew Poelstra <[email protected]>",
"Steven Roose <[email protected]>" ]
"Steven Roose <[email protected]>",
"Lucas Soriano <[email protected]>",
"Thomas Eizinger <[email protected]>" ]
license = "CC0-1.0"
homepage = "https://github.com/rust-bitcoin/rust-secp256k1/"
repository = "https://github.com/rust-bitcoin/rust-secp256k1/"
documentation = "https://docs.rs/secp256k1-sys/"
description = "FFI for Pieter Wuille's `libsecp256k1` library."
keywords = [ "secp256k1", "libsecp256k1", "ffi" ]
homepage = "https://github.com/comit-network/rust-secp256k1-zkp/"
repository = "https://github.com/comit-network/rust-secp256k1-zkp/"
description = "FFI for `libsecp256k1-zkp` library."
keywords = [ "secp256k1", "libsecp256k1-zkp", "ffi" ]
readme = "README.md"
build = "build.rs"
links = "rustsecp256k1zkp_v0_1_0"
Expand Down
23 changes: 10 additions & 13 deletions secp256k1-zkp-sys/README.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
secp256k1-sys
=============

# secp256k1-zkp-sys

This crate provides Rust definitions for the FFI structures and methods.


## Vendoring

The default build process is to build using the vendored libsecp256k1 sources in
The default build process is to build using the vendored libsecp256k1-zkp sources in
the depend folder. These sources are prefixed with a special
rust-secp256k1-sys-specific prefix `rustsecp256k1_v1_2_3_`.
rust-secp256k1-zkp-sys-specific prefix `rustsecp256k1zkp_v1_2_3_`.

This prefix ensures that no symbol collision can happen:
- when a Rust project has two different versions of rust-secp256k1 in its

- when a Rust project has two different versions of rust-secp256k1-zkp in its
depepdency tree, or
- when rust-secp256k1 is used for building a static library in a context where
existing libsecp256k1 symbols are already linked.
- when rust-secp256k1-zkp is used for building a static library in a context where
existing libsecp256k1-zkp symbols are already linked.

To update the vendored sources, use the `vendor-libsecp.sh` script:

```
$ ./vendor-libsecp.sh depend <version-code> <rev>
```

- Where `<version-code>` is the secp256k1-sys version number underscored: `0_1_2`.
- Where `<rev>` is the git revision of libsecp256k1 to checkout.

- Where `<version-code>` is the secp256k1-zkp-sys version number underscored: `0_1_2`.
- Where `<rev>` is the git revision of libsecp256k1-zkp to checkout.

## Linking to external symbols

For the more exotic use cases, this crate can be used with existing libsecp256k1
For the more exotic use cases, this crate can be used with existing libsecp256k1-zkp
symbols by using the `external-symbols` feature. How to setup rustc to link
against those existing symbols is left as an exercise to the reader.
2 changes: 1 addition & 1 deletion secp256k1-zkp-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//
//! # secp256k1-sys FFI bindings
//! # secp256k1-zkp-sys FFI bindings
//! Direct bindings to the underlying C library functions. These should
//! not be needed for most users.
Expand Down
37 changes: 15 additions & 22 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,21 @@
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
//

//! # Secp256k1
//! Rust bindings for Pieter Wuille's secp256k1 library, which is used for
//! fast and accurate manipulation of ECDSA signatures on the secp256k1
//! curve. Such signatures are used extensively by the Bitcoin network
//! and its derivatives.
//!
//! To minimize dependencies, some functions are feature-gated. To generate
//! random keys or to re-randomize a context object, compile with the "rand"
//! feature. To de/serialize objects with serde, compile with "serde".
//!
//! Where possible, the bindings use the Rust type system to ensure that
//! API usage errors are impossible. For example, the library uses context
//! objects that contain precomputation tables which are created on object
//! construction. Since this is a slow operation (10+ milliseconds, vs ~50
//! microseconds for typical crypto operations, on a 2.70 Ghz i7-6820HQ)
//! the tables are optional, giving a performance boost for users who only
//! care about signing, only care about verification, or only care about
//! parsing. In the upstream library, if you attempt to sign a message using
//! a context that does not support this, it will trigger an assertion
//! failure and terminate the program. In `rust-secp256k1`, this is caught
//! at compile-time; in fact, it is impossible to compile code that will
//! trigger any assertion failures in the upstream library.
//! # Secp256k1-zkp
//!
//! Rust bindings for libsecp256k1-zkp, a fork of Pieter Wuille's secp256k1 library.
//!
//! This library re-exports everything from `secp256k1` and adds bindings for the following modules:
//!
//! - generators
//! - range proofs
//! - pedersen commitments
//!
//! As such, it can be used as a drop-in replacement for `secp256k1`. All types are interoperable
//! (as long as you are dependening on the correct version) which means [`SecretKey`]s and the [`Context`]
//! are interoperable.
//!
//! ## Examples
//!
//! ```rust
//! # #[cfg(all(feature="use-rand", feature="hashes"))] {
Expand Down

0 comments on commit b2a7d2a

Please sign in to comment.