Commit Graph

168 Commits

Author SHA1 Message Date
Tobin Harding 3ca7f499e0 Add fixed-width-serde integration tests
Add a `tests` directory. Add `serde` tests for the recently added fixed
width binary serialization code.

Please note, serialization is only fixed width when serialized with
the `bincode` crate.
2022-06-09 16:17:11 +10:00
Elichai Turkel 5d2f1ceb64
Fix WASM build 2022-06-07 23:59:44 +03:00
Elichai Turkel 7d3a149ca5
Move more things from the std feature to the alloc feature 2022-06-07 23:59:42 +03:00
Elichai Turkel ebe46a4d4e
Update rand to 0.8 and replace CounterRng with mock::StepRng 2022-06-07 23:59:40 +03:00
Elichai Turkel 626835f540
Update secp256k1 to edition 2018 and fix imports 2022-06-07 23:59:25 +03:00
Elichai Turkel c1bb316675
Make global-context-less-secure actually enable the global context 2022-03-28 16:39:06 +03:00
Dominik Spicher 463148f9a0 bump version to 0.22.1 2022-03-10 22:38:25 +01:00
Andrew Poelstra 8294ea3f50 secp256k1-sys: update upstream library
Two API changes needed to be reflected: schnorrsig_sign and schnorrsig_verify.

Also bump both Cargo.toml files
2022-03-08 19:45:41 +00:00
Tobin Harding 6bcf3ea0d0 Add bitcoin-hashes-std features
Currently we use 'no default features' for the `bitcoin_hashes`
dependency. Doing so means that if users want the `std` feature they
need to explicitly add a `bitcoin_hashes` dependency even though we
re-export `bitcoin_hashes` as `hashes`. This means that in the common
case the re-export is pointless. As an example, `rust-bitcoin`
unnecessarily requires an explicit dependency on `bitcoin_hashes`.

Add `bitcoin-hashes-std` feature so that users do not need an explicit
dependency in the common use case.

Change the test matrix to only test '*-std' features when 'std' is
enabled since enabling one without the other is illogical. Please note,
this replaces the test run of feature 'std'+'rand'+'rand-std' with just
'std'+'rand-std' because enabling 'rand-std' enables 'rand' so the
explicit additional feature is redundant.
2022-03-08 10:44:21 +11:00
Tobin Harding 555833b70f
Disable bitcoin_hashes default features
Currently we use default features for the `bitcoin_hashes` dependency,
doing so breaks the `no-std` feature in `rust-bitcoin` because `std` is
part of `bitcoin_hashes` default feature set.

Disable `bitcoin_hashes` default features, no changes to `rust-bitcoin`
are require after this change since we manually turn on `std` and
`alloc` as part of the `std`/`no-std` features of `rust-bitcoin`.

For other users of `rust-secp256k1` this is a breaking change but is
unlikely to cause too much bother because `std` is so commonly used.
2022-03-01 16:24:05 +00:00
Tobin Harding b6f169f083
Improve manifest whitespace
Mirror the whitespacing in `rust-bitcoin` by doing:

- Only use single line of whitespace between sections
- Separate optional dependencies from non-optional ones
2022-03-01 16:22:37 +00:00
Andrew Poelstra ce255fdfe1
Merge rust-bitcoin/rust-secp256k1#390: bump version to 0.21.3
65d32af6fd bump version to 0.21.3 (Andrew Poelstra)

Pull request description:

  We've got a ton of minor changes in, plus fixing the Parity type and adding some extra serde impls. Let's push a minor version out so that we can move on to updating the upstream libsecp.

Top commit has no ACKs.

Tree-SHA512: 584c03106124b4152b8971ac6d0587a26d2aca9187f88d8228a356c2327bf066d2c9b8134149f9ee3bc5f3712f64559b32843aa8e92d3395c5a1bd53de5442ce
2022-02-23 18:45:12 +00:00
Andrew Poelstra 65d32af6fd bump version to 0.21.3 2022-02-17 17:20:41 +00:00
Andrew Poelstra 2a25e5eae8 restore `global-context-less-secure` feature 2022-02-16 23:46:52 +00:00
Tobin Harding a0465ea279 Remove feature global-context-less-secure
Instead of providing a mechanism for users to opt out of randomization
we can just feature gate the call site i.e., opportunistically randomize
the global context on creation if `rand-std` feature is enabled.
2022-02-04 08:34:39 +11:00
Tobin Harding a79840eca2 Be explicit about example feature requirements
The examples depend on having the "std" feature [1]. In preparation for
being able to run tests with `--no-default-features` add the "std"
feature as a requirement for all three examples. While we are at it use
the correct rand feature requirement: `rand-std`.

