mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-03 12:00:59 +00:00
tests: create tests.support module
for things that should not be part of trezorlib but tests use them
This commit is contained in:
parent
a289d16838
commit
603b201ad0
0
trezorlib/tests/support/__init__.py
Normal file
0
trezorlib/tests/support/__init__.py
Normal file
@ -27,8 +27,8 @@ from ecdsa.util import string_to_number, number_to_string
|
||||
from ecdsa.curves import SECP256k1
|
||||
from ecdsa.ellipticcurve import Point, INFINITY
|
||||
|
||||
from . import tools
|
||||
from . import messages as proto
|
||||
from trezorlib import tools
|
||||
from trezorlib import messages
|
||||
|
||||
PRIME_DERIVATION_FLAG = 0x80000000
|
||||
|
||||
@ -76,7 +76,7 @@ def public_ckd(public_node, n):
|
||||
if not isinstance(n, list):
|
||||
raise ValueError('Parameter must be a list')
|
||||
|
||||
node = proto.HDNodeType()
|
||||
node = messages.HDNodeType()
|
||||
node.CopyFrom(public_node)
|
||||
|
||||
for i in n:
|
||||
@ -98,7 +98,7 @@ def get_subnode(node, i):
|
||||
I64 = hmac.HMAC(key=node.chain_code, msg=data, digestmod=hashlib.sha512).digest()
|
||||
I_left_as_exponent = string_to_number(I64[:32])
|
||||
|
||||
node_out = proto.HDNodeType()
|
||||
node_out = messages.HDNodeType()
|
||||
node_out.depth = node.depth + 1
|
||||
node_out.child_num = i
|
||||
node_out.chain_code = I64[32:]
|
||||
@ -138,7 +138,7 @@ def deserialize(xpub):
|
||||
if tools.Hash(data[:-4])[:4] != data[-4:]:
|
||||
raise ValueError("Checksum failed")
|
||||
|
||||
node = proto.HDNodeType()
|
||||
node = messages.HDNodeType()
|
||||
node.depth = struct.unpack('>B', data[4:5])[0]
|
||||
node.fingerprint = struct.unpack('>I', data[5:9])[0]
|
||||
node.child_num = struct.unpack('>I', data[9:13])[0]
|
@ -1,7 +1,6 @@
|
||||
# orignal version downloaded from https://ed25519.cr.yp.to/python/ed25519.py
|
||||
# modified for Python 3 by Jochen Hoenicke <hoenicke@gmail.com>
|
||||
|
||||
import sys
|
||||
import hashlib
|
||||
|
||||
b = 256
|
Loading…
Reference in New Issue
Block a user