1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-18 11:21:11 +00:00

use FirmwareErase.length field

This commit is contained in:
Pavol Rusnak 2017-06-20 16:32:54 +02:00
parent c1fae7d19f
commit 564e6590c2
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 36 additions and 29 deletions

View File

@ -957,12 +957,12 @@ class ProtocolMixin(object):
if self.features.bootloader_mode == False: if self.features.bootloader_mode == False:
raise Exception("Device must be in bootloader mode") raise Exception("Device must be in bootloader mode")
resp = self.call(proto.FirmwareErase()) data = fp.read()
resp = self.call(proto.FirmwareErase(length=len(data)))
if isinstance(resp, proto.Failure) and resp.code == types.Failure_FirmwareError: if isinstance(resp, proto.Failure) and resp.code == types.Failure_FirmwareError:
return False return False
data = fp.read()
# TREZORv1 method # TREZORv1 method
if isinstance(resp, proto.Success): if isinstance(resp, proto.Success):
fingerprint = hashlib.sha256(data[256:]).hexdigest() fingerprint = hashlib.sha256(data[256:]).hexdigest()

File diff suppressed because one or more lines are too long