diff options
Diffstat (limited to 'libtommath')
-rw-r--r-- | libtommath/bn_mp_cmp.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_cmp_d.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_cmp_mag.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_cnt_lsb.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_copy.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_count_bits.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_div_2d.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_mod_2d.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_mul_2d.c | 2 | ||||
-rw-r--r-- | libtommath/bn_mp_neg.c | 2 | ||||
-rw-r--r-- | libtommath/mtest/mpi.c | 2 | ||||
-rw-r--r-- | libtommath/tommath.h | 74 |
12 files changed, 48 insertions, 48 deletions
diff --git a/libtommath/bn_mp_cmp.c b/libtommath/bn_mp_cmp.c index b965d4b..943249d 100644 --- a/libtommath/bn_mp_cmp.c +++ b/libtommath/bn_mp_cmp.c @@ -17,7 +17,7 @@ /* compare two ints (signed)*/ int -mp_cmp (mp_int * a, mp_int * b) +mp_cmp (const mp_int * a, const mp_int * b) { /* compare based on sign */ if (a->sign != b->sign) { diff --git a/libtommath/bn_mp_cmp_d.c b/libtommath/bn_mp_cmp_d.c index a446bb4..ecec091 100644 --- a/libtommath/bn_mp_cmp_d.c +++ b/libtommath/bn_mp_cmp_d.c @@ -16,7 +16,7 @@ */ /* compare a digit */ -int mp_cmp_d(mp_int * a, mp_digit b) +int mp_cmp_d(const mp_int * a, mp_digit b) { /* compare based on sign */ if (a->sign == MP_NEG) { diff --git a/libtommath/bn_mp_cmp_mag.c b/libtommath/bn_mp_cmp_mag.c index 3506d2b..b23a191 100644 --- a/libtommath/bn_mp_cmp_mag.c +++ b/libtommath/bn_mp_cmp_mag.c @@ -16,7 +16,7 @@ */ /* compare maginitude of two ints (unsigned) */ -int mp_cmp_mag (mp_int * a, mp_int * b) +int mp_cmp_mag (const mp_int * a, const mp_int * b) { int n; mp_digit *tmpa, *tmpb; diff --git a/libtommath/bn_mp_cnt_lsb.c b/libtommath/bn_mp_cnt_lsb.c index 6447a1f..f205e8c 100644 --- a/libtommath/bn_mp_cnt_lsb.c +++ b/libtommath/bn_mp_cnt_lsb.c @@ -20,7 +20,7 @@ static const int lnz[16] = { }; /* Counts the number of lsbs which are zero before the first zero bit */ -int mp_cnt_lsb(mp_int *a) +int mp_cnt_lsb(const mp_int *a) { int x; mp_digit q, qq; diff --git a/libtommath/bn_mp_copy.c b/libtommath/bn_mp_copy.c index 0de7565..ffbc0d4 100644 --- a/libtommath/bn_mp_copy.c +++ b/libtommath/bn_mp_copy.c @@ -17,7 +17,7 @@ /* copy, b = a */ int -mp_copy (mp_int * a, mp_int * b) +mp_copy (const mp_int * a, mp_int * b) { int res, n; diff --git a/libtommath/bn_mp_count_bits.c b/libtommath/bn_mp_count_bits.c index 6c2d7ac..00d364e 100644 --- a/libtommath/bn_mp_count_bits.c +++ b/libtommath/bn_mp_count_bits.c @@ -17,7 +17,7 @@ /* returns the number of bits in an int */ int -mp_count_bits (mp_int * a) +mp_count_bits (const mp_int * a) { int r; mp_digit q; diff --git a/libtommath/bn_mp_div_2d.c b/libtommath/bn_mp_div_2d.c index 2f8d812..d7b7e05 100644 --- a/libtommath/bn_mp_div_2d.c +++ b/libtommath/bn_mp_div_2d.c @@ -16,7 +16,7 @@ */ /* shift right by a certain bit count (store quotient in c, optional remainder in d) */ -int mp_div_2d (mp_int * a, int b, mp_int * c, mp_int * d) +int mp_div_2d (const mp_int * a, int b, mp_int * c, mp_int * d) { mp_digit D, r, rr; int x, res; diff --git a/libtommath/bn_mp_mod_2d.c b/libtommath/bn_mp_mod_2d.c index 25868cd..0170f65 100644 --- a/libtommath/bn_mp_mod_2d.c +++ b/libtommath/bn_mp_mod_2d.c @@ -17,7 +17,7 @@ /* calc a value mod 2**b */ int -mp_mod_2d (mp_int * a, int b, mp_int * c) +mp_mod_2d (const mp_int * a, int b, mp_int * c) { int x, res; diff --git a/libtommath/bn_mp_mul_2d.c b/libtommath/bn_mp_mul_2d.c index cabff13..4ac2e4e 100644 --- a/libtommath/bn_mp_mul_2d.c +++ b/libtommath/bn_mp_mul_2d.c @@ -16,7 +16,7 @@ */ /* shift left by a certain bit count */ -int mp_mul_2d (mp_int * a, int b, mp_int * c) +int mp_mul_2d (const mp_int * a, int b, mp_int * c) { mp_digit d; int res; diff --git a/libtommath/bn_mp_neg.c b/libtommath/bn_mp_neg.c index 777b59b..07fb148 100644 --- a/libtommath/bn_mp_neg.c +++ b/libtommath/bn_mp_neg.c @@ -16,7 +16,7 @@ */ /* b = -a */ -int mp_neg (mp_int * a, mp_int * b) +int mp_neg (const mp_int * a, mp_int * b) { int res; if (a != b) { diff --git a/libtommath/mtest/mpi.c b/libtommath/mtest/mpi.c index 5114bef..4566e89 100644 --- a/libtommath/mtest/mpi.c +++ b/libtommath/mtest/mpi.c @@ -89,7 +89,7 @@ static unsigned int s_mp_defprec = MP_DEFPREC; /* {{{ Constant strings */ /* Constant strings returned by mp_strerror() */ -static const char *mp_err_string[] = { +static const char *const mp_err_string[] = { "unknown result code", /* say what? */ "boolean true", /* MP_OKAY, MP_YES */ "boolean false", /* MP_NO */ diff --git a/libtommath/tommath.h b/libtommath/tommath.h index b706576..4b3a76f 100644 --- a/libtommath/tommath.h +++ b/libtommath/tommath.h @@ -24,11 +24,11 @@ #include <tommath_class.h> #ifndef MIN - #define MIN(x,y) ((x)<(y)?(x):(y)) +# define MIN(x,y) ((x)<(y)?(x):(y)) #endif #ifndef MAX - #define MAX(x,y) ((x)>(y)?(x):(y)) +# define MAX(x,y) ((x)>(y)?(x):(y)) #endif #ifdef __cplusplus @@ -47,9 +47,9 @@ extern "C" { /* detect 64-bit mode if possible */ #if defined(__x86_64__) - #if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) - #define MP_64BIT - #endif +# if !(defined(MP_64BIT) && defined(MP_16BIT) && defined(MP_8BIT)) +# define MP_64BIT +# endif #endif /* some default configurations. @@ -76,19 +76,19 @@ extern "C" { typedef unsigned long mp_digit; typedef unsigned long mp_word __attribute__ ((mode(TI))); - #define DIGIT_BIT 60 +# define DIGIT_BIT 60 #else /* this is the default case, 28-bit digits */ /* this is to make porting into LibTomCrypt easier :-) */ #ifndef CRYPT - #if defined(_MSC_VER) || defined(__BORLANDC__) +# if defined(_MSC_VER) || defined(__BORLANDC__) typedef unsigned __int64 ulong64; typedef signed __int64 long64; - #else +# else typedef unsigned long long ulong64; typedef signed long long long64; - #endif +# endif #endif typedef unsigned long mp_digit; @@ -96,35 +96,35 @@ extern "C" { #ifdef MP_31BIT /* this is an extension that uses 31-bit digits */ - #define DIGIT_BIT 31 +# define DIGIT_BIT 31 #else /* default case is 28-bit digits, defines MP_28BIT as a handy macro to test */ - #define DIGIT_BIT 28 - #define MP_28BIT +# define DIGIT_BIT 28 +# define MP_28BIT #endif #endif /* define heap macros */ #ifndef CRYPT /* default to libc stuff */ - #ifndef XMALLOC - #define XMALLOC malloc - #define XFREE free - #define XREALLOC realloc - #define XCALLOC calloc - #else +# ifndef XMALLOC +# define XMALLOC malloc +# define XFREE free +# define XREALLOC realloc +# define XCALLOC calloc +# else /* prototypes for our heap functions */ extern void *XMALLOC(size_t n); extern void *XREALLOC(void *p, size_t n); extern void *XCALLOC(size_t n, size_t s); extern void XFREE(void *p); - #endif +# endif #endif /* otherwise the bits per digit is calculated automatically from the size of a mp_digit */ #ifndef DIGIT_BIT - #define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */ +# define DIGIT_BIT ((int)((CHAR_BIT * sizeof(mp_digit) - 1))) /* bits per digit */ #endif #define MP_DIGIT_BIT DIGIT_BIT @@ -165,11 +165,11 @@ extern int KARATSUBA_MUL_CUTOFF, /* default precision */ #ifndef MP_PREC - #ifndef MP_LOW_MEM - #define MP_PREC 32 /* default digits of precision */ - #else - #define MP_PREC 8 /* default digits of precision */ - #endif +# ifndef MP_LOW_MEM +# define MP_PREC 32 /* default digits of precision */ +# else +# define MP_PREC 8 /* default digits of precision */ +# endif #endif /* size of comba arrays, should be at least 2 * 2**(BITS_PER_WORD - BITS_PER_DIGIT*2) */ @@ -241,7 +241,7 @@ int mp_init_set (mp_int * a, mp_digit b); int mp_init_set_int (mp_int * a, unsigned long b); /* copy, b = a */ -int mp_copy(mp_int *a, mp_int *b); +int mp_copy(const mp_int *a, mp_int *b); /* inits and copies, a = b */ int mp_init_copy(mp_int *a, mp_int *b); @@ -258,19 +258,19 @@ void mp_rshd(mp_int *a, int b); int mp_lshd(mp_int *a, int b); /* c = a / 2**b */ -int mp_div_2d(mp_int *a, int b, mp_int *c, mp_int *d); +int mp_div_2d(const mp_int *a, int b, mp_int *c, mp_int *d); /* b = a/2 */ int mp_div_2(mp_int *a, mp_int *b); /* c = a * 2**b */ -int mp_mul_2d(mp_int *a, int b, mp_int *c); +int mp_mul_2d(const mp_int *a, int b, mp_int *c); /* b = a*2 */ int mp_mul_2(mp_int *a, mp_int *b); /* c = a mod 2**d */ -int mp_mod_2d(mp_int *a, int b, mp_int *c); +int mp_mod_2d(const mp_int *a, int b, mp_int *c); /* computes a = 2**b */ int mp_2expt(mp_int *a, int b); @@ -296,16 +296,16 @@ int mp_and(mp_int *a, mp_int *b, mp_int *c); /* ---> Basic arithmetic <--- */ /* b = -a */ -int mp_neg(mp_int *a, mp_int *b); +int mp_neg(const mp_int *a, mp_int *b); /* b = |a| */ int mp_abs(mp_int *a, mp_int *b); /* compare a to b */ -int mp_cmp(mp_int *a, mp_int *b); +int mp_cmp(const mp_int *a, const mp_int *b); /* compare |a| to |b| */ -int mp_cmp_mag(mp_int *a, mp_int *b); +int mp_cmp_mag(const mp_int *a, const mp_int *b); /* c = a + b */ int mp_add(mp_int *a, mp_int *b, mp_int *c); @@ -328,7 +328,7 @@ int mp_mod(mp_int *a, mp_int *b, mp_int *c); /* ---> single digit functions <--- */ /* compare against a single digit */ -int mp_cmp_d(mp_int *a, mp_digit b); +int mp_cmp_d(const mp_int *a, mp_digit b); /* c = a + b */ int mp_add_d(mp_int *a, mp_digit b, mp_int *c); @@ -447,9 +447,9 @@ int mp_exptmod(mp_int *a, mp_int *b, mp_int *c, mp_int *d); /* number of primes */ #ifdef MP_8BIT - #define PRIME_SIZE 31 +# define PRIME_SIZE 31 #else - #define PRIME_SIZE 256 +# define PRIME_SIZE 256 #endif /* table of first PRIME_SIZE primes */ @@ -517,7 +517,7 @@ int mp_prime_next_prime(mp_int *a, int t, int bbs_style); int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat); /* ---> radix conversion <--- */ -int mp_count_bits(mp_int *a); +int mp_count_bits(const mp_int *a); int mp_unsigned_bin_size(mp_int *a); int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c); @@ -573,7 +573,7 @@ void bn_reverse(unsigned char *s, int len); extern const char *mp_s_rmap; #ifdef __cplusplus - } +} #endif #endif |