1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-06-25 09:22:33 +00:00

make flake8 happy (#225)

This commit is contained in:
matejcik 2018-03-02 16:47:29 +01:00 committed by Pavol Rusnak
parent b24550c72f
commit 55641dd8b5
3 changed files with 15 additions and 7 deletions

View File

@ -18,10 +18,12 @@ except:
from trezorlib.client import TrezorClient
from trezorlib.transport_hid import HidTransport
# Return path by BIP-32
def getPath(client):
return client.expand_path("10016'/0")
# Deriving master key
def getMasterKey(client):
bip32_path = getPath(client)
@ -36,6 +38,7 @@ def getMasterKey(client):
))
return key
# Deriving file name and encryption key
def getFileEncKey(key):
filekey, enckey = key[:len(key) // 2], key[len(key) // 2:]
@ -44,6 +47,7 @@ def getFileEncKey(key):
filename = digest + '.pswd'
return [filename, filekey, enckey]
# File level decryption and file reading
def decryptStorage(path, key):
cipherkey = unhexlify(key)
@ -64,6 +68,7 @@ def decryptStorage(path, key):
data = data + decryptor.finalize().decode()
return json.loads(data)
def decryptEntryValue(nonce, val):
cipherkey = unhexlify(nonce)
iv = val[:12]
@ -83,6 +88,7 @@ def decryptEntryValue(nonce, val):
data = data + decryptor.finalize().decode()
return json.loads(data)
# Decrypt give entry nonce
def getDecryptedNonce(client, entry):
print()
@ -108,6 +114,7 @@ def getDecryptedNonce(client, entry):
))
return decrypted_nonce
# Pretty print of list
def printEntries(entries):
print('Password entries')
@ -117,7 +124,8 @@ def printEntries(entries):
print('Entry id: #%s' % k)
print('-------------')
for kk, vv in v.items():
if kk in ['nonce', 'safe_note', 'password']: continue # skip these fields
if kk in ['nonce', 'safe_note', 'password']:
continue # skip these fields
print('*', kk, ': ', vv)
print()
return
@ -169,5 +177,6 @@ def main():
return
if __name__ == '__main__':
main()

View File

@ -187,7 +187,6 @@ class TestMsgSigntxBch(TrezorTest):
else:
assert False # exception expected
def test_attack_change_input(self):
self.setup_mnemonic_allallall()
self.client.set_tx_api(TxApiBcash)