return type of function on the same line
This commit is contained in:
parent
cdbb9ca925
commit
ef6c71f1d2
@ -20,8 +20,7 @@
|
||||
* Simple algorithm which zeroes the int, grows it then just sets one bit
|
||||
* as required.
|
||||
*/
|
||||
int
|
||||
mp_2expt (mp_int * a, int b)
|
||||
int mp_2expt (mp_int * a, int b)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
@ -19,8 +19,7 @@
|
||||
*
|
||||
* Simple function copies the input and fixes the sign to positive
|
||||
*/
|
||||
int
|
||||
mp_abs (mp_int * a, mp_int * b)
|
||||
int mp_abs (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* single digit addition */
|
||||
int
|
||||
mp_add_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
int mp_add_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
{
|
||||
int res, ix, oldused;
|
||||
mp_digit *tmpa, *tmpc, mu;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* d = a + b (mod c) */
|
||||
int
|
||||
mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
int mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
{
|
||||
int res;
|
||||
mp_int t;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* AND two ints together */
|
||||
int
|
||||
mp_and (mp_int * a, mp_int * b, mp_int * c)
|
||||
int mp_and (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int res, ix, px;
|
||||
mp_int t, *x;
|
||||
|
@ -22,8 +22,7 @@
|
||||
* Typically very fast. Also fixes the sign if there
|
||||
* are no more leading digits
|
||||
*/
|
||||
void
|
||||
mp_clamp (mp_int * a)
|
||||
void mp_clamp (mp_int * a)
|
||||
{
|
||||
/* decrease used while the most significant digit is
|
||||
* zero.
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* clear one (frees) */
|
||||
void
|
||||
mp_clear (mp_int * a)
|
||||
void mp_clear (mp_int * a)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* compare two ints (signed)*/
|
||||
int
|
||||
mp_cmp (mp_int * a, mp_int * b)
|
||||
int mp_cmp (mp_int * a, mp_int * b)
|
||||
{
|
||||
/* compare based on sign */
|
||||
if (a->sign != b->sign) {
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* copy, b = a */
|
||||
int
|
||||
mp_copy (mp_int * a, mp_int * b)
|
||||
int mp_copy (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res, n;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* returns the number of bits in an int */
|
||||
int
|
||||
mp_count_bits (mp_int * a)
|
||||
int mp_count_bits (mp_int * a)
|
||||
{
|
||||
int r;
|
||||
mp_digit q;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* divide by three (based on routine from MPI and the GMP manual) */
|
||||
int
|
||||
mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
|
||||
int mp_div_3 (mp_int * a, mp_int *c, mp_digit * d)
|
||||
{
|
||||
mp_int q;
|
||||
mp_word w, t;
|
||||
|
@ -29,8 +29,7 @@
|
||||
*
|
||||
* Input x must be in the range 0 <= x <= (n-1)**2
|
||||
*/
|
||||
int
|
||||
mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k)
|
||||
int mp_dr_reduce (mp_int * x, mp_int * n, mp_digit k)
|
||||
{
|
||||
int err, i, m;
|
||||
mp_word r;
|
||||
|
@ -18,8 +18,7 @@
|
||||
/* swap the elements of two integers, for cases where you can't simply swap the
|
||||
* mp_int pointers around
|
||||
*/
|
||||
void
|
||||
mp_exch (mp_int * a, mp_int * b)
|
||||
void mp_exch (mp_int * a, mp_int * b)
|
||||
{
|
||||
mp_int t;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* c = a mod b, 0 <= c < b if b > 0, b < c <= 0 if b < 0 */
|
||||
int
|
||||
mp_mod (mp_int * a, mp_int * b, mp_int * c)
|
||||
int mp_mod (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
mp_int t;
|
||||
int res;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* calc a value mod 2**b */
|
||||
int
|
||||
mp_mod_2d (mp_int * a, int b, mp_int * c)
|
||||
int mp_mod_2d (mp_int * a, int b, mp_int * c)
|
||||
{
|
||||
int x, res;
|
||||
|
||||
|
@ -15,8 +15,7 @@
|
||||
* Tom St Denis, tstdenis82@gmail.com, http://libtom.org
|
||||
*/
|
||||
|
||||
int
|
||||
mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
|
||||
int mp_mod_d (mp_int * a, mp_digit b, mp_digit * c)
|
||||
{
|
||||
return mp_div_d(a, b, NULL, c);
|
||||
}
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* computes xR**-1 == x (mod N) via Montgomery Reduction */
|
||||
int
|
||||
mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
int mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
|
||||
{
|
||||
int ix, res, digs;
|
||||
mp_digit mu;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* setups the montgomery reduction stuff */
|
||||
int
|
||||
mp_montgomery_setup (mp_int * n, mp_digit * rho)
|
||||
int mp_montgomery_setup (mp_int * n, mp_digit * rho)
|
||||
{
|
||||
mp_digit x, b;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* multiply by a digit */
|
||||
int
|
||||
mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
int mp_mul_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
{
|
||||
mp_digit u, *tmpa, *tmpc;
|
||||
mp_word r;
|
||||
|
@ -41,8 +41,7 @@ static mp_digit s_gen_random(void)
|
||||
return d;
|
||||
}
|
||||
|
||||
int
|
||||
mp_rand (mp_int * a, int digits)
|
||||
int mp_rand (mp_int * a, int digits)
|
||||
{
|
||||
int res;
|
||||
mp_digit d;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* computes b = a*a */
|
||||
int
|
||||
mp_sqr (mp_int * a, mp_int * b)
|
||||
int mp_sqr (mp_int * a, mp_int * b)
|
||||
{
|
||||
int res;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* c = a * a (mod b) */
|
||||
int
|
||||
mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
int mp_sqrmod (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int res;
|
||||
mp_int t;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* high level subtraction (handles signs) */
|
||||
int
|
||||
mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
int mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int sa, sb, res;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* single digit subtraction */
|
||||
int
|
||||
mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
int mp_sub_d (mp_int * a, mp_digit b, mp_int * c)
|
||||
{
|
||||
mp_digit *tmpa, *tmpc, mu;
|
||||
int res, ix, oldused;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* d = a - b (mod c) */
|
||||
int
|
||||
mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
int mp_submod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
|
||||
{
|
||||
int res;
|
||||
mp_int t;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* squaring using Toom-Cook 3-way algorithm */
|
||||
int
|
||||
mp_toom_sqr(mp_int *a, mp_int *b)
|
||||
int mp_toom_sqr(mp_int *a, mp_int *b)
|
||||
{
|
||||
mp_int w0, w1, w2, w3, w4, tmp1, a0, a1, a2;
|
||||
int res, B;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* XOR two ints together */
|
||||
int
|
||||
mp_xor (mp_int * a, mp_int * b, mp_int * c)
|
||||
int mp_xor (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int res, ix, px;
|
||||
mp_int t, *x;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* reverse an array, used for radix code */
|
||||
void
|
||||
bn_reverse (unsigned char *s, int len)
|
||||
void bn_reverse (unsigned char *s, int len)
|
||||
{
|
||||
int ix, iy;
|
||||
unsigned char t;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* low level addition, based on HAC pp.594, Algorithm 14.7 */
|
||||
int
|
||||
s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
int s_mp_add (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
mp_int *x;
|
||||
int olduse, res, min, max;
|
||||
|
@ -18,8 +18,7 @@
|
||||
/* multiplies |a| * |b| and does not compute the lower digs digits
|
||||
* [meant to get the higher part of the product]
|
||||
*/
|
||||
int
|
||||
s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
int s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
|
||||
{
|
||||
mp_int t;
|
||||
int res, pa, pb, ix, iy;
|
||||
|
@ -16,8 +16,7 @@
|
||||
*/
|
||||
|
||||
/* low level subtraction (assumes |a| > |b|), HAC pp.595 Algorithm 14.9 */
|
||||
int
|
||||
s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
int s_mp_sub (mp_int * a, mp_int * b, mp_int * c)
|
||||
{
|
||||
int olduse, res, min, max;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user