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