Repository navigation
Commit cd65eaf
crypto: ecc - Randomize the initial Z in ecc_make_pub_key()
ecc_make_pub_key() calls ecc_point_mult() without an initial Z, so the
final Z, and therefore the input to vli_mod_inv(), is a deterministic
function of the private key. vli_mod_inv() is not constant time, so
key generation leaks information about the private key through its
running time.
crypto_ecdh_shared_secret() already passes a random initial Z, which
blinds the inversion input. Do the same in ecc_make_pub_key().
Key generation is used in the kernel by Bluetooth SMP and TPM2 HMAC
sessions, which generate ephemeral P-256 keys.
crypto_kpp_generate_public_key(), KVM guest on an i7-1165G7 (median
over 4 boots of the best of 9 runs of 300 calls):
P-256: 744.9 us -> 753.2 us (+1.1%; within noise)
P-384: 1674.2 us -> 1651.6 us (-1.4%; within noise)
Suggested-by: Ignat Korchagin <[email protected]>
Signed-off-by: Erwin Pawliczek <[email protected]>
Reviewed-by: Ignat Korchagin <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>1 parent 99f506c commit cd65eaf
1 file changed
Lines changed: 9 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1614 | 1614 | | |
1615 | 1615 | | |
1616 | 1616 | | |
| 1617 | + | |
| 1618 | + | |
1617 | 1619 | | |
1618 | 1620 | | |
1619 | | - | |
| 1621 | + | |
1620 | 1622 | | |
1621 | 1623 | | |
1622 | 1624 | | |
1623 | 1625 | | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1624 | 1630 | | |
1625 | 1631 | | |
1626 | 1632 | | |
1627 | 1633 | | |
1628 | 1634 | | |
1629 | 1635 | | |
1630 | | - | |
| 1636 | + | |
1631 | 1637 | | |
1632 | 1638 | | |
1633 | 1639 | | |
| |||
1641 | 1647 | | |
1642 | 1648 | | |
1643 | 1649 | | |
| 1650 | + | |
1644 | 1651 | | |
1645 | 1652 | | |
1646 | 1653 | | |
| |||
0 commit comments