aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'pyecsca/codegen')
-rw-r--r--pyecsca/codegen/builder.py6
-rw-r--r--pyecsca/codegen/client.py3
-rw-r--r--pyecsca/codegen/render.py4
3 files changed, 10 insertions, 3 deletions
diff --git a/pyecsca/codegen/builder.py b/pyecsca/codegen/builder.py
index 8ed7022..2cd572b 100644
--- a/pyecsca/codegen/builder.py
+++ b/pyecsca/codegen/builder.py
@@ -151,11 +151,15 @@ def build_impl(ctx, platform, hash, rand, mul, sqr, red, inv, keygen, ecdh, ecds
if ecdsa and not any(isinstance(formula, AdditionFormula) for formula in formulas):
raise click.BadParameter("ECDSA needs an addition formula. None was supplied.")
+ click.echo("[ ] Rendering...")
config = DeviceConfiguration(model, coords, formulas, scalarmult, hash, rand, mul, sqr, red,
inv, platform, keygen, ecdh, ecdsa)
dir, elf_file, hex_file = render(config)
+ click.echo("[*] Rendered.")
+ click.echo("[ ] Building...")
subprocess.run(["make"], cwd=dir, capture_output=not verbose)
+ click.echo("[*] Built.")
if strip:
subprocess.run(["make", "strip"], cwd=dir, capture_output=not verbose)
@@ -163,6 +167,8 @@ def build_impl(ctx, platform, hash, rand, mul, sqr, red, inv, keygen, ecdh, ecds
full_hex_path = path.join(dir, hex_file)
shutil.copy(full_elf_path, outdir)
shutil.copy(full_hex_path, outdir)
+ click.echo(elf_file)
+ click.echo(hex_file)
if remove:
shutil.rmtree(dir)
else:
diff --git a/pyecsca/codegen/client.py b/pyecsca/codegen/client.py
index f8e7008..e91e8c5 100644
--- a/pyecsca/codegen/client.py
+++ b/pyecsca/codegen/client.py
@@ -12,10 +12,9 @@ from chipwhisperer.capture.api.programmers import STM32FProgrammer, XMEGAProgram
from chipwhisperer.capture.targets import SimpleSerial
from public import public
from pyecsca.ec.coordinates import CoordinateModel, AffineCoordinateModel
-from pyecsca.ec.curves import get_params
from pyecsca.ec.mod import Mod
from pyecsca.ec.model import CurveModel
-from pyecsca.ec.params import DomainParameters
+from pyecsca.ec.params import DomainParameters, get_params
from pyecsca.ec.point import Point, InfinityPoint
from pyecsca.sca.target import (SimpleSerialTarget, ChipWhispererTarget, BinaryTarget, Flashable,
SimpleSerialMessage as SMessage)
diff --git a/pyecsca/codegen/render.py b/pyecsca/codegen/render.py
index 50d15af..c5c9367 100644
--- a/pyecsca/codegen/render.py
+++ b/pyecsca/codegen/render.py
@@ -4,6 +4,7 @@ import subprocess
import tempfile
from _ast import Pow
from os import path
+from os import mkdir
from typing import Optional, List, Set, Mapping, MutableMapping, Any, Tuple
from jinja2 import Environment, PackageLoader
@@ -252,9 +253,10 @@ def build(dir: str, elf_file: str, hex_file: str, outdir: str, strip: bool = Fal
if res.returncode != 0:
raise ValueError("Build failed!")
if strip:
- subprocess.run(["strip", elf_file], cwd=dir)
+ subprocess.run(["make", "strip"], cwd=dir)
full_elf_path = path.join(dir, elf_file)
full_hex_path = path.join(dir, hex_file)
+ mkdir(outdir)
shutil.copy(full_elf_path, outdir)
shutil.copy(full_hex_path, outdir)
if remove: