1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 06:18:07 +00:00

core/signverify: add failsafe for an empty message header

This commit is contained in:
Tomas Susanka 2020-06-11 09:08:50 +02:00
parent 56fe5adcfc
commit 981d079d7f

View File

@ -18,6 +18,8 @@ def message_digest(coin: CoinType, message: bytes) -> bytes:
h = utils.HashWriter(blake256())
else:
h = utils.HashWriter(sha256())
if not coin.signed_message_header:
raise wire.DataError("Empty message header not allowed.")
write_bitcoin_varint(h, len(coin.signed_message_header))
h.extend(coin.signed_message_header)
write_bitcoin_varint(h, len(message))