HomePhabricator

Always create 70 byte signatures with low R values

Description

Always create 70 byte signatures with low R values

Summary:
When extra entropy is not specified by the caller, CKey::Sign will
now always create a signature that has a low R value and is at most
70 bytes. The resulting signature on the stack will be 71 bytes when
the sighash byte is included.

Using low R signatures means that the resulting DER encoded signature
will never need to have additional padding to account for high R
values.

This is a partial backport of Core PR13666 : https://github.com/bitcoin/bitcoin/pull/13666/commits/18dfea0dd082af18dfb02981b7ee1cd44d514388

Test Plan:

make check
./test/functional/test_runner.py

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

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

Details

Provenance
Andrew Chow <achow101-github@achow101.com>Authored on Jul 14 2018, 23:03
deadalnixCommitted on Nov 20 2019, 12:35
deadalnixPushed on Nov 20 2019, 12:35
Reviewer
Restricted Project
Differential Revision
D4467: Always create 70 byte signatures with low R values
Parents
rABCd9e677821dc6: Additional sanity checks in SignPSBTInput
Branches
Unknown
Tags
Unknown