diff options
Diffstat (limited to 'pyecsca/codegen/mult')
| -rw-r--r-- | pyecsca/codegen/mult/double_and_add.c | 3 | ||||
| -rw-r--r-- | pyecsca/codegen/mult/mult.c | 6 | ||||
| -rw-r--r-- | pyecsca/codegen/mult/mult.h | 5 |
3 files changed, 12 insertions, 2 deletions
diff --git a/pyecsca/codegen/mult/double_and_add.c b/pyecsca/codegen/mult/double_and_add.c index 1fd3c9e..a795654 100644 --- a/pyecsca/codegen/mult/double_and_add.c +++ b/pyecsca/codegen/mult/double_and_add.c @@ -1,10 +1,11 @@ #include "mult.h" +#include "formulas.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(curve->n); + int nbits = bn_bit_length(&curve->n); for (int i = nbits; i >= 0; i--) { point_dbl(r, curve, r); if (bn_get_bit(scalar, i) == 1) { diff --git a/pyecsca/codegen/mult/mult.c b/pyecsca/codegen/mult/mult.c new file mode 100644 index 0000000..d0f60ae --- /dev/null +++ b/pyecsca/codegen/mult/mult.c @@ -0,0 +1,6 @@ + +#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 index dcf6767..d2817b7 100644 --- a/pyecsca/codegen/mult/mult.h +++ b/pyecsca/codegen/mult/mult.h @@ -1,7 +1,10 @@ #ifndef MULT_H_ #define MULT_H_ -#include "formulas.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); |
