rust-secp256k1-unsafe-fast/src
Tobin C. Harding b38ae97eaf Implement stable comparison functionality
Currently we rely on the inner bytes with types that are passed across
the FFI boundry when implementing comparison functions (e.g. `Ord`,
`PartialEq`), this is incorrect because the bytes are opaque, meaning
the byte layout is not guaranteed across versions of `libsecp26k1`.

Implement stable comparison functionality by doing:

- Implement `core::cmp` traits by first coercing the data into a stable
  form e.g., by serializing it.
- Add fast comparison methods to `secp256k1-sys` types that wrap types
  from libsecp, add similar methods to types in `secp256k1` that wrap
  `secp256k1-sys` types (just call through to inner type).
- In `secp256k1-sys` feature gate the new `core::cmp` impls on
  `not(fuzzing)`, when fuzzing just derive the impls instead.

Any additional methods added to `secp256k1-sys` types are private,
justified by the fact the -sys is meant to be just a thin wrapper around
libsecp256k1, we don't want to commit to supporting additional API
functions.

Please note, the solution presented in this patch is already present for
`secp256k1::PublicKey`, this PR removes that code in favour of deriving
traits that then call down to the same logic in `secp256k1-sys`.
2022-11-18 10:24:46 +11:00
..
ecdsa Implement stable comparison functionality 2022-11-18 10:24:46 +11:00
constants.rs Prepare codebase for formatting 2022-11-16 10:56:25 +11:00
context.rs Merge rust-bitcoin/rust-secp256k1#499: Introduce `rustfmt` 2022-11-17 15:00:00 +00:00
ecdh.rs Remove as_[mut_]ptr from impl_array_newtype macros 2022-11-18 07:57:39 +11:00
key.rs Implement stable comparison functionality 2022-11-18 10:24:46 +11:00
lib.rs Duplicate impl_array_newtype 2022-11-18 07:57:39 +11:00
macros.rs Implement stable comparison functionality 2022-11-18 10:24:46 +11:00
scalar.rs Run cargo fmt 2022-11-16 11:06:12 +11:00
schnorr.rs Duplicate impl_array_newtype 2022-11-18 07:57:39 +11:00
secret.rs Merge rust-bitcoin/rust-secp256k1#499: Introduce `rustfmt` 2022-11-17 15:00:00 +00:00
serde_util.rs Run cargo fmt 2022-11-16 11:06:12 +11:00