Skip to content

Conversation

@tarcieri
Copy link
Member

Similar to #396, this adds a generic implementation of ECDSA signature verification by providing a default implementation of the VerifyPrimitive::verify_prehashed method.

Downstream crates can choose to override this implementation if they so desire, allowing them to potentially leverage more efficient arithmetic such as Shamir's trick / linear combinations (at least, until such a time as there are traits for these in the group crate).

This approach does have a disadvantage that it necessarily adds a AffineArithmetic<AffinePoint = Self> bound on the curve, meaning that VerifyPrimitive can only be impl'd for a particular curve's affine point type, as opposed to the original design goal of allowing it to be impl'd for a hardware ECDSA accelerator that stores a private scalar.

Either the default impl needs to be replaced with a blanket impl with more restrictive bounds, or a separate trait needs to be added to support hardware accelerators. The latter may indeed make the most sense.

Similar to #396, this adds a generic implementation of ECDSA signature
verification by providing a default implementation of the
`VerifyPrimitive::verify_prehashed` method.

Downstream crates can choose to override this implementation if they so
desire, allowing them to potentially leverage more efficient arithmetic
such as Shamir's trick / linear combinations (at least, until such a
time as there are traits for these in the `group` crate).

This approach does have a disadvantage that it necessarily adds a
`AffineArithmetic<AffinePoint = Self>` bound on the curve, meaning that
`VerifyPrimitive` can only be impl'd for a particular curve's affine
point type, as opposed to the original design goal of allowing it to be
impl'd for a hardware ECDSA accelerator that stores a private scalar.

Either the default impl needs to be replaced with a blanket impl with
more restrictive bounds, or a separate trait needs to be added to
support hardware accelerators. The latter may indeed make the most
sense.
@tarcieri tarcieri force-pushed the ecdsa/default-verify-primitive-impl branch from 66f87b8 to 9250111 Compare November 18, 2021 00:51
@tarcieri tarcieri merged commit 7d902f2 into master Nov 18, 2021
@tarcieri tarcieri deleted the ecdsa/default-verify-primitive-impl branch November 18, 2021 00:53
tarcieri added a commit that referenced this pull request Nov 18, 2021
Updates test macros with the changes from #396 and #397
@tarcieri tarcieri mentioned this pull request Nov 18, 2021
tarcieri added a commit that referenced this pull request Nov 18, 2021
Updates test macros with the changes from #396 and #397
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Nov 18, 2021
This updates the crates in this repo to leverage the following generic
implementations recently added to the `ecdsa` crate:

- Sign: RustCrypto/signatures#396
- Verify: RustCrypto/signatures#397

The `p256` crate is able to directly utilize the generic implementation
from the `ecdsa` crate.

The `k256` crate retains its previous custom implementation, which
provides a secp256k1-specific take on public key recovery, but can also
directly leverage optimizations for computing linear combinations, which
there are not presently traits in `elliptic-curve` or `group` to
express.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Nov 18, 2021
This updates the crates in this repo to leverage the following generic
implementations recently added to the `ecdsa` crate:

- Sign: RustCrypto/signatures#396
- Verify: RustCrypto/signatures#397

The `p256` crate is able to directly utilize the generic implementation
from the `ecdsa` crate.

The `k256` crate retains its previous custom implementation, which
provides a secp256k1-specific take on public key recovery, but can also
directly leverage optimizations for computing linear combinations, which
there are not presently traits in `elliptic-curve` or `group` to
express.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Nov 18, 2021
This updates the crates in this repo to leverage the following generic
implementations recently added to the `ecdsa` crate:

- Sign: RustCrypto/signatures#396
- Verify: RustCrypto/signatures#397

The `p256` crate is able to directly utilize the generic implementation
from the `ecdsa` crate.

The `k256` crate retains its previous custom implementation, which
provides a secp256k1-specific take on public key recovery, but can also
directly leverage optimizations for computing linear combinations, which
there are not presently traits in `elliptic-curve` or `group` to
express.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Nov 18, 2021
This updates the crates in this repo to leverage the following generic
implementations recently added to the `ecdsa` crate:

- Sign: RustCrypto/signatures#396
- Verify: RustCrypto/signatures#397

The `p256` crate is able to directly utilize the generic implementation
from the `ecdsa` crate.

The `k256` crate retains its previous custom implementation, which
provides a secp256k1-specific take on public key recovery, but can also
directly leverage optimizations for computing linear combinations, which
there are not presently traits in `elliptic-curve` or `group` to
express.
tarcieri added a commit to RustCrypto/elliptic-curves that referenced this pull request Nov 18, 2021
This updates the crates in this repo to leverage the following generic
implementations recently added to the `ecdsa` crate:

- Sign: RustCrypto/signatures#396
- Verify: RustCrypto/signatures#397

The `p256` crate is able to directly utilize the generic implementation
from the `ecdsa` crate.

The `k256` crate retains its previous custom implementation, which
provides a secp256k1-specific take on public key recovery, but can also
directly leverage optimizations for computing linear combinations, which
there are not presently traits in `elliptic-curve` or `group` to
express.
@tarcieri tarcieri mentioned this pull request Nov 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants