diff options
author | Billy Brumley <bbrumley@gmail.com> | 2020-07-20 22:18:45 +0000 |
---|---|---|
committer | Billy Brumley <bbrumley@gmail.com> | 2020-07-20 22:18:45 +0000 |
commit | c803f3e828bff91f4186c518f18222b89af988e0 (patch) | |
tree | e7536a5980eec1269c3015f8da02e9dc9b8a001d /lib/freebl | |
parent | 628ab482629db861f9d3a066706ac3396109b0be (diff) | |
download | nss-hg-c803f3e828bff91f4186c518f18222b89af988e0.tar.gz |
Bug 1631573: Remove unnecessary scalar padding in ec.c r=kjacobs,bbeurdouche
Subsequent calls to ECPoints_mul and ECPoint_mul remove this padding.
Timing attack countermeasures are now applied more generally deeper in
the call stack.
Differential Revision: https://phabricator.services.mozilla.com/D82011
Diffstat (limited to 'lib/freebl')
-rw-r--r-- | lib/freebl/ec.c | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/lib/freebl/ec.c b/lib/freebl/ec.c index d108bc118..7f4e903a0 100644 --- a/lib/freebl/ec.c +++ b/lib/freebl/ec.c @@ -724,27 +724,6 @@ ECDSA_SignDigestWithSeed(ECPrivateKey *key, SECItem *signature, } /* - ** We do not want timing information to leak the length of k, - ** so we compute k*G using an equivalent scalar of fixed - ** bit-length. - ** Fix based on patch for ECDSA timing attack in the paper - ** by Billy Bob Brumley and Nicola Tuveri at - ** http://eprint.iacr.org/2011/232 - ** - ** How do we convert k to a value of a fixed bit-length? - ** k starts off as an integer satisfying 0 <= k < n. Hence, - ** n <= k+n < 2n, which means k+n has either the same number - ** of bits as n or one more bit than n. If k+n has the same - ** number of bits as n, the second addition ensures that the - ** final value has exactly one more bit than n. Thus, we - ** always end up with a value that exactly one more bit than n. - */ - CHECK_MPI_OK(mp_add(&k, &n, &k)); - if (mpl_significant_bits(&k) <= mpl_significant_bits(&n)) { - CHECK_MPI_OK(mp_add(&k, &n, &k)); - } - - /* ** ANSI X9.62, Section 5.3.2, Step 2 ** ** Compute kG |