return type of function on the same line

This commit is contained in:
Francois Perrad 2015-11-29 14:58:46 +01:00
parent cdbb9ca925
commit ef6c71f1d2
31 changed files with 31 additions and 62 deletions

View File

@ -20,8 +20,7 @@
* Simple algorithm which zeroes the int, grows it then just sets one bit * Simple algorithm which zeroes the int, grows it then just sets one bit
* as required. * as required.
*/ */
int int mp_2expt (mp_int * a, int b)
mp_2expt (mp_int * a, int b)
{ {
int res; int res;

View File

@ -19,8 +19,7 @@
* *
* Simple function copies the input and fixes the sign to positive * Simple function copies the input and fixes the sign to positive
*/ */
int int mp_abs (mp_int * a, mp_int * b)
mp_abs (mp_int * a, mp_int * b)
{ {
int res; int res;

View File

@ -16,8 +16,7 @@
*/ */
/* single digit addition */ /* single digit addition */
int int mp_add_d (mp_int * a, mp_digit b, mp_int * c)
mp_add_d (mp_int * a, mp_digit b, mp_int * c)
{ {
int res, ix, oldused; int res, ix, oldused;
mp_digit *tmpa, *tmpc, mu; mp_digit *tmpa, *tmpc, mu;

View File

@ -16,8 +16,7 @@
*/ */
/* d = a + b (mod c) */ /* d = a + b (mod c) */
int int mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
{ {
int res; int res;
mp_int t; mp_int t;

View File

@ -16,8 +16,7 @@
*/ */
/* AND two ints together */ /* AND two ints together */
int int mp_and (mp_int * a, mp_int * b, mp_int * c)
mp_and (mp_int * a, mp_int * b, mp_int * c)
{ {
int res, ix, px; int res, ix, px;
mp_int t, *x; mp_int t, *x;

View File

@ -22,8 +22,7 @@
* Typically very fast. Also fixes the sign if there * Typically very fast. Also fixes the sign if there
* are no more leading digits * are no more leading digits
*/ */
void void mp_clamp (mp_int * a)
mp_clamp (mp_int * a)
{ {
/* decrease used while the most significant digit is /* decrease used while the most significant digit is
* zero. * zero.

View File

@ -16,8 +16,7 @@
*/ */
/* clear one (frees) */ /* clear one (frees) */
void void mp_clear (mp_int * a)
mp_clear (mp_int * a)
{ {
int i; int i;

View File

@ -16,8 +16,7 @@
*/ */
/* compare two ints (signed)*/ /* compare two ints (signed)*/
int int mp_cmp (mp_int * a, mp_int * b)
mp_cmp (mp_int * a, mp_int * b)
{ {
/* compare based on sign */ /* compare based on sign */
if (a->sign != b->sign) { if (a->sign != b->sign) {

View File

@ -16,8 +16,7 @@
*/ */
/* copy, b = a */ /* copy, b = a */
int int mp_copy (mp_int * a, mp_int * b)
mp_copy (mp_int * a, mp_int * b)
{ {
int res, n; int res, n;

View File

@ -16,8 +16,7 @@
*/ */
/* returns the number of bits in an int */ /* returns the number of bits in an int */
int int mp_count_bits (mp_int * a)
mp_count_bits (mp_int * a)
{ {
int r; int r;
mp_digit q; mp_digit q;

View File

@ -16,8 +16,7 @@
*/ */
/* divide by three (based on routine from MPI and the GMP manual) */ /* divide by three (based on routine from MPI and the GMP manual) */
int int mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
{ {
mp_int q; mp_int q;
mp_word w, t; mp_word w, t;

View File

@ -29,8 +29,7 @@
* *
* Input x must be in the range 0 <= x <= (n-1)**2 * Input x must be in the range 0 <= x <= (n-1)**2
*/ */
int int mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k)
mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k)
{ {
int err, i, m; int err, i, m;
mp_word r; mp_word r;

View File

@ -18,8 +18,7 @@
/* swap the elements of two integers, for cases where you can't simply swap the /* swap the elements of two integers, for cases where you can't simply swap the
* mp_int pointers around * mp_int pointers around
*/ */
void void mp_exch (mp_int * a, mp_int * b)
mp_exch (mp_int * a, mp_int * b)
{ {
mp_int t; mp_int t;

View File

@ -16,8 +16,7 @@
*/ */
/* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */ /* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */
int int mp_mod (mp_int * a, mp_int * b, mp_int * c)
mp_mod (mp_int * a, mp_int * b, mp_int * c)
{ {
mp_int t; mp_int t;
int res; int res;

View File

@ -16,8 +16,7 @@
*/ */
/* calc a value mod 2**b */ /* calc a value mod 2**b */
int int mp_mod_2d (mp_int * a, int b, mp_int * c)
mp_mod_2d (mp_int * a, int b, mp_int * c)
{ {
int x, res; int x, res;

View File

@ -15,8 +15,7 @@
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org * Tom St Denis, tstdenis82@gmail.com, http://libtom.org
*/ */
int int mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
{ {
return mp_div_d(a, b, NULL, c); return mp_div_d(a, b, NULL, c);
} }

View File

@ -16,8 +16,7 @@
*/ */
/* computes xR**-1 == x (mod N) via Montgomery Reduction */ /* computes xR**-1 == x (mod N) via Montgomery Reduction */
int int mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
{ {
int ix, res, digs; int ix, res, digs;
mp_digit mu; mp_digit mu;

View File

@ -16,8 +16,7 @@
*/ */
/* setups the montgomery reduction stuff */ /* setups the montgomery reduction stuff */
int int mp_montgomery_setup (mp_int * n, mp_digit * rho)
mp_montgomery_setup (mp_int * n, mp_digit * rho)
{ {
mp_digit x, b; mp_digit x, b;

View File

@ -16,8 +16,7 @@
*/ */
/* multiply by a digit */ /* multiply by a digit */
int int mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
{ {
mp_digit u, *tmpa, *tmpc; mp_digit u, *tmpa, *tmpc;
mp_word r; mp_word r;

View File

@ -41,8 +41,7 @@ static mp_digit s_gen_random(void)
return d; return d;
} }
int int mp_rand (mp_int * a, int digits)
mp_rand (mp_int * a, int digits)
{ {
int res; int res;
mp_digit d; mp_digit d;

View File

@ -16,8 +16,7 @@
*/ */
/* computes b = a*a */ /* computes b = a*a */
int int mp_sqr (mp_int * a, mp_int * b)
mp_sqr (mp_int * a, mp_int * b)
{ {
int res; int res;

View File

@ -16,8 +16,7 @@
*/ */
/* c = a * a (mod b) */ /* c = a * a (mod b) */
int int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
{ {
int res; int res;
mp_int t; mp_int t;

View File

@ -16,8 +16,7 @@
*/ */
/* high level subtraction (handles signs) */ /* high level subtraction (handles signs) */
int int mp_sub (mp_int * a, mp_int * b, mp_int * c)
mp_sub (mp_int * a, mp_int * b, mp_int * c)
{ {
int sa, sb, res; int sa, sb, res;

View File

@ -16,8 +16,7 @@
*/ */
/* single digit subtraction */ /* single digit subtraction */
int int mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
{ {
mp_digit *tmpa, *tmpc, mu; mp_digit *tmpa, *tmpc, mu;
int res, ix, oldused; int res, ix, oldused;

View File

@ -16,8 +16,7 @@
*/ */
/* d = a - b (mod c) */ /* d = a - b (mod c) */
int int mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
{ {
int res; int res;
mp_int t; mp_int t;

View File

@ -16,8 +16,7 @@
*/ */
/* squaring using Toom-Cook 3-way algorithm */ /* squaring using Toom-Cook 3-way algorithm */
int int mp_toom_sqr(mp_int *a, mp_int *b)
mp_toom_sqr(mp_int *a, mp_int *b)
{ {
mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2; mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2;
int res, B; int res, B;

View File

@ -16,8 +16,7 @@
*/ */
/* XOR two ints together */ /* XOR two ints together */
int int mp_xor (mp_int * a, mp_int * b, mp_int * c)
mp_xor (mp_int * a, mp_int * b, mp_int * c)
{ {
int res, ix, px; int res, ix, px;
mp_int t, *x; mp_int t, *x;

View File

@ -16,8 +16,7 @@
*/ */
/* reverse an array, used for radix code */ /* reverse an array, used for radix code */
void void bn_reverse (unsigned char *s, int len)
bn_reverse (unsigned char *s, int len)
{ {
int ix, iy; int ix, iy;
unsigned char t; unsigned char t;

View File

@ -16,8 +16,7 @@
*/ */
/* low level addition, based on HAC pp.594, Algorithm 14.7 */ /* low level addition, based on HAC pp.594, Algorithm 14.7 */
int int s_mp_add (mp_int * a, mp_int * b, mp_int * c)
s_mp_add (mp_int * a, mp_int * b, mp_int * c)
{ {
mp_int *x; mp_int *x;
int olduse, res, min, max; int olduse, res, min, max;

View File

@ -18,8 +18,7 @@
/* multiplies |a| * |b| and does not compute the lower digs digits /* multiplies |a| * |b| and does not compute the lower digs digits
* [meant to get the higher part of the product] * [meant to get the higher part of the product]
*/ */
int int s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
{ {
mp_int t; mp_int t;
int res, pa, pb, ix, iy; int res, pa, pb, ix, iy;

View File

@ -16,8 +16,7 @@
*/ */
/* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */ /* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */
int int s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
{ {
int olduse, res, min, max; int olduse, res, min, max;