Branch: refs/heads/master
  Commit: a52eb04aaabfb7f6ec03b8cdab8a432b58fd3862
  Author: Dave Collins <>
  Date:   2016-10-18 (Tue, 18 Oct 2016)

  Changed paths:
    M btcec/field.go

  Log Message:
  btcec: Ensure reduction when > P in all cases.

As noted in issue #706, the existing code had an issue where the
normalized result was > P when both the first and second words of the
field representation being normalized were BOTH greater than or equal to
the first and second words of P.  Although this condition is rare in
practice, it needs to be handled properly.

This resolves the issue by comparing the low words in the final
reduction step against the normalized low order prime bits to ensure the
final subtraction occurs correctly any time they're > P.  This approach
retains the constant time property as well.

  Commit: 294b5d46da4ea05bc0df80e4a6b5f46c6ca9c8cb
  Author: Jimmy Song <>
  Date:   2016-10-18 (Tue, 18 Oct 2016)

  Changed paths:
    M btcec/field_test.go

  Log Message:
  btcec: Add regression tests for field.go.

This adds new tests to the TestNormalize, TestMul, TestAdd2 functions
which trigger an issue with modular reduction that was fixed in the
prevous commit to prevent regressions.


Reply via email to