MP_PREC is an internal macro, it should be defined in tommath_private.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
diff --git a/tommath.h b/tommath.h
index a420f5b..70bda2f 100644
--- a/tommath.h
+++ b/tommath.h
@@ -161,12 +161,13 @@ TOOM_SQR_CUTOFF;
/* default precision */
#ifndef MP_PREC
# ifndef MP_LOW_MEM
-# define MP_PREC 32 /* default digits of precision */
+# define PRIVATE_MP_PREC 32 /* default digits of precision */
# elif defined(MP_8BIT)
-# define MP_PREC 16 /* default digits of precision */
+# define PRIVATE_MP_PREC 16 /* default digits of precision */
# else
-# define MP_PREC 8 /* default digits of precision */
+# define PRIVATE_MP_PREC 8 /* default digits of precision */
# endif
+# define MP_PREC (MP_DEPRECATED_PRAGMA("MP_PREC is an internal macro") PRIVATE_MP_PREC)
#endif
/* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */
diff --git a/tommath_private.h b/tommath_private.h
index 4df0a32..a8bae40 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -140,10 +140,6 @@ extern void *MP_CALLOC(size_t nmemb, size_t size);
extern void MP_FREE(void *mem, size_t size);
#endif
-/* TODO: Remove PRIVATE_MP_WARRAY as soon as deprecated MP_WARRAY is removed from tommath.h */
-#undef MP_WARRAY
-#define MP_WARRAY PRIVATE_MP_WARRAY
-
/* TODO: Remove private_mp_word as soon as deprecated mp_word is removed from tommath. */
#undef mp_word
typedef private_mp_word mp_word;
@@ -162,6 +158,16 @@ typedef private_mp_word mp_word;
#define MP_SIZEOF_BITS(type) ((size_t)CHAR_BIT * sizeof(type))
#define MP_MAXFAST (int)(1uL << (MP_SIZEOF_BITS(mp_word) - (2u * (size_t)MP_DIGIT_BIT)))
+/* TODO: Remove PRIVATE_MP_WARRAY as soon as deprecated MP_WARRAY is removed from tommath.h */
+#undef MP_WARRAY
+#define MP_WARRAY PRIVATE_MP_WARRAY
+
+/* TODO: Remove PRIVATE_MP_PREC as soon as deprecated MP_PREC is removed from tommath.h */
+#ifdef PRIVATE_MP_PREC
+# undef MP_PREC
+# define MP_PREC PRIVATE_MP_PREC
+#endif
+
/* Minimum number of available digits in mp_int, MP_PREC >= MP_MIN_PREC */
#define MP_MIN_PREC ((((CHAR_BIT * (int)sizeof(long long)) + MP_DIGIT_BIT) - 1) / MP_DIGIT_BIT)