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

passphrase: use same max length as T1

This commit is contained in:
Jan Pochyla 2018-11-29 14:58:26 +01:00 committed by Pavol Rusnak
parent 8120ee91f6
commit 98dab122f9
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -1,3 +1,5 @@
from micropython import const
from trezor import ui, wire from trezor import ui, wire
from trezor.messages import ButtonRequestType, MessageType, PassphraseSourceType from trezor.messages import ButtonRequestType, MessageType, PassphraseSourceType
from trezor.messages.ButtonRequest import ButtonRequest from trezor.messages.ButtonRequest import ButtonRequest
@ -10,6 +12,8 @@ from trezor.ui.text import Text
from apps.common import storage from apps.common import storage
from apps.common.cache import get_state from apps.common.cache import get_state
_MAX_PASSPHRASE_LEN = const(50)
@ui.layout @ui.layout
async def request_passphrase_entry(ctx): async def request_passphrase_entry(ctx):
@ -67,6 +71,8 @@ async def request_passphrase(ctx):
else: else:
on_device = storage.get_passphrase_source() == PassphraseSourceType.DEVICE on_device = storage.get_passphrase_source() == PassphraseSourceType.DEVICE
passphrase = await request_passphrase_ack(ctx, on_device) passphrase = await request_passphrase_ack(ctx, on_device)
if len(passphrase) > _MAX_PASSPHRASE_LEN:
raise wire.DataError("Maximum passphrase length is %d" % _MAX_PASSPHRASE_LEN)
return passphrase return passphrase