aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/codegen/templates
diff options
context:
space:
mode:
authorJ08nY2020-03-09 13:03:06 +0100
committerJ08nY2020-03-09 13:03:06 +0100
commit279a859f221421057e54eb823d2993b2005c317e (patch)
tree3a440ca169ed1b80388cdcf253b9b400688bda91 /pyecsca/codegen/templates
parenta7d3589c4ba3551ab614dfc9c931c5998fbf7fac (diff)
downloadpyecsca-codegen-279a859f221421057e54eb823d2993b2005c317e.tar.gz
pyecsca-codegen-279a859f221421057e54eb823d2993b2005c317e.tar.zst
pyecsca-codegen-279a859f221421057e54eb823d2993b2005c317e.zip
NOP around point operations.
Diffstat (limited to 'pyecsca/codegen/templates')
-rw-r--r--pyecsca/codegen/templates/formula_add.c3
-rw-r--r--pyecsca/codegen/templates/formula_dadd.c3
-rw-r--r--pyecsca/codegen/templates/formula_dbl.c3
-rw-r--r--pyecsca/codegen/templates/formula_ladd.c3
-rw-r--r--pyecsca/codegen/templates/formula_neg.c3
-rw-r--r--pyecsca/codegen/templates/formula_scl.c3
-rw-r--r--pyecsca/codegen/templates/formula_tpl.c3
7 files changed, 21 insertions, 0 deletions
diff --git a/pyecsca/codegen/templates/formula_add.c b/pyecsca/codegen/templates/formula_add.c
index ffd7774..3d7e394 100644
--- a/pyecsca/codegen/templates/formula_add.c
+++ b/pyecsca/codegen/templates/formula_add.c
@@ -1,5 +1,6 @@
#include "point.h"
#include "action.h"
+#include "hal/hal.h"
{% import "ops.c" as ops %}
{% from "action.c" import start_action, end_action %}
@@ -9,6 +10,7 @@
void point_add(const point_t *one, const point_t *other, const curve_t *curve, point_t *out_one) {
{{ start_action("add") }}
+ NOP_128();
{%- if short_circuit %}
if (point_equals(one, curve->neutral)) {
point_set(other, out_one);
@@ -22,5 +24,6 @@ void point_add(const point_t *one, const point_t *other, const curve_t *curve, p
{{ ops.render_initializations(initializations) }}
{{ ops.render_ops(operations) }}
{{ ops.render_returns(returns) }}
+ NOP_128();
{{ end_action("add") }}
} \ No newline at end of file
diff --git a/pyecsca/codegen/templates/formula_dadd.c b/pyecsca/codegen/templates/formula_dadd.c
index 46ef196..0605b23 100644
--- a/pyecsca/codegen/templates/formula_dadd.c
+++ b/pyecsca/codegen/templates/formula_dadd.c
@@ -1,5 +1,6 @@
#include "point.h"
#include "action.h"
+#include "hal/hal.h"
{% import "ops.c" as ops %}
{% from "action.c" import start_action, end_action %}
@@ -9,9 +10,11 @@
void point_dadd(const point_t *one, const point_t *other, const point_t *diff, const curve_t *curve, point_t *out_one) {
{{ start_action("dadd") }}
+ NOP_128();
// TODO: short-circuits
{{ ops.render_initializations(initializations) }}
{{ ops.render_ops(operations) }}
{{ ops.render_returns(returns) }}
+ NOP_128();
{{ end_action("dadd") }}
}
diff --git a/pyecsca/codegen/templates/formula_dbl.c b/pyecsca/codegen/templates/formula_dbl.c
index 45103bc..b741572 100644
--- a/pyecsca/codegen/templates/formula_dbl.c
+++ b/pyecsca/codegen/templates/formula_dbl.c
@@ -1,5 +1,6 @@
#include "point.h"
#include "action.h"
+#include "hal/hal.h"
{% import "ops.c" as ops %}
{% from "action.c" import start_action, end_action %}
@@ -9,6 +10,7 @@
void point_dbl(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ start_action("dbl") }}
+ NOP_128();
{%- if short_circuit %}
if (point_equals(one, curve->neutral)) {
point_set(one, out_one);
@@ -18,5 +20,6 @@ void point_dbl(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ ops.render_initializations(initializations) }}
{{ ops.render_ops(operations) }}
{{ ops.render_returns(returns) }}
+ NOP_128();
{{ end_action("dbl") }}
} \ No newline at end of file
diff --git a/pyecsca/codegen/templates/formula_ladd.c b/pyecsca/codegen/templates/formula_ladd.c
index 4ae738c..6155185 100644
--- a/pyecsca/codegen/templates/formula_ladd.c
+++ b/pyecsca/codegen/templates/formula_ladd.c
@@ -1,5 +1,6 @@
#include "point.h"
#include "action.h"
+#include "hal/hal.h"
{% import "ops.c" as ops %}
{% from "action.c" import start_action, end_action %}
@@ -9,9 +10,11 @@
void point_ladd(const point_t *one, const point_t *other, const point_t *diff, const curve_t *curve, point_t *out_one, point_t *out_other) {
{{ start_action("ladd") }}
+ NOP_128();
// TODO: short-circuits
{{ ops.render_initializations(initializations) }}
{{ ops.render_ops(operations) }}
{{ ops.render_returns(returns) }}
+ NOP_128();
{{ end_action("ladd") }}
} \ No newline at end of file
diff --git a/pyecsca/codegen/templates/formula_neg.c b/pyecsca/codegen/templates/formula_neg.c
index e5b47ef..f8d0e14 100644
--- a/pyecsca/codegen/templates/formula_neg.c
+++ b/pyecsca/codegen/templates/formula_neg.c
@@ -1,5 +1,6 @@
#include "point.h"
#include "action.h"
+#include "hal/hal.h"
{% import "ops.c" as ops %}
{% from "action.c" import start_action, end_action %}
@@ -9,6 +10,7 @@
void point_neg(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ start_action("neg") }}
+ NOP_128();
{%- if short_circuit %}
if (point_equals(one, curve->neutral)) {
point_set(one, out_one);
@@ -18,5 +20,6 @@ void point_neg(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ ops.render_initializations(initializations) }}
{{ ops.render_ops(operations) }}
{{ ops.render_returns(returns) }}
+ NOP_128();
{{ end_action("neg") }}
} \ No newline at end of file
diff --git a/pyecsca/codegen/templates/formula_scl.c b/pyecsca/codegen/templates/formula_scl.c
index 32bad57..8a840e9 100644
--- a/pyecsca/codegen/templates/formula_scl.c
+++ b/pyecsca/codegen/templates/formula_scl.c
@@ -1,5 +1,6 @@
#include "point.h"
#include "action.h"
+#include "hal/hal.h"
{% import "ops.c" as ops %}
{% from "action.c" import start_action, end_action %}
@@ -9,6 +10,7 @@
void point_scl(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ start_action("scl") }}
+ NOP_128();
{%- if short_circuit %}
if (point_equals(one, curve->neutral)) {
point_set(one, out_one);
@@ -18,5 +20,6 @@ void point_scl(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ ops.render_initializations(initializations) }}
{{ ops.render_ops(operations) }}
{{ ops.render_returns(returns) }}
+ NOP_128();
{{ end_action("scl") }}
} \ No newline at end of file
diff --git a/pyecsca/codegen/templates/formula_tpl.c b/pyecsca/codegen/templates/formula_tpl.c
index 2be8dee..08a6278 100644
--- a/pyecsca/codegen/templates/formula_tpl.c
+++ b/pyecsca/codegen/templates/formula_tpl.c
@@ -1,5 +1,6 @@
#include "point.h"
#include "action.h"
+#include "hal/hal.h"
{% import "ops.c" as ops %}
{% from "action.c" import start_action, end_action %}
@@ -9,6 +10,7 @@
void point_tpl(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ start_action("tpl") }}
+ NOP_128();
{%- if short_circuit %}
if (point_equals(one, curve->neutral)) {
point_set(one, out_one);
@@ -18,5 +20,6 @@ void point_tpl(const point_t *one, const curve_t *curve, point_t *out_one) {
{{ ops.render_initializations(initializations) }}
{{ ops.render_ops(operations) }}
{{ ops.render_returns(returns) }}
+ NOP_128();
{{ end_action("tpl") }}
} \ No newline at end of file