HomePhabricator

[electrum] fix the max value for the ephemeral exponent

Description

[electrum] fix the max value for the ephemeral exponent

Summary:
A private key cannot be more than the curve's order, so don't risk generating a random number that will be an invalid key.

Setting the proper upper bound makes it unneccessary to then test that the point is valid and potentially raise an error. We should have at the very least retried in a loop until the rand integer is in the correct range.

Depends on D16677

Test Plan:
python test_runner.py

(just to check this trivial fix does not introduce a typo or a syntax error)

Reviewers: #bitcoin_abc, bytesofman

Reviewed By: #bitcoin_abc, bytesofman

Differential Revision: https://reviews.bitcoinabc.org/D16678

Details

Provenance
PiRKAuthored on Fri, Aug 23, 19:44
PiRKPushed on Wed, Aug 28, 06:26
Reviewer
Restricted Project
Differential Revision
D16678: [electrum] fix the max value for the ephemeral exponent
Parents
rABC98cf2c8bda6a: [electrum] move .encrypt method to ECPubkey class
Branches
Unknown
Tags
Unknown