From 5da1d167c203395103d220c450e29fece08f4198 Mon Sep 17 00:00:00 2001 From: J08nY Date: Wed, 19 Feb 2020 18:29:53 +0100 Subject: Flesh out client, add implementation tests. --- test/test_render.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/test_render.py (limited to 'test/test_render.py') diff --git a/test/test_render.py b/test/test_render.py new file mode 100644 index 0000000..eefa626 --- /dev/null +++ b/test/test_render.py @@ -0,0 +1,32 @@ +import tempfile +from unittest import TestCase + +from pyecsca.ec.configuration import HashType, RandomMod, Multiplication, Squaring, Reduction +from pyecsca.ec.curves import get_params +from pyecsca.ec.mult import LTRMultiplier + +from pyecsca.codegen.common import Platform, DeviceConfiguration +from pyecsca.codegen.render import render_and_build + + +class RenderTests(TestCase): + + def test_basic_build(self): + platform = Platform.HOST + hash_type = HashType.SHA1 + mod_rand = RandomMod.REDUCE + mult = Multiplication.BASE + sqr = Squaring.BASE + red = Reduction.BASE + params = get_params("secg", "secp128r1", "projective") + model = params.curve.model + coords = params.curve.coordinate_model + add = coords.formulas["add-1998-cmo"] + dbl = coords.formulas["dbl-1998-cmo"] + scl = coords.formulas["z"] + formulas = [add, dbl, scl] + scalarmult = LTRMultiplier(add, dbl, scl) + config = DeviceConfiguration(model, coords, formulas, scalarmult, hash_type, mod_rand, mult, + sqr, red, platform, True, True, True) + temp = tempfile.mkdtemp() + render_and_build(config, temp, True) -- cgit v1.3.1