summaryrefslogtreecommitdiffstats
path: root/mpi
diff options
context:
space:
mode:
Diffstat (limited to 'mpi')
-rw-r--r--mpi/mpi-add.c14
-rw-r--r--mpi/mpi-inv.c2
-rw-r--r--mpi/mpi-mul.c7
3 files changed, 22 insertions, 1 deletions
diff --git a/mpi/mpi-add.c b/mpi/mpi-add.c
index 2c1aa6c61..b9c69af44 100644
--- a/mpi/mpi-add.c
+++ b/mpi/mpi-add.c
@@ -222,3 +222,17 @@ mpi_sub(MPI w, MPI u, MPI v)
}
+void
+mpi_addm( MPI w, MPI u, MPI v, MPI m)
+{
+ mpi_add(w, u, v);
+ mpi_fdiv_r( w, w, m );
+}
+
+void
+mpi_subm( MPI w, MPI u, MPI v, MPI m)
+{
+ mpi_sub(w, u, v);
+ mpi_fdiv_r( w, w, m );
+}
+
diff --git a/mpi/mpi-inv.c b/mpi/mpi-inv.c
index f37f4e511..28cde00b6 100644
--- a/mpi/mpi-inv.c
+++ b/mpi/mpi-inv.c
@@ -30,7 +30,7 @@
* 1 = (a*x) mod n
*/
void
-mpi_inv_mod( MPI x, MPI a, MPI n )
+mpi_invm( MPI x, MPI a, MPI n )
{
#if 0
MPI u, v, u1, u2, u3, v1, v2, v3, q, t1, t2, t3;
diff --git a/mpi/mpi-mul.c b/mpi/mpi-mul.c
index 03f2b4b44..aa5beb73b 100644
--- a/mpi/mpi-mul.c
+++ b/mpi/mpi-mul.c
@@ -176,3 +176,10 @@ mpi_mul( MPI w, MPI u, MPI v)
}
+void
+mpi_mulm( MPI w, MPI u, MPI v, MPI m)
+{
+ mpi_mul(w, u, v);
+ mpi_fdiv_r( w, w, m );
+}
+