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

Crypto: Implement secp256r1 in constant time #245

Closed
kevaundray opened this issue Mar 28, 2019 · 1 comment · Fixed by #352
Closed

Crypto: Implement secp256r1 in constant time #245

kevaundray opened this issue Mar 28, 2019 · 1 comment · Fixed by #352
Labels
I3 Minimal impact security Affects security
Milestone

Comments

@kevaundray
Copy link
Contributor

No description provided.

@roman-khimov
Copy link
Member

No need to implement it, just use P256 from crypto/elliptic (see discussion in #81 also).

roman-khimov added a commit that referenced this issue Aug 26, 2019
It's the same implementation that we have in pkg/crypto (based on
https://github.com/vsergeev/btckeygenie) but with tests preserved. I don't see
any reason to port tests from it because even the pkg/crypto copy should go
away to fix #245.
@roman-khimov roman-khimov reopened this Aug 30, 2019
roman-khimov added a commit that referenced this issue Sep 4, 2019
As NEO uses P256 we can use standard crypto/elliptic library for almost
everything, the only exception being decompression of the Y coordinate. For
some reason the standard library only supports uncompressed format in its
Marshal()/Unmarshal() functions. elliptic.P256() is known to have
constant-time implementation, so it fixes #245 (and the decompression using
big.Int operates on public key, so nobody really cares about that part being
constant-time).
@roman-khimov roman-khimov added the security Affects security label Sep 4, 2019
@roman-khimov roman-khimov added this to the v0.5.0 milestone Sep 4, 2019
roman-khimov added a commit that referenced this issue Sep 4, 2019
As NEO uses P256 we can use standard crypto/elliptic library for almost
everything, the only exception being decompression of the Y coordinate. For
some reason the standard library only supports uncompressed format in its
Marshal()/Unmarshal() functions. elliptic.P256() is known to have
constant-time implementation, so it fixes #245 (and the decompression using
big.Int operates on public key, so nobody really cares about that part being
constant-time).
roman-khimov added a commit that referenced this issue Sep 5, 2019
As NEO uses P256 we can use standard crypto/elliptic library for almost
everything, the only exception being decompression of the Y coordinate. For
some reason the standard library only supports uncompressed format in its
Marshal()/Unmarshal() functions. elliptic.P256() is known to have
constant-time implementation, so it fixes #245 (and the decompression using
big.Int operates on public key, so nobody really cares about that part being
constant-time).
roman-khimov added a commit that referenced this issue Sep 5, 2019
As NEO uses P256 we can use standard crypto/elliptic library for almost
everything, the only exception being decompression of the Y coordinate. For
some reason the standard library only supports uncompressed format in its
Marshal()/Unmarshal() functions. elliptic.P256() is known to have
constant-time implementation, so it fixes #245 (and the decompression using
big.Int operates on public key, so nobody really cares about that part being
constant-time).

New decompress function is inspired by
https://stackoverflow.com/questions/46283760, even though the previous one
really did the same thing just in a little less obvious way.
roman-khimov added a commit that referenced this issue Sep 5, 2019
Really simplifies our crypto library and fixes #245.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I3 Minimal impact security Affects security
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants