Bignum: extract bignum_mod.h functions
Extract functions declared in bignum_mod.h into a source file with a
matching name.
We are doing this because:
- This is a general best practice/convention
- We hope that this will make resolving merge conflicts in the future
easier
- Having them in a unified source file is a premature optimisation at
this point
This makes library/bignum_new.c empty and therefore it is deleted.
Signed-off-by: Janos Follath <janos.follath@arm.com>
diff --git a/include/mbedtls/mbedtls_config.h b/include/mbedtls/mbedtls_config.h
index ed85e3f..3e25355 100644
--- a/include/mbedtls/mbedtls_config.h
+++ b/include/mbedtls/mbedtls_config.h
@@ -2010,9 +2010,9 @@
* Enable the multi-precision integer library.
*
* Module: library/bignum.c
- * library/bignum_new.c
* library/bignum_core.c
* library/bignum_mod_raw.c
+ * library/bignum_mod.c
* Caller: library/dhm.c
* library/ecp.c
* library/ecdsa.c
diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
index 2920c55..96c12fb 100644
--- a/library/CMakeLists.txt
+++ b/library/CMakeLists.txt
@@ -18,9 +18,9 @@
asn1write.c
base64.c
bignum.c
- bignum_new.c
bignum_core.c
bignum_mod_raw.c
+ bignum_mod.c
camellia.c
ccm.c
chacha20.c
diff --git a/library/Makefile b/library/Makefile
index 6210878..49029d8 100644
--- a/library/Makefile
+++ b/library/Makefile
@@ -83,9 +83,9 @@
asn1write.o \
base64.o \
bignum.o \
- bignum_new.o \
bignum_core.o \
bignum_mod_raw.o \
+ bignum_mod.o \
camellia.o \
ccm.o \
chacha20.o \
diff --git a/library/bignum_new.c b/library/bignum_mod.c
similarity index 99%
rename from library/bignum_new.c
rename to library/bignum_mod.c
index 5ff55aa..63f9172 100644
--- a/library/bignum_new.c
+++ b/library/bignum_mod.c
@@ -26,10 +26,6 @@
#include "mbedtls/platform_util.h"
#include "mbedtls/error.h"
#include "mbedtls/bignum.h"
-#include "bignum_core.h"
-#include "bignum_mod.h"
-#include "bignum_mod_raw.h"
-#include "constant_time_internal.h"
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
@@ -41,6 +37,11 @@
#define mbedtls_free free
#endif
+#include "bignum_core.h"
+#include "bignum_mod.h"
+#include "bignum_mod_raw.h"
+#include "constant_time_internal.h"
+
int mbedtls_mpi_mod_residue_setup( mbedtls_mpi_mod_residue *r,
mbedtls_mpi_mod_modulus *m,
mbedtls_mpi_uint *p,