Skip to content

Commit

Permalink
SFT-3618: Use foundation.secp256k1.sign_ecdsa.
Browse files Browse the repository at this point in the history
* ports/stm32/boards/Passport/modules/tasks/sign_psbt_task.py
(sign_psbt_task): Use foundation.secp256k1.sign_ecdsa.
* ports/stm32/boards/Passport/modules/utils.py
(sign_message_digest): Ditto.
  • Loading branch information
jeandudey committed May 13, 2024
1 parent b4fe5a3 commit 003839a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions ports/stm32/boards/Passport/modules/tasks/sign_psbt_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ async def sign_psbt_task(on_done, psbt):
from errors import Error
from utils import keypath_to_str, swab32
from serializations import ser_sig_der
import trezorcrypto
import stash
import gc
from foundation import secp256k1
Expand Down Expand Up @@ -122,7 +121,7 @@ async def sign_psbt_task(on_done, psbt):
# TODO: handle taproot scripts
inp.tap_key_sig = taproot_sign_key(None, pk, inp.sighash, digest)
else:
result = trezorcrypto.secp256k1.sign(pk, digest)
result = secp256k1.sign_ecdsa(digest, pk)

# convert signature to DER format
if len(result) != 65:
Expand Down
3 changes: 2 additions & 1 deletion ports/stm32/boards/Passport/modules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,13 +1039,14 @@ def split_to_lines(s, width):


def sign_message_digest(digest, subpath):
from foundation import secp256k1
# do the signature itself!
with stash.SensitiveValues() as sv:
node = sv.derive_path(subpath)
pk = node.private_key()
sv.register(pk)

rv = trezorcrypto.secp256k1.sign(pk, digest)
rv = secp256k1.sign_ecdsa(digest, pk)

return rv

Expand Down

0 comments on commit 003839a

Please sign in to comment.