1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

Bug fixes

- Ignore u2f interface instead of failing.
- Fix set_mnenomic in debug client
- Don't encode utf-8 mnenomics to byte arrays.
This commit is contained in:
Jochen Hoenicke 2016-06-26 18:44:24 +02:00
parent e51fb2078f
commit eac9c99e32
No known key found for this signature in database
GPG Key ID: 65B10C0466560648
3 changed files with 6 additions and 8 deletions

View File

@ -91,14 +91,14 @@ class expect(object):
def normalize_nfc(txt):
if sys.version_info[0] < 3:
if isinstance(txt, unicode):
return unicodedata.normalize('NFC', txt).encode('utf-8')
return unicodedata.normalize('NFC', txt)
if isinstance(txt, str):
return unicodedata.normalize('NFC', txt.decode('utf-8')).encode('utf-8')
return unicodedata.normalize('NFC', txt.decode('utf-8'))
else:
if isinstance(txt, bytes):
return unicodedata.normalize('NFC', txt.decode('utf-8')).encode('utf-8')
return unicodedata.normalize('NFC', txt.decode('utf-8'))
if isinstance(txt, str):
return unicodedata.normalize('NFC', txt).encode('utf-8')
return unicodedata.normalize('NFC', txt)
raise Exception('unicode/str or bytes/str expected')
@ -283,7 +283,7 @@ class DebugLinkMixin(object):
self.passphrase = normalize_nfc(passphrase)
def set_mnemonic(self, mnemonic):
self.mnemonic = normalize_nfc(mnemonic)
self.mnemonic = normalize_nfc(mnemonic).split(' ')
def call_raw(self, msg):

View File

@ -14,7 +14,7 @@ from google.protobuf import descriptor_pb2
_sym_db = _symbol_database.Default()
import types_pb2
from . import types_pb2
DESCRIPTOR = _descriptor.FileDescriptor(

View File

@ -49,8 +49,6 @@ class HidTransport(Transport):
devices[serial_number][0] = path
elif interface_number == 1: # debug link
devices[serial_number][1] = path
else:
raise Exception("Unknown USB interface number: %d" % interface_number)
# List of two-tuples (path_normal, path_debuglink)
return list(devices.values())