trezor-firmware icon indicating copy to clipboard operation
trezor-firmware copied to clipboard

Unify secp256k1_zkp usage

Open andrewkozlik opened this issue 3 years ago • 0 comments

Resolves https://github.com/trezor/trezor-firmware/issues/1864.

  • Moves the dispatching of zkp_ecdsa_*() vs. ecdsa_*() functions to ecdsa.c to simplify usage (no more #ifdefs for this in core and legacy code).
    • As a side-result the above change automatically causes crypto/bip32.c to use the secp256k1_zkp functions for public key derivation and signing without any code changes in bip32.c.
    • I renamed the trezor-crypto native implementations of the relevant ecdsa_* functions to tc_ecdsa_* so that they can be tested independently in the crypto tests.
    • It seems that the usage of secp256k1_zkp in bip32.c causes a different amount of data to be taken from the PRNG, which in turn causes the PIN matrix layouts to change, hence the changes to UI tests.
  • Implements Ethereum and EOS canonical ECDSA signing using the secp256k1_zkp library.
    • Some of the EOS signatures (10/16) had to be changed, because the signing retry works differently than in the trezor-crypto native implementation.
    • Signing of EOS operations will need to be tested extensively by QA!

andrewkozlik avatar Jul 14 '22 14:07 andrewkozlik