[1] Technically we only need "alloc" but "alloc" is not working with
Rust 1.29 currently so just use "std".
2022-02-01 15:20:06 +11:00
Martin Habovstiak d52ab85dd5 Added missing features to docs.rs config
These features were previously forgotten and without them the docs.rs
doc is not that great. :(
2022-01-07 01:12:41 +01:00
sanket1729 1671dfc2ed Release 0.21.2 2022-01-06 23:57:28 +05:30
Andrew Poelstra 74e8fc7699
Merge rust-bitcoin/rust-secp256k1#360: Re-export Parity struct
e595b39510 Re-export Parity struct (sanket1729)

Pull request description:

  pub struct Parity is under a private module key and not re-exported in lib.rs . It is therefore not
  possible to use it downstream.

ACKs for top commit:
  elichai:
    ACK e595b39510
  apoelstra:
    ACK e595b39510

Tree-SHA512: 2573689f9a08505c8dfe8f79cd921d5a2742a2a2f4f92cf4066fe6557c765c756531d13560fa4fe6461f094b0c11a52aca30b44542eb77eda7dd1ebd24d3b155
2022-01-06 15:46:18 +00:00
Andrew Poelstra 88f6baee73
Merge rust-bitcoin/rust-secp256k1#353: Documented features
18f74d5242 Clarify what does "less security" mean (Martin Habovstiak)
94c55b4d09 Fixed typos/grammar mistakes (Martin Habovštiak)
1bf05523f0 Documented features (Martin Habovstiak)

Pull request description:

  This documents the Cargo features making sure docs.rs shows warning for
  feature-gated items. They are also explicitly spelled out in the crate
  documentation.

  The PR is similar in spirit to https://github.com/rust-bitcoin/rust-bitcoin/pull/633

ACKs for top commit:
  apoelstra:
    ACK 18f74d5242

Tree-SHA512: 8aac3fc5fd8ee887d6b13606d66b3d11ce44662afb92228c4f8da6169e3f70ac6a005b328f427a91d307f8d36d091dcf24bfe4d17dfc034d02b578258719a90a
2022-01-06 15:42:32 +00:00
sanket1729 e595b39510 Re-export Parity struct
pub struct Parity is under a private module key. It is therefore not
possible to use it downstream.
2022-01-06 09:08:59 +05:30
Andrew Poelstra c50411f798 release secp256k1-sys 0.4.2; make new `ZERO` type publically accessible 2022-01-05 15:56:49 +00:00
Martin Habovstiak 1bf05523f0 Documented features
This documents the Cargo features making sure docs.rs shows warning for
feature-gated items. They are also explicitly spelled out in the crate
documentation.
2022-01-04 16:55:01 +01:00
Andrew Poelstra c3df9b89a2 Release 0.21.0 2022-01-04 14:30:00 +00:00
Andrew Poelstra cd62343407
Merge rust-bitcoin/rust-secp256k1#326: Bump bitcoin_hashes to version 0.10
bc42529a16 Rename `secp256k1::bitcoin_hashes` module to `secp256k1::hashes` (Thomas Eizinger)
ae1f8f4609 Bump bitcoin_hashes to version 0.10 (Thomas Eizinger)

Pull request description:

  Requires for interoperability of the `ThirtyTwoByteHash` trait with
  rust-bitcoin.

ACKs for top commit:
  apoelstra:
    ACK bc42529a16

Tree-SHA512: 85fcb284ff82b543a0c3ea2b568351b3af938a26ac42c6a975480ae97def84e4f0795105bd4572f930a7bf82654eba416cf0c5e25f62809e2ea331443ffb5807
2021-09-09 13:19:49 +00:00
Thomas Eizinger ae1f8f4609
Bump bitcoin_hashes to version 0.10
Requires for interoperability of the `ThirtyTwoByteHash` trait with
rust-bitcoin.
2021-09-08 15:40:47 +10:00
Dr Maxim Orlovsky 7e2f7fef72
Adding KeyPair::serialize_sec. Closes #298 2021-06-19 14:02:48 +02:00
Andrew Poelstra 05f4278499
Merge pull request #306 from LNP-BP/extrakeys/update-1
Extracting SecretKey and uncompressed PublicKey from BIP-350 KeyPair
2021-06-18 22:13:47 +00:00
Dr Maxim Orlovsky 455ee57ba4
Bump sys version to 0.4.1 2021-06-18 23:47:24 +02:00
Andrew Poelstra dce8a5d645 bump version to 0.20.3 2021-06-10 14:46:30 +00:00
Devrandom b5ff47a1a8 New alloc feature
Allows use of `Secp256k1::new` and related API if an allocator is available
2021-06-08 20:41:49 +02:00
Matt Corallo ce930ab6b7 Add a global-context-less-secure feature which skips randomization
This is useful for us downstream as we wish to target WASM with a
global context, and using rand in such a build doesn't seem like a
safe idea.
2021-06-08 01:48:50 +00:00
Andrew Poelstra 5307f9ba6c release secp256k1 0.20.2 2021-04-27 22:16:58 +00:00
Andrew Poelstra ca3caf9c94 bump version to 0.20.1 2021-01-11 19:15:10 +00:00
Andrew Poelstra c4d2fefa70 rust-secp 0.20.0 2020-12-29 19:31:24 +00:00
Andrew Poelstra e687622a81 bump secp-sys version; drop endomorphism flag 2020-12-29 17:15:56 +00:00
Elichai Turkel 21f231bf4d
Make test.sh test and build secp256k1-sys 2020-12-23 12:01:34 +02:00
Andrew Poelstra 85075a654c replace `fuzztarget` Cargo feature with a rustc --cfg flag
It's super dangerous to use Cargo features for this, since they can be set
accidentally (or maliciously by any crate in a user's entire dep tree). Instead
we can just require users set `RUSTFLAGS` appropriately, which we can easily
do in our fuzzing scripts.
2020-12-22 15:42:02 +00:00
Andrew Poelstra d77483f00e replace cargo `external-symbols` feature with a rustc --cfg flag
This feature was not useful for Cargo users, since Cargo does not give you
the kind of fine-grained control over C library linkage that you need. So
it was just unnecessarily confusing and would cause the build to break if
you enabled it accidentally, say, with --all-features.
2020-12-22 15:35:16 +00:00
Andrew Poelstra be9a78f39e
Merge pull request #237 from p2pderivatives/add-bip340-schnorr
Add bip340 schnorr
2020-11-27 18:04:44 +00:00
Tibo-lg 45a4459baf Update secp256k1-sys to add schnorr/extra-keys 2020-11-09 16:00:28 +09:00
Artem Vorotnikov bc81930a89
global-context depends on rand-std 2020-11-07 01:17:22 +03:00
Elichai Turkel 6511fad231
Sort Cargo.toml files 2020-08-27 22:58:00 +03:00
Andrew Poelstra 19f5138925 Update MSRV to 1.29; increase version to 0.19 and -sys version to 0.3 2020-08-27 14:18:06 +00:00
Andrew Poelstra 060648775e bump version to 0.18.0 2020-08-26 21:16:22 +00:00
Andrew Poelstra f19c6bbece bump secp-sys version to 0.2.0 2020-08-26 18:07:44 +00:00
Sebastian Geisler 2046a40905 Randomize context on initialization
Signed-off-by: Sebastian Geisler <sebastian@blockstream.io>
2020-08-03 12:07:26 +02:00
Sebastian Geisler a959de4174 Add an optional global, static context 2020-07-08 16:05:42 +02:00
Sebastian Geisler 0d857533fa Add optional bitcoin_hashes feature to implement ThirtyTwoByteHash 2020-05-14 18:24:39 +02:00
Matt Corallo d9d398ccc9 Re-support WASM via simple stub headers
libsecp256k1 really only barely uses libc at all, and in practice,
things like memcpy/memcmp get optimized into something other than a
libc call. Thus, if we provide simple stub headers, things seem to
work with wasm-pack just fine.
2020-04-29 15:32:54 -04:00