mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +00:00
parent
c3112fd83d
commit
8213fee15b
@ -1,5 +1,6 @@
|
||||
from ubinascii import hexlify
|
||||
|
||||
from trezor import wire
|
||||
from trezor.crypto.curve import secp256k1
|
||||
from trezor.crypto.hashlib import sha3_256
|
||||
from trezor.messages.Success import Success
|
||||
@ -22,12 +23,12 @@ async def verify_message(ctx, msg):
|
||||
pubkey = secp256k1.verify_recover(sig, digest)
|
||||
|
||||
if not pubkey:
|
||||
raise ValueError("Invalid signature")
|
||||
raise wire.DataError("Invalid signature")
|
||||
|
||||
pkh = sha3_256(pubkey[1:], keccak=True).digest()[-20:]
|
||||
|
||||
if msg.address != pkh:
|
||||
raise ValueError("Invalid signature")
|
||||
raise wire.DataError("Invalid signature")
|
||||
|
||||
address = "0x" + hexlify(msg.address).decode()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user