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

Use libsecp256k1 for scalar mult in ECDH in ECIES #883

Closed
Gustav-Simonsson opened this issue May 8, 2015 · 3 comments
Closed

Use libsecp256k1 for scalar mult in ECDH in ECIES #883

Gustav-Simonsson opened this issue May 8, 2015 · 3 comments
Assignees

Comments

@Gustav-Simonsson
Copy link

Profiling of a running Go node shows that we spend a significant amount of CPU time in the EC scalar multiplication used when deriving the shared secret in ECDH in ECIES for the encrypted handshake: https://github.com/ethereum/devp2p/blob/master/rlpx.md#encrypted-handshake

The idea is that we should be able to replace the Go code for this multiplication with libsecp256k1 which is highly optimized for this operations.

See: https://github.com/ethereum/go-ethereum/blob/develop/crypto/curve.go#L182
And: https://github.com/bitcoin/secp256k1/blob/master/src/ecmult.h

First attempt at integrating this: https://github.com/Gustav-Simonsson/go-ethereum/tree/scalar_mult

Why the result is different for the same input is unknown - could be we're using the library wrong somehow.

@Gustav-Simonsson
Copy link
Author

There is now a PR which adds ECDH at the API level: bitcoin-core/secp256k1#252 Once it's merged we should be able to use it for ECDH in ECIES.

@obscuren
Copy link
Contributor

Sure. Let's integrate that post frontier

@fjl
Copy link
Contributor

fjl commented Jan 8, 2016

This is now done on develop (#1862).

@fjl fjl closed this as completed Jan 8, 2016
@fjl fjl removed the in progress label Jan 8, 2016
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this issue Jan 20, 2022
maoueh pushed a commit to streamingfast/go-ethereum that referenced this issue Jun 9, 2023
)

* updated Indore HF related changes by adding stateSyncConfirmationDelay

* converted StateSyncConfirmationDelay to map[string]uint64 and cleanup

* calculate last state ID from incoming state object with eth call (ethereum#883)

* removed IndoreBlock from configs

* fix

* remove code duplication and refactor

---------

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants