aboutsummaryrefslogtreecommitdiffhomepage
path: root/pyecsca/codegen/bn/bn.c
diff options
context:
space:
mode:
Diffstat (limited to 'pyecsca/codegen/bn/bn.c')
-rw-r--r--pyecsca/codegen/bn/bn.c5
1 files changed, 5 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);
}