1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 00:28:10 +00:00

storage: explicitly reseed in PRNG tests

This commit is contained in:
matejcik 2019-08-07 17:42:36 +02:00 committed by matejcik
parent eaf1e940a8
commit cb99a175ea
3 changed files with 5 additions and 9 deletions

View File

@ -1,8 +0,0 @@
from ..src import prng
def pytest_runtest_teardown(item):
"""
Called after each test ran to reset the PRNG
"""
prng.seed = 0

View File

@ -1,7 +1,9 @@
from ..src import pin_log from ..src import pin_log, prng
def test_generate_guard_key(): def test_generate_guard_key():
prng.random_reseed(0)
p = pin_log.PinLog(None) p = pin_log.PinLog(None)
assert p._generate_guard_key() == 2267428717 assert p._generate_guard_key() == 2267428717

View File

@ -2,6 +2,8 @@ from ..src import prng
def test_prng(): def test_prng():
prng.random_reseed(0)
buf = prng.random_buffer(4) buf = prng.random_buffer(4)
assert buf == b"\x5f\xf3\x6e\x3c" assert buf == b"\x5f\xf3\x6e\x3c"
buf = prng.random_buffer(4) buf = prng.random_buffer(4)