diff options
Diffstat (limited to 'pyecsca/codegen/bn')
| -rw-r--r-- | pyecsca/codegen/bn/bn.c | 5 | ||||
| -rw-r--r-- | pyecsca/codegen/bn/bn.h | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/pyecsca/codegen/bn/bn.c b/pyecsca/codegen/bn/bn.c index 635eaae..c953119 100644 --- a/pyecsca/codegen/bn/bn.c +++ b/pyecsca/codegen/bn/bn.c @@ -72,6 +72,11 @@ void bn_mod_sub(const bn_t *one, const bn_t *other, const bn_t *mod, bn_t *out) mp_submod(one, other, mod, out); } +void bn_mod_neg(const bn_t *one, const bn_t *mod, bn_t *out) { + mp_neg(one, out); + mp_mod(out, mod, out); +} + void bn_mod_mul(const bn_t *one, const bn_t *other, const bn_t *mod, bn_t *out) { mp_mulmod(one, other, mod, out); } diff --git a/pyecsca/codegen/bn/bn.h b/pyecsca/codegen/bn/bn.h index a5b1ba9..e323170 100644 --- a/pyecsca/codegen/bn/bn.h +++ b/pyecsca/codegen/bn/bn.h @@ -41,6 +41,7 @@ void bn_rand_mod_reduce(bn_t *out, const bn_t *mod); void bn_mod_add(const bn_t *one, const bn_t *other, const bn_t *mod, bn_t *out); void bn_mod_sub(const bn_t *one, const bn_t *other, const bn_t *mod, bn_t *out); +void bn_mod_neg(const bn_t *one, const bn_t *mod, bn_t *out); void bn_mod_mul(const bn_t *one, const bn_t *other, const bn_t *mod, bn_t *out); void bn_mod_sqr(const bn_t *one, const bn_t *mod, bn_t *out); void bn_mod_div(const bn_t *one, const bn_t *other, const bn_t *mod, bn_t *out); |
