diff options
| author | J08nY | 2019-12-23 02:05:35 +0100 |
|---|---|---|
| committer | J08nY | 2019-12-23 02:05:35 +0100 |
| commit | b43c5dba0ec18fe5a5204537855ea2b73fc674c6 (patch) | |
| tree | 879c946cb9036f6db721fc44c37635c295ee2003 /pyecsca/codegen/templates/formula_add.c | |
| parent | 878d95c4e4dadf882a205316a07bc0642f773256 (diff) | |
| download | pyecsca-codegen-b43c5dba0ec18fe5a5204537855ea2b73fc674c6.tar.gz pyecsca-codegen-b43c5dba0ec18fe5a5204537855ea2b73fc674c6.tar.zst pyecsca-codegen-b43c5dba0ec18fe5a5204537855ea2b73fc674c6.zip | |
Implement multipliers.
Diffstat (limited to 'pyecsca/codegen/templates/formula_add.c')
| -rw-r--r-- | pyecsca/codegen/templates/formula_add.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pyecsca/codegen/templates/formula_add.c b/pyecsca/codegen/templates/formula_add.c index 971dd0a..05fd541 100644 --- a/pyecsca/codegen/templates/formula_add.c +++ b/pyecsca/codegen/templates/formula_add.c @@ -1,3 +1,13 @@ void point_add(const point_t *one, const point_t *other, const curve_t *curve, point_t *out_one) { + {%- if short_circuit %} + if (point_equals(one, curve->neutral)) { + point_set(other, out_one); + return; + } + if (point_equals(other, curve->neutral)) { + point_set(one, out_one); + return; + } + {%- endif %} {%- include "ops.c" %} }
\ No newline at end of file |
