Skip to content

crypto/elliptic: automatically upgrade CurveParams for known curves and deprecate custom ones #34648

@FiloSottile

Description

@FiloSottile

The generic implementation of elliptic.Curve provided by CurveParams is slow and insecure. No one would want to use it for a standard curve for which a constant-time, optimized implementation is available, like P256().

However, it's an easy mistake to replace a P256() value with P256().CurveParams() as they have exactly the same type. I say we just take away this footgun and redirect methods of CurveParams to the optimized curve implementation whenever the parameters match a known curve. That won't be extremely fast, but still faster than actually using the generic implementation.

Moreover, I think CurveParams in general was a mistake, and no one should be using it for custom curves either. For example, it's not constant time, and will never be, and we are not going to spend resources making it faster. Given it should be used for neither custom nor standard curves, I say we deprecate the CurveParams methods outright.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.Proposal-AcceptedProposal-CryptoProposal related to crypto packages or other security issues

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions