7 Commits
Author SHA1 Message Date
Fedor Indutny 7b86a52e65 6.6.1 2024-11-12 19:39:30 -08:00
Fedor Indutny 3613d015ae 6.6.0 2024-10-25 20:13:25 -07:00
Fedor IndutnyandGitHub 594982a992 fix: signature verification due to leading zeros
According to FIPS 186-5, section 6.4.2 ECDSA Signature
Verification Algorithm, the hash of the message must be adjusted
based on the order n of the base point of the elliptic curve:

    If log2(n) ≥ hashlen, set E = H. Otherwise, set E equal to
    the leftmost log2(n) bits of H.

Unfortunately because elliptic converts messages to BN instances the
reported `byteLength()` for the message can be incorrect if the message
has 8 or more leading zero bits.

Here we fix it by:

1. Counting leading zeroes in hex strings provided as messages
2. Counting all array entries in Array-like (e.g. Buffer)
   messages
3. Providing an `msgBitLength` option to both `.sign`/`.verify` to let
   user override the behavior

Original PR: https://github.com/indutny/elliptic/pull/322
Credit: @Markus-MS
2024-10-25 20:13:12 -07:00
Fedor Indutny a50121db0b 6.5.7 2024-08-13 19:22:19 -07:00
Fedor Indutny be25de886a 6.5.6 2024-07-16 19:23:47 -07:00
Fedor Indutny 91ef5c9e7d 6.5.5 2024-03-04 23:21:45 -08:00
Fedor Indutny 751124f110 lib: lint 2024-03-04 23:21:33 -08:00