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/mult | |
| 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/mult')
| -rw-r--r-- | pyecsca/codegen/mult/double_and_add.c | 19 | ||||
| -rw-r--r-- | pyecsca/codegen/mult/mult.c | 6 | ||||
| -rw-r--r-- | pyecsca/codegen/mult/mult.h | 11 |
3 files changed, 0 insertions, 36 deletions
diff --git a/pyecsca/codegen/mult/double_and_add.c b/pyecsca/codegen/mult/double_and_add.c deleted file mode 100644 index 1cead25..0000000 --- a/pyecsca/codegen/mult/double_and_add.c +++ /dev/null @@ -1,19 +0,0 @@ -#include "mult.h" -#include "point.h" - -void scalar_mult(bn_t *scalar, point_t *point, curve_t *curve, point_t *out) { - point_t *q = point_copy(point); - point_t *r = point_copy(curve->neutral); - - int nbits = bn_bit_length(scalar); - for (int i = nbits; i >= 0; i--) { - point_dbl(r, curve, r); - if (bn_get_bit(scalar, i) == 1) { - point_add(q, r, curve, r); - } - } - //point_scl(r, curve, r); - point_set(r, out); - point_free(q); - point_free(r); -}
\ No newline at end of file diff --git a/pyecsca/codegen/mult/mult.c b/pyecsca/codegen/mult/mult.c deleted file mode 100644 index d0f60ae..0000000 --- a/pyecsca/codegen/mult/mult.c +++ /dev/null @@ -1,6 +0,0 @@ - -#include "mult.h" - -#if MULT == MULT_DOUBLE_AND_ADD -#include "double_and_add.c" -#endif
\ No newline at end of file diff --git a/pyecsca/codegen/mult/mult.h b/pyecsca/codegen/mult/mult.h deleted file mode 100644 index d2817b7..0000000 --- a/pyecsca/codegen/mult/mult.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef MULT_H_ -#define MULT_H_ - -#include "defs.h" - -#define MULT_NONE 0 -#define MULT_DOUBLE_AND_ADD 1 - -void scalar_mult(bn_t *scalar, point_t *point, curve_t *curve, point_t *out); - -#endif //MULT_H_
\ No newline at end of file |
