Skip to content

Conversation

@juanli16
Copy link
Contributor

@juanli16 juanli16 commented Oct 11, 2022

golang crypto/elliptic library's IsOnCurve no longer returns true for ec points with negative values. This is due to the fact that the ec points are defined on [0, P) where P is the prime order of the field. This leads to a panic when we call curve.Add() with a point that contains negative values.

This wasn't an issue for us since the underlying curve.Add() operation simply operated on the coordinates of the curve points (addition on x, y coordinates), and we were not using the negative ec point directly, but rather the result of the addition with the negative points, which can be encoded/decoded properly.

The fix is to simply modulo the negative value with the curve's underlying field order.

Copy link
Contributor

@ab116699 ab116699 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@juanli16 juanli16 merged commit aafd40a into main Oct 11, 2022
@juanli16 juanli16 deleted the fix/modulo_ec_point branch October 11, 2022 20:04
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.

3 participants