Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btcec: Ensure reduction when > P in all cases.
As noted in issue btcsuite#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.
- Loading branch information