aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/test_regress.py
blob: 24eedb5d6ea2391206169e48a8d98dc9e3d64672 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import pytest
from pyecsca.ec.configuration import (
    HashType,
    RandomMod,
    Multiplication,
    Squaring,
    Reduction,
    Inversion,
)
from pyecsca.ec.mult import LTRMultiplier

from pyecsca.codegen.common import Platform, DeviceConfiguration
from pyecsca.codegen.render import render_and_build


def test_regress_5(secp128r1, tmp_path):
    platform = Platform.HOST
    hash_type = HashType.SHA1
    mod_rand = RandomMod.REDUCE
    mult = Multiplication.BASE
    sqr = Squaring.BASE
    red = Reduction.BASE
    inv = Inversion.GCD
    model = secp128r1.curve.model
    coords = secp128r1.curve.coordinate_model
    add = coords.formulas["add-2015-rcb"]
    dbl = coords.formulas["dbl-2015-rcb"]
    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,
        inv,
        platform,
        True,
        True,
        True,
    )
    dir, elf_file, hex_file, res = render_and_build(config, str(tmp_path), True)
    assert res.returncode == 0