From 9ca9f8e9b68ac90164a7cc2c9003dc2d8aa99c47 Mon Sep 17 00:00:00 2001 From: J08nY Date: Mon, 11 Dec 2023 15:02:46 +0100 Subject: Add malloc filtering to trace transform function. --- test/test_emulator.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'test') diff --git a/test/test_emulator.py b/test/test_emulator.py index 93ca074..ab8bf73 100644 --- a/test/test_emulator.py +++ b/test/test_emulator.py @@ -231,3 +231,33 @@ def test_ecdsa(mult_name, mult_class, cli_runner, curve32): True, False, ) + + +def test_tracing(cli_runner, curve32): + formulas = ["add-1998-cmo", "dbl-1998-cmo"] + with cli_runner.isolated_filesystem() as tmpdir: + cli_runner.invoke( + build_impl, + [ + "--platform", + "STM32F3", + "--ecdsa", + "--ecdh", + "--red", + "MONTGOMERY", + "-D", + "BN_NON_CONST", + curve32.curve.model.shortname, + curve32.curve.coordinate_model.name, + *formulas, + f"ltr()", + ".", + ], + ) + target = EmulatorTarget(curve32.curve.model, curve32.curve.coordinate_model, trace_config=TraceConfig(register=HammingWeight())) + target.connect(binary=join(tmpdir, "pyecsca-codegen-CW308_STM32F3.elf")) + target.set_params(curve32) + target.trace = [] + target.scalar_mult(2355498743, curve32.generator) + trace = target.transform_trace() + assert trace is not None \ No newline at end of file -- cgit v1.3.1