HomePhabricator

Retry if r is zero during signing

Description

Retry if r is zero during signing

Summary:

  • Revert "ecdsa_impl: replace scalar if-checks with VERIFY_CHECKs in ecdsa_sig_sign"

This reverts commit 25e3cfbf9b52d2f5afa543f967a73aa8850d2038. The reverted
commit was probably based on the assumption that this is about the touched
checks cover the secret nonce k instead of r, which is the x-coord of the public
nonce. A signature with a zero r is invalid by the spec, so we should return 0
to make the caller retry with a different nonce. Overflow is not an issue.

Fixes #720.

  • Make ecdsa_sig_sign constant-time again after reverting 25e3cfb

This is a backport of libsecp256k1 PR732

Test Plan:

ninja check-secp256k1

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

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

Details

Provenance
Tim Ruffing <crypto@timruffing.de>Authored on Mar 31 2020, 12:28
deadalnixCommitted on Sep 27 2020, 21:52
deadalnixPushed on Sep 27 2020, 21:52
Reviewer
Restricted Project
Differential Revision
D7586: Retry if r is zero during signing
Parents
rABC08fc810d2b87: Fix typo in ecmult_const_impl.h
Branches
Unknown
Tags
Unknown