Skip to content

elliptic-curve: ToEncodedPoint should be fallible #399

Description

@rozbb

The point at infinity has no SEC1 bytestring representation. If an AffinePoint is the point at infinity, this method should fail. Currently, it will just output whatever garbage is in the x,y coordinates of the point.

https://github.com/RustCrypto/elliptic-curves/blob/bd7c9ea91a2e6bdb2f3fd71290708459b8aabc5f/p256/src/arithmetic/affine.rs#L150-L154

This might be difficult to fix, since ToEncodedPoint::to_encoded_point is an infallible method. Options are:

  1. Make the point at infinity non-representable again in AffinePoint (i.e., remove the infinity field)
  2. Change ToEncodedPoint to have an associated ErrorType which can be set to !
  3. Ignore this and just make a big warning on the method

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions