Commit Graph

19 Commits

Author SHA1 Message Date
Andrew Poelstra 14e82186d1
Merge rust-bitcoin/rust-secp256k1#644: Improve `Message` constructors
cd40ae7f19 Improve Message constructors (Tobin C. Harding)

Pull request description:

  Observe:

  - The word "hash" can be a verb or a noun, its usage in function names is therefore at times ambiguous.
  - The function name `from_slice` gives no indication as to what the slice input is.

  Improve Message constructors by doing:

  - Add a constructor `Message::from_digest` that takes a 32 byte array as input.
  - Rename `Message::from_slice` to `Message::from_digest_slice` (deprecate `from_slice` and add `from_digest_slice`)
  - Improve the docs while we are at it.

  ### Note

  The original PR conflate 2 separate issues, the `Message` constructor naming clarity issue and the upgrade difficulty issue, PR is now only a solution to the first. The second will be done as a separate PR.

ACKs for top commit:
  apoelstra:
    ACK cd40ae7f19

Tree-SHA512: 4e5aeccf15cca95073f4c3a518b9e1f54f0e33c92c45dfecd1daa31d052022cd28c71bb6df6cff8a6548993e3e22788f11cd2633214ab5a580c753e66d2ea749
2023-08-10 15:05:43 +00:00
Tobin C. Harding 3bbf08348e
no_std_test: Remove internal_features
Remove the `internal_features` attribute, not sure what it was supposed
to be doing but the crate works without it.
2023-08-10 09:16:13 +10:00
Tobin C. Harding cd40ae7f19
Improve Message constructors
Observe:

- The word "hash" can be a verb or a noun, its usage in function names
  is therefore at times ambiguous.
- The function name `from_slice` gives no indication as to what the
  slice input is.

Improve Message constructors by doing:

- Add a constructor `Message::from_digest` that takes a 32 byte array as
  input.
- Rename `Message::from_slice` to `Message::from_digest_slice`
  (deprecate `from_slice` and add `from_digest_slice`)
- Improve the docs while we are at it.
2023-08-10 08:20:46 +10:00
Tobin C. Harding 896e6c7f2d
Introduce SPDX license identifiers
Licenses are boring as hell, so is are all the comments at the top of
each file. This patch makes no comment on the merit of license comments
in each file, rather this patch reduces the license comment to the
minimum possible with no loss of meaning - an SPDX license identifier.

Note also please that we remove the "written by" comments as well for
the following reasons (discussed recently on rust-bitcoin repo):

- they are not descriptive because many devs contributed
- they have a tendency to include the wrong date because of cut'n'pasta
- all this info is in the git history

ref: https://spdx.dev/ids/#how
2023-05-03 11:37:07 +10:00
Tobin Harding faa153988f
Remove call to deprecated methods
We recently added `sign_ecdsa` and `verify_ecdsa` and deprecated `sign`
and `verify`. The `no_std_test` crate got missed during the upgrade.

Remove call to deprecated methods `sign` and `verify` in `no_std_test`
crate.
2022-03-01 18:07:36 +00:00
Tobin Harding 834f63c26c
Separate new_with_hash into public function
In preparation for simplifying the `SharedSecret` internals pull the
`new_with_hash` function logic out into a standalone public function
that provides similar functionality without use of the `SharedSecret`
struct. Function now returns the 64 bytes of data representing a shared
point on the curve, callers are expected to the hash these bytes to get
a shared secret.
2022-02-18 09:51:06 +00: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
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
Jules Comte c925644b74 Touch recovery module in no_std_test 2021-05-20 07:18:42 -06:00
Andrew Poelstra e687622a81 bump secp-sys version; drop endomorphism flag 2020-12-29 17:15:56 +00:00
Elichai Turkel 0638107918
Adopt no-std tests to new preacllocated_* functions 2020-12-18 12:48:19 +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
Elichai Turkel 18259fd67b
Fix no-std raw test, after removal of lang items 2020-04-05 11:08:32 +03:00
Elichai Turkel 2eff118d03
Simplify callback logic to returning raw coordinates 2020-03-01 13:46:25 +02:00
Elichai Turkel 92c42ca9e6
Add ECDH to the no-std tests 2019-12-09 22:53:28 +02:00
Elichai Turkel 49391d62b0
DOC: Added documentation to no-std test 2019-11-03 16:32:30 +02:00
Elichai Turkel e5e22ee376
Test serde support in no-std crate 2019-10-24 21:10:33 +03:00
Elichai Turkel d0afb874a3
Test rand support in no std crate 2019-10-24 21:10:14 +03:00
Elichai Turkel c3f5cce7ff
Add a simple crate without std to test no_std feature 2019-10-24 21:09:43 +03:00