libmbedtls: make mbedtls_mpi_mont*() available
Makes mbedtls_mpi_montg_init(), mbedtls_mpi_montmul() and
mbedtls_mpi_montred() available for external use.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
[jf: rebased onto mbedtls-2.22.0]
Signed-off-by: Jerome Forissier <jerome@forissier.org>
[jf: rebased onto mbedtls-2.27.0, keep static functions]
Signed-off-by: Jerome Forissier <jerome@forissier.org>
diff --git a/lib/libmbedtls/mbedtls/library/bignum.c b/lib/libmbedtls/mbedtls/library/bignum.c
index 20afa22..9e84da5 100644
--- a/lib/libmbedtls/mbedtls/library/bignum.c
+++ b/lib/libmbedtls/mbedtls/library/bignum.c
@@ -2141,6 +2141,11 @@
*mm = ~x + 1;
}
+void mbedtls_mpi_montg_init( mbedtls_mpi_uint *mm, const mbedtls_mpi *N )
+{
+ mpi_montg_init( mm, N );
+}
+
/** Montgomery multiplication: A = A * B * R^-1 mod N (HAC 14.36)
*
* \param[in,out] A One of the numbers to multiply.
@@ -2210,6 +2215,12 @@
mpi_safe_cond_assign( n, A->p, d, (unsigned char) d[n] );
}
+void mbedtls_mpi_montmul( mbedtls_mpi *A, const mbedtls_mpi *B, const mbedtls_mpi *N, mbedtls_mpi_uint mm,
+ const mbedtls_mpi *T )
+{
+ mpi_montmul( A, B, N, mm, T);
+}
+
/*
* Montgomery reduction: A = A * R^-1 mod N
*
@@ -2227,6 +2238,12 @@
mpi_montmul( A, &U, N, mm, T );
}
+void mbedtls_mpi_montred( mbedtls_mpi *A, const mbedtls_mpi *N,
+ mbedtls_mpi_uint mm, const mbedtls_mpi *T )
+{
+ mpi_montred( A, N, mm, T );
+}
+
/*
* Constant-flow boolean "equal" comparison:
* return x == y