Commit Graph

600 Commits

Author SHA1 Message Date
Dr Maxim Orlovsky 455ee57ba4
Bump sys version to 0.4.1 2021-06-18 23:47:24 +02:00
Dr Maxim Orlovsky aa6bdaff3c
Creating SecretKey and PublicKey from BIP-340 KeyPair 2021-06-16 10:56:59 +02:00
Dr. Maxim Orlovsky 4652ab6116 Updating secp256k1 version to 1758a92ffd896af533b142707e9892ea6e15e5db 2021-06-14 17:55:38 +03:00
Andrew Poelstra bb25ed4715
Merge pull request #282 from TheBlueMatt/2021-02-redo-fuzz
Reduce cryptography usage in --cfg=fuzzing
2021-06-09 15:01:52 +00:00
Elichai Turkel 65a2b4f3cb
Merge pull request #300 from devrandom/alloc
New alloc feature
2021-06-09 11:09:07 +03:00
Matt Corallo 79119e8123 Skip context randomization in fuzzing to improve performance 2021-06-08 19:17:08 +00:00
Matt Corallo c486ca10c7 Use a global static context in fuzzing, reducing overhead 2021-06-08 19:17:08 +00:00
Matt Corallo 940a51c2c6 Reduce cryptography usage in --cfg=fuzzing
This reduces the usage of real cryptography in --cfg=fuzzing,
specifically replacing the secret->public key derivation with a
simple copy and ECDH with XOR of the public and private parts
(plus a stream of 1s to make a test pass that expected non-0
output).

It leaves secret tweak addition/multiplication as-is.

It also changes the context creation to over-allocate and store
the context flags at the end of the context buffer, allowing us
to easily test context flags in each function.

While it would be nice to have something fancier (eg XOR-based),
its not immediately obvious how to accomplish this, and better to
fix the issues I have than spend too much time on it.

Fixes #271.

This partially reverts b811ec133a
2021-06-08 19:17:08 +00:00
Matt Corallo f2e4b297e1 Do not test secret->public derivation or pk validity in fuzzing cfg
In the next commit the secret->public key derivation in fuzzing cfg
is changed to be simpler, as well as the validity rules of public
keys relaxed.

This adds a new test to ensure random keys can be added, not just
the hard-coded keys test that exists today.
2021-06-08 19:17:07 +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
Andrew Poelstra 5ff59f7f5c
Merge pull request #289 from TheBlueMatt/2021-03-no-vis
Reduce visibility on secp-sys symbols
2021-06-08 18:12:55 +00:00
Andrew Poelstra e89fd5d269
Merge pull request #291 from p2pderivatives/add-combine-keys
Add combine_keys function to PublicKey
2021-06-08 18:09:35 +00:00
Andrew Poelstra a5dfd09e94
Merge pull request #294 from LNP-BP/feat/from_secret_key
Adding schnorrsig::KeyPair::from_secret_key convenience function
2021-06-08 18:05:20 +00:00
Andrew Poelstra b686de76fb
Merge pull request #279 from TheBlueMatt/master
Add a global-context-less-secure feature which skips randomization
2021-06-08 02:09:25 +00: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
Elichai Turkel cf8921a338
Merge pull request #302 from jules23/recovery-no-std-test
Touch recovery module in no_std_test
2021-05-23 12:02:47 +03:00
Jules Comte c925644b74 Touch recovery module in no_std_test 2021-05-20 07:18:42 -06:00
Elichai Turkel a66f581b36
Merge pull request #296 from sanket1729/seckey_fromstr
Fix SecretKey FromStr bug
2021-04-29 11:34:57 +03:00
Andrew Poelstra b48d1eafc5
Merge pull request #297 from apoelstra/2021-04--0.20.2
release secp256k1 0.20.2
2021-04-28 16:19:38 +00:00
Andrew Poelstra 5307f9ba6c release secp256k1 0.20.2 2021-04-27 22:16:58 +00:00
sanket1729 6265b2558a Fix SecretKey FromStr bug
Secret::from_str did not check if the secret key
was a valid one or not.
2021-04-26 14:17:39 -07:00
Elichai Turkel 3c2bee31f2
Merge pull request #270 from thomaseizinger/serde-owned-types
Rebased version of `[Alternative] Allow deserializing from owned types` + support for new schnorr module
2021-04-21 19:06:29 +03:00
Dr Maxim Orlovsky bf9a276342
Adding schnorrsig::KeyPair::from_secret_key convenience function 2021-04-12 15:25:50 +02:00
Tibo-lg 7d32182537 Add combine_keys function to PublicKey 2021-04-08 06:28:03 +09:00
Matt Corallo ee1103a1f3 Reduce visibility on secp-sys symbols
cc-rs builds C dependencies with reduced visibility to avoid
exporting the C symbols all the way out to any rust-built shared
libraries however we override it with SECP256K1_API. We should
avoid doing this, allowing LTO/DCE to do its work.
2021-04-07 11:21:16 -04:00
Andrew Poelstra 63f4de78ce
Merge pull request #290 from real-or-random/202103_panic_from_c
Manually test that panicking from C will abort the process
2021-04-07 15:00:58 +00:00
Tim Ruffing 1eb2c32df7 Manually test that panicking from C will abort the process
Panicking from C is not UB in newer rust versions and will reliably
trigger an abort (without unwinding). In older rust versions, it is
technically UB but empirically it seems to "just work" (and what should
it realistically do except crashing, which is what we intent).

