Commit e2ee39b536cfe5ea25b602edaf668ab500eba2ca

Daniel Mendler 2019-04-26T12:39:26

deprecate ltm_prime_callback

diff --git a/bn_mp_prime_random_ex.c b/bn_mp_prime_random_ex.c
index 815f0d2..360a091 100644
--- a/bn_mp_prime_random_ex.c
+++ b/bn_mp_prime_random_ex.c
@@ -18,7 +18,7 @@
  */
 
 /* This is possibly the mother of all prime generation functions, muahahahahaha! */
-int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat)
+int mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat)
 {
    unsigned char *tmp, maskAND, maskOR_msb, maskOR_lsb;
    int res, err, bsize, maskOR_msb_offset;
diff --git a/tommath.h b/tommath.h
index bdf1213..ffd1a46 100644
--- a/tommath.h
+++ b/tommath.h
@@ -7,7 +7,7 @@
 #include <stdint.h>
 #include <limits.h>
 
-#ifndef LTM_NO_FILE
+#ifdef LTM_NO_FILE
 #  warning LTM_NO_FILE has been deprecated, use MP_NO_FILE.
 #  define MP_NO_FILE
 #endif
@@ -153,15 +153,6 @@ TOOM_SQR_CUTOFF;
 #   define MP_NULL_TERMINATED
 #endif
 
-/* the infamous mp_int structure */
-typedef struct  {
-   int used, alloc, sign;
-   mp_digit *dp;
-} mp_int;
-
-/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
-typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
-
 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 301)
 #  define MP_DEPRECATED(x) __attribute__((deprecated("replaced by " #x)))
 #  define PRIVATE_MP_DEPRECATED_PRAGMA(s) _Pragma(#s)
@@ -179,6 +170,16 @@ typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat);
 #define DIGIT(m, k) (MP_DEPRECATED_PRAGMA("DIGIT macro is deprecated, use z->dp instead") (m)->dp[(k)])
 #define SIGN(m)     (MP_DEPRECATED_PRAGMA("SIGN macro is deprecated, use z->sign instead") (m)->sign)
 
+/* the infamous mp_int structure */
+typedef struct  {
+   int used, alloc, sign;
+   mp_digit *dp;
+} mp_int;
+
+/* callback for mp_prime_random, should fill dst with random bytes and return how many read [upto len] */
+typedef int mp_prime_callback(unsigned char *dst, int len, void *dat);
+typedef mp_prime_callback ltm_prime_callback MP_DEPRECATED(mp_prime_callback);
+
 /* error code to char* string */
 const char *mp_error_to_string(int code);
 
@@ -590,7 +591,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style);
  * so it can be NULL
  *
  */
-int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat);
+int mp_prime_random_ex(mp_int *a, int t, int size, int flags, mp_prime_callback cb, void *dat);
 
 
 /* Integer logarithm to integer base */