1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

eth: replace fw error with data error in verify function

closes #422
This commit is contained in:
Tomas Susanka 2018-11-26 16:28:23 +01:00
parent c3112fd83d
commit 8213fee15b

View File

@ -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()