Since there's potentially no unwinding, we can't test this behavior
using [should_panic]. This PR will instead check the libtest output
explicitly in our CI tests.

Fixes #228.
2021-03-24 21:54:02 +01:00
Andrew Poelstra 4ae0e7ebd1
Merge pull request #284 from fanatid/patch-1
Use CARGO_CFG_TARGET_ARCH instead TARGET in build.rs
2021-03-12 19:18:24 +00:00
Kirill Fomichev 0a91f2ba2b
Use CARGO_CFG_TARGET_ARCH instead TARGET in build.rs 2021-03-08 22:54:21 +03:00
Andrew Poelstra 3bff596948
Merge pull request #277 from LNP-BP/fix/error-derive
More standard derives for Error
2021-02-10 18:03:34 +00:00
Dr Maxim Orlovsky 519857cd83
More standard derives for Error 2021-01-30 12:35:41 +01:00
Andrew Poelstra 8e61874d77
Merge pull request #275 from gregdhill/master
use core instead of std for wasm sanity checks
2021-01-25 16:00:35 +00:00
Gregory Hill c86808fac7
use core instead of std for wasm sanity checks
Signed-off-by: Gregory Hill <gregorydhill@outlook.com>
2021-01-20 14:55:48 +00:00
Andrew Poelstra a24e27e94b
Merge pull request #269 from apoelstra/2021-01--rename-fuzz-feature
Rename `rust_secp_fuzz` config flag to `fuzzing`
2021-01-15 15:00:23 +00:00
Thomas Eizinger c2fd5cefa4
Remove `visit_bytes` implementation from `FromStrVisitor`
This visitor is meant to deserialize strings using `FromStr` not
bytes.
2021-01-13 09:57:09 +11:00
Thomas Eizinger e6e23e9dd6
Rename `HexVisitor` to `FromStrVisitor`
The visitor works with all types that implement `FromStr`. Whether or
not that ends up being hex encoding depends on the implementation
of `FromStr`.
2021-01-13 09:54:33 +11:00
Thomas Eizinger 18890d3b86
Extend schnorr-sig serde test suite with owned and slice variants 2021-01-12 11:52:24 +11:00
Thomas Eizinger b4040f0a82
Update test names to reflect what they are doing
These tests are testing more than just the signature serialization.
2021-01-12 11:52:06 +11:00
Elichai Turkel 1f08a313e5
Replace serde macros with generic visitor module
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
Co-authored-by: Sebastian Geisler <sebastian@blockstream.io>
2021-01-12 11:51:29 +11:00
Andrew Poelstra ca3caf9c94 bump version to 0.20.1 2021-01-11 19:15:10 +00:00
Andrew Poelstra 65ff814a39 rename `rust_secp_fuzz` to `fuzzing` 2021-01-11 19:14:42 +00:00
Andrew Poelstra 5f1622f917
Merge pull request #257 from apoelstra/2020-12--no-endo
update libsecp, remove endomorphism feature flag and release 0.20.0
2021-01-03 20:10:23 +00:00
Andrew Poelstra c534b54e11
Merge pull request #267 from TheBlueMatt/master
Add ability to randomize context without the `rand` feature.
2020-12-29 22:25:15 +00:00
Matt Corallo 1f043216a0 Add ability to randomize context without the `rand` feature.
There is little reason to pull in the `rand` dep just for the `Rng`
trait for users who want to randomize contexts. We should expose a
randomize function that just takes 32 bytes.
2020-12-29 16:45:07 -05:00
Andrew Poelstra c4d2fefa70 rust-secp 0.20.0 2020-12-29 19:31:24 +00:00
Andrew Poelstra d12be7966c drop unnecessary no_mangle annotations on non-exported functions 2020-12-29 19:30:59 +00:00
Andrew Poelstra 58f946fcc8 secp-sys: remove now-unneeded endianness check from build.rs 2020-12-29 17:15:56 +00:00
Andrew Poelstra e687622a81 bump secp-sys version; drop endomorphism flag 2020-12-29 17:15:56 +00:00
Andrew Poelstra a93d671d05 update libsecp to 98dac87839838b86094f1bccc71cc20e67b146cc 2020-12-29 17:15:51 +00:00
Andrew Poelstra e5d9e088cf secp-sys: update scratch_impl.patch for upstream changes 2020-12-29 17:15:21 +00:00