1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-28 15:22:14 +00:00

chore(core/tests): add smoke test for libtropic

[no changelog]
This commit is contained in:
Ioan Bizău 2024-09-25 18:45:38 +02:00
parent 3c707d2063
commit aee16c2df7
2 changed files with 28 additions and 1 deletions

View File

@ -16,10 +16,10 @@ from trezorutils import ( # noqa: F401
USE_BUTTON,
USE_HAPTIC,
USE_OPTIGA,
USE_TROPIC,
USE_SD_CARD,
USE_THP,
USE_TOUCH,
USE_TROPIC,
VERSION,
bootloader_locked,
check_firmware_header,

View File

@ -0,0 +1,27 @@
import unittest
from trezor.crypto import tropic
class TestCryptoTropic(unittest.TestCase):
def test_ping(self):
self.assertEqual(tropic.ping("HeLlO!"), "HeLlO!")
def test_get_certificate(self):
self.assertEqual(len(tropic.get_certificate()), 512)
def test_sign(self):
try:
tropic.sign(0, "ASD")
assert False
except ValueError as e:
self.assertIn("invalid length", str(e).lower())
tropic.key_generate(0)
# signing should work now that we have a key
self.assertEqual(len(tropic.sign(0, "a" * 32)), 64)
if __name__ == "__main__":
unittest.main()