|
|
|
@ -16,7 +16,7 @@
|
|
|
|
|
|
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
|
from trezorlib import messages
|
|
|
|
|
from trezorlib import debuglink, device, messages, misc
|
|
|
|
|
|
|
|
|
|
from ..common import MNEMONIC12
|
|
|
|
|
|
|
|
|
@ -47,3 +47,38 @@ class TestDebuglink:
|
|
|
|
|
|
|
|
|
|
resp = client.call_raw(messages.PassphraseAck(passphrase=""))
|
|
|
|
|
assert isinstance(resp, messages.Address)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.skip_ui
|
|
|
|
|
@pytest.mark.skip_t1
|
|
|
|
|
def test_softlock_instability(client):
|
|
|
|
|
def load_device():
|
|
|
|
|
debuglink.load_device(
|
|
|
|
|
client,
|
|
|
|
|
mnemonic=MNEMONIC12,
|
|
|
|
|
pin="1234",
|
|
|
|
|
passphrase_protection=False,
|
|
|
|
|
label="test",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# start from a clean slate:
|
|
|
|
|
client.debug.reseed(0)
|
|
|
|
|
device.wipe(client)
|
|
|
|
|
entropy_after_wipe = misc.get_entropy(client, 16)
|
|
|
|
|
|
|
|
|
|
# configure and wipe the device
|
|
|
|
|
load_device()
|
|
|
|
|
client.debug.reseed(0)
|
|
|
|
|
device.wipe(client)
|
|
|
|
|
assert misc.get_entropy(client, 16) == entropy_after_wipe
|
|
|
|
|
|
|
|
|
|
load_device()
|
|
|
|
|
# the device has PIN -> lock it
|
|
|
|
|
client.call(messages.LockDevice())
|
|
|
|
|
client.debug.reseed(0)
|
|
|
|
|
# wipe_device should succeed with no need to unlock
|
|
|
|
|
device.wipe(client)
|
|
|
|
|
# the device is now trying to run the lockscreen, which attempts to unlock.
|
|
|
|
|
# If the device actually called config.unlock(), it would use additional randomness.
|
|
|
|
|
# That is undesirable. Assert that the returned entropy is still the same.
|
|
|
|
|
assert misc.get_entropy(client, 16) == entropy_after_wipe
|
|
|
|
|