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
Martin Habovstiak
18f74d5242
Clarify what does "less security" mean
2022-01-04 23:20:45 +01:00
Martin Habovštiak
94c55b4d09
Fixed typos/grammar mistakes
...
Co-authored-by: Tobin C. Harding <me@tobin.cc>
2022-01-04 23:16:28 +01: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
Tobin Harding
ede114fb1a
Improve docs on tweak_add_check method
...
It is not immediately apparent what 'err == 1' means, one must determine
that the FFI function call returns 1 for success. We can help readers of
the code by adding a 'Return' section to the method documentation.
Add trailing full stop to method docs initial line also.
2022-01-04 09:19:11 +11:00
Tobin Harding
fbc64c7725
Add opaque parity type
...
Two functions in the FFI secp code return and accept a parity int.
Currently we are manually converting this to a bool. Doing so forces
readers of the code to think what the bool means even though
understanding this bool is not needed since in is just passed back down
to the FFI code. We can abstract this away by using an opaque type to
hold the original int and not converting it to a boolean value.
Add 'Return' and 'Error' sections to `tweak_add_assign` while fixing the
docs to describe the new opaque parity type.
2022-01-04 09:19:05 +11:00
Tobin Harding
1b768b2749
Make tweak_add_assign return statements uniform
...
We have two `tweak_add_assign` methods (one for keypair and one for
x-only pubkey). Both check the return value from a FFI function call.
We can make both sites uniform to _slightly_ reduce cognitive load when
reading the code.
Use C style code to make it obvious to readers that this is basically C
code.
2022-01-04 09:01:34 +11:00
Tobin Harding
edafb88f8c
Move key unit tests to key module
...
There are currently two unit tests in the `schnorr` module that are
testing keys from the `key` module. This is possible because the tests
are only testing the public interface, none the less they are better
placed in the `key` module.
2022-01-04 08:23:05 +11:00
Tobin Harding
e3d21a3d87
Clean up test imports with key module
...
The import statements can be simplified by using an import
wildcard (`super::*`). While we are at it put them in std, external
crate, this crate order.
2022-01-04 08:18:44 +11:00
sanket1729
eab549c46c
Re-export types to reduce breaking changes downstream
2022-01-03 08:55:54 +05:30
Andrew Poelstra
50034ccb18
Merge rust-bitcoin/rust-secp256k1#342 : Change context objects for verification methods
...
21aa914ad2
Change context objects for schnorr sig methods (sanket1729)
Pull request description:
- The current schnorrsig verify methods should operate on verify context
as is done throughout the bitcoin core
- Finally, and importantly the XonlyPublicKey::from_keypair now operates
without any context parameter.
ACKs for top commit:
apoelstra:
ACK 21aa914ad2
Tree-SHA512: 035338f19839805a080eb262ae7b93ab187dabb63086c8b7f6015f3a6006986604dc2c6f329a99a20ddfa78c1ee518f44cd5eee2f73810fbdc83ff8df7d12506
2021-12-24 14:34:07 +00:00
sanket1729
21aa914ad2
Change context objects for schnorr sig methods
...
- The current schnorrsig verify methods should operate on verify context
as is done throughout the bitcoin core
- Scondly, and importantly the XonlyPublicKey::from_keypair now operates
without any context objects.
2021-12-24 00:54:06 +05:30
Dr Maxim Orlovsky
de77518d3a
Serde serialization for KeyPair
2021-11-12 21:18:53 +01:00
Thomas Eizinger
d244b4d747
Fix typo in docs
2021-11-11 13:43:51 +11:00
Thomas Eizinger
c5c95513f2
Move helper function below usage
...
This is not C89. We can declare the more important things first.
2021-11-11 13:43:50 +11:00
Thomas Eizinger
ce4427747d
Move ECDSA functionality into ECDSA module
2021-11-11 13:43:50 +11:00
Thomas Eizinger
e0c3bb28c4
Rename schnorr functions on `Secp256k1` to match naming of ecdsa
...
The naming scheme we employ is `{sign,verify, ...}_{ecdsa,schnorr}`.
2021-11-11 13:43:50 +11:00
Thomas Eizinger
760559c70e
Rename `schnorrsig` module to `schnorr`
...
Schnorr is commenly known as a signature algorithm, we don't need
to restate that in the name of the module.
2021-11-11 13:43:50 +11:00
Thomas Eizinger
d4fb819d80
Move `XOnlyPublicKey` to `key` module
2021-11-11 13:43:49 +11:00
Thomas Eizinger
87d936a765
Rename `schnorr::PublicKey` to `schnorr::XOnlyPublicKey`
...
The public key is unrelated to the signature algorithm. It will
be moved out of the module in another commit. For ease of review,
the renamed is kept separate.
2021-11-11 13:43:49 +11:00
Thomas Eizinger
2e0e731664
Move `KeyPair` to `key` module
...
The `KeyPair` type is semantically unrelated to the schnorr signature
algorithm.
2021-11-11 13:43:48 +11:00
Thomas Eizinger
c47ead9967
Move `Signature` and `SerializedSignature` to new `ecdsa` module
...
With the introduction of Schnorr signatures, exporting a `Signature`
type without any further qualification is ambiguous. To minimize the
ambiguity, the `ecdsa` module is public which should encourage users
to refer to its types as `ecdsa::Signature` and `ecdsa::SerializedSignature`.
To reduce ambiguity in the APIs on `Secp256k1`, we deprecate several
fucntions and introduce new variants that explicitly mention the use of
the ECDSA signature algorithm.
Due to the move of `Signature` and `SerializedSignature` to a new module,
this patch is a breaking change. The impact is minimal though and fixing the
compile errors encourages a qualified naming of the type.
2021-11-11 13:43:48 +11:00
Thomas Eizinger
49c7e21486
Prefer `use super::*` import over manually picking items
...
Tests are usually placed next to the code they are testing. As such,
importing `super::*` is a good starting point.
2021-11-11 13:38:54 +11:00
Thomas Eizinger
52d0554423
Fully qualify Error to simplify imports
2021-11-11 13:38:52 +11:00
Thomas Eizinger
8e96abae39
Make `key` module private
...
We re-export all structs residing in that module. There is no reason
to expose the internal module structure of the library publicly.
2021-11-11 13:38:49 +11:00
Andrew Poelstra
476ced62fe
Merge rust-bitcoin/rust-secp256k1#307 : Fixing documentation for BIP 340-related functions
...
931b560dc7
Fixing documentation for BIP 340-related functions (Dr Maxim Orlovsky)
Pull request description:
ACKs for top commit:
thomaseizinger:
ACK 931b560dc7
apoelstra:
ACK 931b560dc7
Tree-SHA512: d78fbda138e636c04c6f356e2a41fcdd0270eea710a9af6c965ff90acfd6740bd650a8909638c558badd52d307cbdcd914fa25846236b064ca8c38faccec8be8
2021-11-02 18:39:09 +00:00
Andrew Poelstra
6a774bd47c
Merge rust-bitcoin/rust-secp256k1#334 : Use explicit u8 when assigning a byte slice
...
24d6f62603
Use explicit u8 when assigning a byte slice (junderw)
Pull request description:
Is there a way to tell the compiler to not allow `[0; 64]` and require that either the type is explicitly given to the variable, or that each member uses explicit `0u8` notation?
I noticed the usage was a mix of explicit and implicit, so I changed all to explicit.
ACKs for top commit:
apoelstra:
ACK 24d6f62603
Tree-SHA512: f7796dcc3ae240983257bef0f25bd0df741943f75d86e9bca7c45076af179d96ce213bd9c339a01f721f7dc9b96a0a4a56ef2cf44339f4c91d208103b7659d9f
2021-11-02 18:21:14 +00:00
junderw
24d6f62603
Use explicit u8 when assigning a byte slice
2021-10-17 10:07:51 +09:00
Dr Maxim Orlovsky
931b560dc7
Fixing documentation for BIP 340-related functions
2021-09-27 15:20:33 +02:00
Dr Maxim Orlovsky
6810c2b547
Dedicated display_secret fn for secret-containing types
...
Debug-print secrets as tagged hashes
Refactoring Display/Debug for secret values with display_secret
2021-09-27 14:03:58 +02:00
Elichai Turkel
635a6ae441
Add to_hex converter and add tests for hex conversion
2021-09-27 12:50:08 +02:00
Andrew Poelstra
24a9c9c765
Merge pull request #304 from p2pderivatives/combine-keys-test-and-doc
...
Add error type for combine keys + test and doc
2021-09-24 22:37:19 +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
Andrew Poelstra
c72e7cc743
Merge pull request #308 from LNP-BP/extrakeys/keypair-ser
...
Adding KeyPair::serialize_sec. Closes #298
2021-09-08 21:37:32 +00:00
Thomas Eizinger
bc42529a16
Rename `secp256k1::bitcoin_hashes` module to `secp256k1::hashes`
2021-09-08 15:46:38 +10:00
Tibo-lg
674cc79d87
Add error type for combine keys + test and doc
2021-09-02 21:19:21 +09:00
Elichai Turkel
ea4eae8a20
Merge pull request #315 from LNP-BP/fix/feat-warning
...
Fixing warning in context mod under feature-specific compilation
2021-06-30 15:32:35 +03:00
sanket1729
5bac4e4bac
Change error enum for KeyPair::from_seckey_slice
...
Also does another nit in the file which removes a trailing whitespace
2021-06-27 17:20:23 -07:00
Dr Maxim Orlovsky
593a550e3f
Fixing warning in context mod under feature-specific compilation
2021-06-27 20:09:41 +02:00
Dr Maxim Orlovsky
8ee4e05e63
Removing uneeded Secp context arguments
2021-06-20 17:15:10 +02:00
Dr Maxim Orlovsky
7e2f7fef72
Adding KeyPair::serialize_sec. Closes #298
2021-06-19 14:02:48 +02:00
Dr Maxim Orlovsky
aa6bdaff3c
Creating SecretKey and PublicKey from BIP-340 KeyPair
2021-06-16 10:56:59 +02: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
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
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
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
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
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
Dr Maxim Orlovsky
519857cd83
More standard derives for Error
2021-01-30 12:35:41 +01: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
65ff814a39
rename `rust_secp_fuzz` to `fuzzing`
2021-01-11 19:14:42 +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
d1714ce0ac
fuzz: disable sig-grinding tests, prevent spin-looping
2020-12-28 18:55:33 +00:00
Andrew Poelstra
96862b6a74
fuzz: implement recoverable signatures, get all tests passing, run them in CI
2020-12-28 18:42:46 +00:00
Andrew Poelstra
b811ec133a
fuzz: only replace signing and verification, leave everything else alone
...
We can now run unit tests with the fuzz feature on, and they'll pass,
which is some assurance that fuzzing with the feature on won't lead to
spurious failures due to the fuzz harness inadequately simulating message
signing.
2020-12-23 17:59:52 +00:00
Andrew Poelstra
40c31342f2
ffi: make function types nullable
2020-12-23 17:59:52 +00:00
Andrew Poelstra
a2c25f2e83
Merge pull request #259 from p2pderivatives/implement-low-r-signing
...
Implement low r signing
2020-12-22 23:28:34 +00:00
Andrew Poelstra
b31bf2f611
Merge pull request #258 from thomaseizinger/better-wasm-tests
...
Run more tests in wasm
2020-12-22 06:12:01 +00:00
Tibo-lg
1d166d061b
Implement low r signing
2020-12-22 14:50:37 +09:00
Tobin Harding
a584643486
Use ManuallyDrop
...
Suggested by clippy, we need to use ManuallyDrop for these types in
order to correctly free up the memory.
2020-12-22 14:56:17 +11:00
Tobin Harding
c38136b6bc
Use for loop instead of map
...
Currently we are misusing `map` on an iterator to loop `n` times,
additionally the assertion is pointless. Use a for loop and assert
against the length of the set.
2020-12-22 14:56:17 +11:00
Tobin Harding
c92b946493
Remove unnecessary clone
...
Type is `Copy`, no need for clone.
2020-12-22 14:56:17 +11:00
Tobin Harding
ef23cb8167
Return Ok directly
...
Clippy emits warning:
warning: passing a unit value to a function
Just return `Ok(())` after calling `fill_bytes`.
2020-12-22 14:56:17 +11:00
Tobin Harding
34ad4110f1
Remove unused error return value
...
This helper never returns an error, remove the `Result` return type.
Found by clippy.
2020-12-22 14:56:17 +11:00
Tobin Harding
ed29f12216
Remove unnecessary return statements
...
Found by clippy. We don't need a `return` for the final statement.
2020-12-22 13:38:02 +11:00
Tobin Harding
4e87e6fe94
Implement is_empty method
...
Clippy warns of missing `is_empty`, trivially implement it by calling
through to `self.data.is_empty()`.
2020-12-22 13:37:25 +11:00
Thomas Eizinger
8b8e482f79
Run more tests in wasm
...
Instead of repeating ourselves in defining one big test for the wasm
target, we can override the `test` attribute with the `wasm-bindgen-test`
one and therefore automatically run all (supported) tests in wasm.
Unfortunately, wasm doesn't support catching panics yet which means we
have to disable the `test_panic_raw_ctx` test.
2020-12-22 10:30:56 +11:00
Elichai Turkel
767246a282
Make preallocated use AlignedType
2020-12-18 12:48:19 +02:00
Elichai Turkel
fd206ab57c
Replace use of boxes with global allocator
2020-12-18 12:48:19 +02:00
Andrew Poelstra
ea027ce258
schnorrsig: change tweak_add_check to return a bool, take a fixed-length array
2020-12-09 16:49:48 +00:00
Andrew Poelstra
0ec8fab82c
stop explicitly casting references to rawptrs
2020-11-30 02:47:34 +00:00
Andrew Poelstra
37049d743e
schnorrsig: expose tweak_check_add API
2020-11-27 18:42:14 +00:00
Andrew Poelstra
12b0abbcf8
make `ffi::Type::new` functions all unsafe, expand documentation
2020-11-27 18:42:12 +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
Andrew Poelstra
9083babbe2
Merge pull request #248 from justinmoon/pubkey-ordering
...
Implement lexigraphic ordering for PubKey
2020-11-26 03:03:17 +00:00
Justin Moon
6f8a480974
Implement lexigraphic ordering for PubKey
2020-11-25 19:27:31 -06:00
Andrew Poelstra
1859ddc28a
switch from travis to github workflows
2020-11-10 23:58:03 +00:00
Tibo-lg
0c937d04f5
Add key::PublicKey to schnorrsig::PublicKey conversion
2020-11-10 14:15:34 +09:00
Tibo-lg
09b04560bc
Add schnorrsig module
2020-11-10 13:43:34 +09:00
Tibo-lg
47b33828bc
Add serde macros for public keys
2020-11-09 16:00:28 +09:00
Elichai Turkel
9e5a351ea7
remove redundant code after MSRV bump
2020-08-27 22:51:36 +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
Elichai Turkel
c69d43d84e
Update key.rs to use the new seckey functions
2020-08-26 21:16:19 +00:00
Andrew Poelstra
5c451f78c6
Merge pull request #207 from sorpaas/sp-message-zero
...
Allow all-zero messages
2020-08-26 18:02:51 +00:00
Andrew Poelstra
3692c94a0f
Merge pull request #220 from rantan/add_negate_support
...
Add negate support
2020-08-26 17:43:46 +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
Kohei Taniguchi
02ed0616e4
Add assert for the response of ffi negate interface
...
The interfaces for negate should always returns 1 as mentioned secp256k1.h L574, L563.
But in the future it might return 0 if the seckey or pubkey is invalid, but our type system doesn't allow that to ever happen.
2020-06-10 09:59:55 +09:00
Kohei Taniguchi
d45f709cd4
Add negation support
2020-06-09 10:05:07 +09:00
Sebastian Geisler
8979a932ab
Document proper usage of `from_slice`
2020-05-14 18:24:40 +02:00
Sebastian Geisler
0d857533fa
Add optional bitcoin_hashes feature to implement ThirtyTwoByteHash
2020-05-14 18:24:39 +02:00
Kirill Fomichev
0dcc59c2b9
Add doctest to Secp256k1::verify
2020-05-05 17:30:07 +03:00
Andrew Poelstra
0782872fb0
Merge pull request #208 from TheBlueMatt/202-04-wasm
...
Re-support WASM via simple stub headers
2020-04-29 19:48:03 +00:00
Elichai Turkel
affc6b4027
Add sanity checks for wasm32 for size and alignment of types
2020-04-29 15:32:57 -04: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
Kirill Fomichev
99a43ced56
Fix Secp256k1::verify docs
2020-04-22 17:58:27 +03:00
Wei Tang
9250ae49ce
Allow all-zero messages
2020-04-09 14:26:31 +02:00
Andrew Poelstra
86751b2d74
Merge pull request #201 from elichai/2020-03-ecdh
...
Simplify callback logic to returning raw coordinates
2020-04-06 14:48:57 +00:00
Andrew Poelstra
3fd089712c
Merge pull request #205 from elichai/2020-03-bench
...
Fix broken benchmarks
2020-04-05 21:38:33 +00:00
Elichai Turkel
b2edf157cd
Fix broken benchmarks
2020-04-05 11:08:29 +03:00
Andrew Poelstra
ab59498e04
Merge pull request #199 from elichai/2020-02-external-symbols
...
Fix typos in the external-symbols feature(bug)
2020-04-04 21:31:13 +00:00
Kohei Taniguchi
4b410fc202
Add constant of the prime of the curve field.
2020-03-06 09:15:32 +09:00
Elichai Turkel
2eff118d03
Simplify callback logic to returning raw coordinates
2020-03-01 13:46:25 +02:00
Elichai Turkel
2f897d8a93
Removed no longer used dont_replace_c_symbols feature
2020-02-09 16:37:59 +02:00
Andrew Poelstra
4b740911c6
Merge pull request #180 from elichai/2019-11-SharedSecret
...
Alternative: Passing custom hash functions to ECDH
2019-12-09 21:11:30 +00:00
Elichai Turkel
5619f2a5df
Add an unsafe variant of new_with_has called new_with_hash_no_panic
2019-12-09 22:53:24 +02:00
Elichai Turkel
124c1f3c7c
feature gate new_with_hash with std only, added catch_unwind
2019-12-05 18:05:40 +02:00
Elichai Turkel
d2c4e5a846
Wrap Secp256k1 from raw context in a ManuallyDrop
2019-12-05 17:51:59 +02:00
Elichai Turkel
f80428258c
Add tests for the new SharedSecret::new_with_hash() function
2019-12-05 17:46:24 +02:00
Elichai Turkel
af8fa21a20
Add 'new_with_hash' function to SharedSecret
2019-12-05 17:46:23 +02:00
Elichai Turkel
9759cb07f5
Replace SharedSecret with a more generic alternative
2019-12-05 17:45:24 +02:00
Steven Roose
724c49fff9
Add secp256k1-sys
2019-11-27 21:02:42 +00:00
Andrew Poelstra
02f66177f0
Merge pull request #179 from elichai/2019-11-raw-context
...
Creating context from raw pointer
2019-11-27 20:34:43 +00:00
Elichai Turkel
9523e093c1
Add tests for raw context
2019-11-27 22:05:27 +02:00
Elichai Turkel
5f8096e8a8
Add functions to create from raw context
2019-11-27 22:05:23 +02:00
Andrew Poelstra
cf22f60919
Merge pull request #162 from elichai/2019-09-ffi
...
Fixes and tests for the ffi
2019-11-27 20:01:17 +00:00
Andrew Poelstra
1e711f194c
Merge pull request #184 from elichai/2019-11-context
...
Fix a safety problem and make the Context trait unimplementable
2019-11-27 19:58:44 +00:00
Elichai Turkel
9522f7e4a4
Make Context::deallocate unsafe fn
2019-11-27 17:42:01 +02:00
Elichai Turkel
fe688ada65
Make the Context trait unimplementable
2019-11-27 17:36:06 +02:00
Andrew Poelstra
47b2555e80
Merge pull request #182 from rodoufu/code_imp
...
Updating libraries and small code improvements
2019-11-22 16:02:33 +00:00
Tony Jin
1b0c57377a
Remove trailing whitespace
2019-11-20 20:36:18 +01:00
Rodolfo Araujo
825493bea9
Small code improvements.
2019-11-17 22:10:40 -03:00
Rodolfo Araujo
a4ccab7431
Libraries.
2019-11-17 22:04:11 -03:00
Andrew Poelstra
d900dcd1c9
Merge pull request #177 from elichai/2019-10-csymbols
...
Add a feature to disable replacing C symbols with rust
2019-10-29 01:39:08 +00:00
Elichai Turkel
349b2eac06
Add a 'dont_replace_c_symbols' feature for not replacing C's symbols with rust. isn't compatible with no-std
2019-10-28 23:05:38 +02:00
Matt Corallo
f09ff2a9de
Disable some useless lints
2019-10-28 15:20:04 -04:00
Elichai Turkel
06b2bebce8
Add a test for the types
2019-09-14 22:59:36 +03:00
Elichai Turkel
5b10d1b226
Fix bad ffi declarations
2019-09-14 21:12:59 +03:00
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
d7461e4cdc
Add zst tests and some other parsing tests
2019-08-21 18:06:02 -04:00
Elichai Turkel
ddb8e4fdf2
Explicit checks for empty slices
2019-08-21 13:09:36 -04:00
Elichai Turkel
b7e20c5b12
Changed all as_*ptr() to the safer CPtr trait
2019-08-21 13:09:36 -04: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
8e701b75b2
Replacing usage of the unsafe `blank` function to the `new` function
...
Signed-off-by: Elichai Turkel <elichai.turkel@gmail.com>
2019-08-16 14:15:31 -04: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
16fc4ee3fc
Fixed the counter Rng
2019-08-13 10:41:39 -04:00
Steven Roose
0f25474805
Implement hex human-readable serde for PublicKey
2019-07-23 17:50:56 +02:00
Steven Roose
ccac3ead25
Implement fmt::LowerHex for SecretKey and PublicKey
2019-07-23 17:50:54 +02:00
Elichai Turkel
7356705b61
Added a test for create/destroy functions
2019-07-14 16:35:51 -04:00
Elichai Turkel
75784ec26f
Implemented context create/destroy in rust
2019-07-14 16:35:47 -04:00
Elichai Turkel
96ca40faed
Exposed generic functions to create the Context
2019-07-04 21:36:32 -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
9186f0223a
Added preallocation size functions and added a test for the preallocation
2019-07-04 18:40:08 -04:00
Elichai Turkel
1c0ae7d4ba
Added structs and functions for manual allocation
2019-07-04 18:40:07 -04:00
Elichai Turkel
b4b52a9858
Moved the context specific traits/enums into a separate file with `std` gate
2019-07-04 18:40:07 -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
8022757681
Added a c_char implementation
2019-07-03 17:48:35 -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
Elichai Turkel
be457afdae
Removed ffi call from Display implementation
2019-05-21 22:05:18 +03:00
Andrew Poelstra
0bf88fe444
Merge pull request #109 from jonasnick/human-sigs
...
Add human readable serialization to Signatures
2019-05-21 17:50:41 +00:00
Jonas Nick
ebf50df1d1
Add human readable serialization to Signatures
2019-05-21 10:34:18 +00:00
Jonas Nick
28934ab5a7
Only display existing signature bytes
2019-05-21 10:22:05 +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
Jonas Nick
c7eecd159e
Feature gate recovery module
2019-05-21 07:02:11 +00:00
Jonas Nick
264b368ee0
Move recovery to its own module
2019-05-20 19:11:59 +00:00
Jonas Nick
3825ed35a7
Add human readable serialization and deserialization to Secret Key
2019-05-14 11:15:18 +00:00
Tim Ruffing
ab4320f8cc
Merge pull request #100 from elichai/master
...
Add no-std support
2019-05-10 23:32:52 +02:00
Elichai Turkel
dfcf74f9d0
Added a new struct for the DER serialized signature
2019-05-11 00:11:42 +03:00
Andrew Poelstra
90faf434c9
Merge pull request #104 from alekseysidorov/fix_rand
...
Fix `Rand` trait bounds.
2019-05-01 01:47:43 +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
Jonas Nick
91c43e7320
Add as_mut_ptr to PublicKey
2019-04-16 18:48:24 +00:00
Aleksei Sidorov
2536c5a3c4
Fix rand trait bounds.
2019-04-16 16:35:33 +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
Elichai Turkel
11ce86681f
Replaced std with core, and made std::error::Error optional through feature
2019-04-14 12:09:36 +03:00
Jonas Nick
6eaacb19c5
Add raw context getter to Secp256k1 struct
2019-03-01 19:39:55 +00:00
François Garillot
a8a3afe8db
Fix clippy errors
...
Changes include cargo-fix generated, Default impls
2019-02-25 20:12:25 -08:00
François Garillot
bafef68c56
Bumps rand to 0.6.3 & associated updates
2019-02-25 20:09:43 -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
Tim Ruffing
b470f70e90
Merge pull request #57 from rust-bitcoin/2018-08-no-index
...
remove `ops::Index` impls for `Signature`
2018-12-03 14:27:08 +01:00
Andrew Poelstra
e5a02bd9a0
add `ThirtyTwoByteHash` hash trait which can be implemented for easier conversion of things to `Message`s
2018-11-10 13:12:10 +00:00
Andrew Poelstra
1f4a4c11a3
change add_*_assign and mul_*_assign to use a byteslice as a tweak, rather than a `SecretKey`
...
This makes more conceptual sense and does not add any new error paths, since even
valid `SecretKey`s were able to be invalid tweaks.
2018-11-10 13:08:18 +00:00
Andrew Poelstra
f93b959b4a
disallow Messages that are not valid secret keys to prevent mistakes related to 0
2018-11-10 13:05:11 +00:00
Andrew Poelstra
8d2347602a
remove `ops::Index` impls for `Signature`
2018-11-10 12:56:19 +00:00
Andrew Poelstra
7fbaf2f91b
remove unsafe ZERO_KEY and deprecated ONE
2018-11-10 12:56:19 +00:00
Andrew Poelstra
4b88cfc2fc
Merge pull request #78 from rust-bitcoin/2018-11-remove-without-caps
...
Update upstream libsecp; remove `without_caps` and all use of dummy contexts
2018-11-10 12:51:14 +00:00
Andrew Poelstra
8986aa3d71
export `serde`, `rand` and `libc`; update version to 0.11.5
2018-11-07 20:18:55 +00:00
Andrew Poelstra
223eb41fd0
remove context object from ECDH
2018-11-06 22:16:24 +00: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
Andrew Poelstra
68c838f357
change `Debug` impl for `Signature` to use `Display`
2018-11-03 15:52:07 +00:00
Andrew Poelstra
30aa3a0c28
add `fmt::Display` and `str::FromStr` impls for `Signature`
2018-11-03 15:52:05 +00:00
Andrew Poelstra
572adb2873
add `FromStr` implementation for key types
2018-11-03 15:52:03 +00:00
Andrew Poelstra
a810880c54
restore missing `mem` import in key.rs
2018-08-22 20:43:20 +00:00