Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[parity-crypto] Use upstream secp256k1 #258

Merged
merged 26 commits into from
Feb 6, 2020

Conversation

dvdplm
Copy link
Contributor

@dvdplm dvdplm commented Nov 11, 2019

Switch to rust-secp256k1 at v0.17.2 and address the two changes in the parity-secp256k1 fork that has thus far prevented us from switching:

  1. get a "raw" shared secret. This is taken care of by recent additions upstream and used in this PR like this
  2. calculate the inverse of a private key. There has been a proposal to add this to upstream but was rejected because too easy to misuse and too low level for the goals of the library maintainers. It's hard to argue with that. Our usage, introduced here, is quite niche and confined to secret-store.

This is solved by using libsecp256k1 in the one place in parity-ethereum that needs the inversion (we need the yet unreleased v0.3.5). See openethereum/parity-ethereum#11406.

The other changes in this PR are mostly due to refactorings and improvements upstream to make the API harder to misuse. Some operations that previously could fail now don't, e.g. generate a random key pair; many methods that needed a Secp256k1 context now don't etc. Extra context here.

* master:
  Compile triehash for no_std (#280)
  [kvdb-rocksdb] Use "pinned" gets to avoid allocations (#274)
  [kvdb-rocksdb] Release 0.2 (#273)
  [kvdb-rocksdb] switch to upstream (#257)
  travis: try to fix wasmpack chrome test on macOS (#263)
  Use 2018 edition for rustfmt (#266)
  [fixed-hash]: re-export `alloc_` (#268)
  kvdb-web: async-awaitify (#259)
  kvdb-rocksdb: configurable memory budget per column (#256)
  Bump rlp crate version. (#270)
  Introduce Rlp::at_with_offset method. (#269)
  Make fixed-hash test structs public (#267)
  Migrate primitive types to 2018 edition (#262)
  upgrade tiny-keccak to 2.0 (#260)
* master: (27 commits)
  update parity-util-mem (#309)
  Update features and feature dependencies (#307)
  Use proper memory queries to rocksdb (#308)
  Draft version updates and changelog (#299)
  Use custom error type for `from_hex` (#305)
  Fix typo. (#303)
  kvdb: remove KeyValueDBHandler (#304)
  extract common kvdb tests into a crate (#301)
  Expose to_hex and from_hex from impl-serde (#302)
  Add a top level function to parity-util-mem (#298)
  I/O statistic for key-value databases (#294)
  use for_tuples (#300)
  Add memory extensions for LRUCache, hashbrown (#293)
  Add memory stats for kvdb-s (#292)
  Provide #[derive(MallocSizeOf)] that is actually working (#291)
  Move and extend impls for locking primitives (#290)
  Update uint README (#288)
  Update README.md (#287)
  [ci]: remove feature flags in virtual workspace (#289)
  Prepare releases (#286)
  ...
@dvdplm dvdplm marked this pull request as ready for review January 29, 2020 15:32
@dvdplm dvdplm requested a review from ordian January 29, 2020 15:32
Copy link
Member

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (I'm not a cryptographer)

parity-crypto/Cargo.toml Outdated Show resolved Hide resolved
parity-crypto/src/publickey/ec_math_utils.rs Show resolved Hide resolved
* master:
  update changelogs (#329)
  bump parity-util-mem to 0.4.2 (#328)
  remove libc feature from fixed-hash (#317)
  kvdb-rocksdb: release 0.4.2 (#327)
  kvdb-rocksdb: fix iter_from_prefix being slow (#326)
  MallocSizeOf for BTreeSet (#325)
  split off primitives (#323)
  travis: disable kvdb-web tests for chrome (#324)
  Expand const fn coverage (#319)
  uint: make zero const fn (#318)
  README: fix appveyor badge (#316)
  keccak-hash: switch benches to criterion (#315)
@dvdplm dvdplm requested a review from sorpaas February 4, 2020 21:33
@sorpaas sorpaas merged commit 2c5273c into master Feb 6, 2020
@sorpaas sorpaas deleted the dp/chore/secp256k1-from-upstream branch February 6, 2020 14:26
ordian added a commit that referenced this pull request Feb 6, 2020
* master:
  [parity-crypto] Use upstream secp256k1 (#258)
  Bump parking_lot to 0.10 and minor versions (#332)
ordian added a commit that referenced this pull request Feb 7, 2020
* master:
  Add different mode for malloc_size_of_is_0 macro dealing with generics (#334)
  [parity-crypto] Use upstream secp256k1 (#258)
  Bump parking_lot to 0.10 and minor versions (#332)
  Remove libc completely (#333)
  update changelogs (#329)
  bump parity-util-mem to 0.4.2 (#328)
  remove libc feature from fixed-hash (#317)
  kvdb-rocksdb: release 0.4.2 (#327)
  kvdb-rocksdb: fix iter_from_prefix being slow (#326)
  MallocSizeOf for BTreeSet (#325)
  split off primitives (#323)
  travis: disable kvdb-web tests for chrome (#324)
  Expand const fn coverage (#319)
  uint: make zero const fn (#318)
  README: fix appveyor badge (#316)
dvdplm added a commit that referenced this pull request Feb 8, 2020
* master:
  Add different mode for malloc_size_of_is_0 macro dealing with generics (#334)
  [parity-crypto] Use upstream secp256k1 (#258)
  Bump parking_lot to 0.10 and minor versions (#332)
  Remove libc completely (#333)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants