Merge pull request #270 from libtom/macro-fixes Macro fixes
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
diff --git a/.gitignore b/.gitignore
index 72a9e9b..da37fbf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,3 +86,5 @@ test_*.txt
*.asc
*.tar.xz
*.zip
+
+doc/pics/*.ps
diff --git a/bn_deprecated.c b/bn_deprecated.c
index 1306507..eb1a6e1 100644
--- a/bn_deprecated.c
+++ b/bn_deprecated.c
@@ -2,14 +2,8 @@
#ifdef BN_DEPRECATED_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
-/* LibTomMath, multiple-precision integer library -- Tom St Denis */
-/* SPDX-License-Identifier: Unlicense */
-#include <tommath_private.h>
#ifdef BN_MP_GET_BIT_C
-/* Checks the bit at position b and returns MP_YES
- if the bit is 1, MP_NO if it is 0 and MP_VAL
- in case of error */
int mp_get_bit(const mp_int *a, int b)
{
if (b < 0) {
@@ -18,7 +12,7 @@ int mp_get_bit(const mp_int *a, int b)
return s_mp_get_bit(a, (unsigned int)b) == MP_YES ? MP_YES : MP_NO;
}
#endif
-#ifdef BN_MP_JACOBI_C
+#ifdef BN_S_MP_JACOBI_C
mp_err s_mp_jacobi(const mp_int *a, const mp_int *n, int *c)
{
if (a->sign == MP_NEG) {
@@ -29,6 +23,8 @@ mp_err s_mp_jacobi(const mp_int *a, const mp_int *n, int *c)
}
return mp_kronecker(a, n, c);
}
+#endif
+#ifdef BN_MP_JACOBI_C
mp_err mp_jacobi(const mp_int *a, const mp_int *n, int *c)
{
return s_mp_jacobi(a, n, c);
@@ -120,7 +116,7 @@ mp_err mp_toom_sqr(const mp_int *a, mp_int *b)
return s_mp_toom_sqr(a, b);
}
#endif
-#ifdef BN_REVERSE_C
+#ifdef S_MP_REVERSE_C
void bn_reverse(unsigned char *s, int len)
{
s_mp_reverse(s, len);
diff --git a/tommath_private.h b/tommath_private.h
index 2c07683..d1a8b63 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -6,10 +6,6 @@
#include "tommath.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
/* Hardening libtommath
* --------------------
*
@@ -222,8 +218,4 @@ MP_DEPRECATED(s_mp_toom_mul) mp_err mp_toom_mul(const mp_int *a, const mp_int *b
MP_DEPRECATED(s_mp_toom_sqr) mp_err mp_toom_sqr(const mp_int *a, mp_int *b);
MP_DEPRECATED(s_mp_reverse) void bn_reverse(unsigned char *s, int len);
-#ifdef __cplusplus
-}
-#endif
-
#endif