Skip to content

Fix one-off bug in signRFC6979#1347

Merged
davecgh merged 1 commit intobtcsuite:masterfrom
junderw:fixOneOff
Nov 23, 2018
Merged

Fix one-off bug in signRFC6979#1347
davecgh merged 1 commit intobtcsuite:masterfrom
junderw:fixOneOff

Conversation

@junderw
Copy link
Contributor

@junderw junderw commented Nov 23, 2018

Ultra rare edge case where r == N.

  1. L430 returns 0 so is NOT == 1 and if statement NOT entered.
  2. L434 r.Sign() returns 1 (since N > 0) so if statement is NOT entered.
  3. mod N function for s calculation is not performed until after an addition operation (if it were only Multiplication we would still arrive at 0 when mod N is performed, since a*N mod N is always 0. But there is an addition between that)
  4. The Signature object is returned with R == curve.N...

Obviously I can't find a test case where nonceRFC6979 returns a k what when scalar Multiplied gets an x value == N... but N with both 0x02 and 0x03 DER headers is a valid point on the curve...

So the chance is not 0.

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