mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-18 10:32:02 +00:00
add asserts to debuglink tests
This commit is contained in:
parent
49cecb563d
commit
17e28c0e10
@ -11,15 +11,15 @@ class TestDebugLink(common.TrezorTest):
|
|||||||
|
|
||||||
def test_layout(self):
|
def test_layout(self):
|
||||||
layout = self.client.debuglink.read_layout()
|
layout = self.client.debuglink.read_layout()
|
||||||
print binascii.hexlify(layout)
|
self.assertEqual(len(layout), 1024)
|
||||||
|
|
||||||
def test_mnemonic(self):
|
def test_mnemonic(self):
|
||||||
mnemonic = self.client.debuglink.read_mnemonic()
|
mnemonic = self.client.debuglink.read_mnemonic()
|
||||||
print mnemonic
|
self.assertEqual(mnemonic, self.mnemonic1)
|
||||||
|
|
||||||
def test_node(self):
|
def test_node(self):
|
||||||
node = self.client.debuglink.read_node()
|
node = self.client.debuglink.read_node()
|
||||||
print node
|
self.assertIsNotNone(node)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -30,7 +30,7 @@ def sec_to_public_pair(pubkey):
|
|||||||
curve = generator.curve()
|
curve = generator.curve()
|
||||||
p = curve.p()
|
p = curve.p()
|
||||||
alpha = (pow(x, 3, p) + curve.a() * x + curve.b()) % p
|
alpha = (pow(x, 3, p) + curve.a() * x + curve.b()) % p
|
||||||
beta = ecdsa.number_theory.square_root_mod_prime(alpha, p)
|
beta = ecdsa.numbertheory.square_root_mod_prime(alpha, p)
|
||||||
if is_even == bool(beta & 1):
|
if is_even == bool(beta & 1):
|
||||||
return (x, p - beta)
|
return (x, p - beta)
|
||||||
return (x, beta)
|
return (x, beta)
|
||||||
|
Loading…
Reference in New Issue
Block a user