From 378be117a334830c7ae3d9499f6b3536a83c2a25 Mon Sep 17 00:00:00 2001 From: Francois Perrad Date: Mon, 28 Aug 2017 21:40:10 +0200 Subject: [PATCH] add missing space after comma --- bn_mp_exteuclid.c | 2 +- bn_mp_get_int.c | 6 +++--- bn_mp_get_long.c | 6 +++--- bn_mp_get_long_long.c | 6 +++--- bn_mp_is_square.c | 16 ++++++++-------- bn_mp_sqrt.c | 20 ++++++++++---------- tommath.h | 6 +++--- tommath_private.h | 4 ++-- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/bn_mp_exteuclid.c b/bn_mp_exteuclid.c index 3c9612e..c238b7e 100644 --- a/bn_mp_exteuclid.c +++ b/bn_mp_exteuclid.c @@ -20,7 +20,7 @@ */ int mp_exteuclid(mp_int *a, mp_int *b, mp_int *U1, mp_int *U2, mp_int *U3) { - mp_int u1,u2,u3,v1,v2,v3,t1,t2,t3,q,tmp; + mp_int u1, u2, u3, v1, v2, v3, t1, t2, t3, q, tmp; int err; if ((err = mp_init_multi(&u1, &u2, &u3, &v1, &v2, &v3, &t1, &t2, &t3, &q, &tmp, NULL)) != MP_OKAY) { diff --git a/bn_mp_get_int.c b/bn_mp_get_int.c index 5c820f8..07da758 100644 --- a/bn_mp_get_int.c +++ b/bn_mp_get_int.c @@ -26,13 +26,13 @@ unsigned long mp_get_int(mp_int * a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } /* force result to 32-bits always so it is consistent on non 32-bit platforms */ diff --git a/bn_mp_get_long.c b/bn_mp_get_long.c index 7c3d0fe..e9ff4d4 100644 --- a/bn_mp_get_long.c +++ b/bn_mp_get_long.c @@ -26,14 +26,14 @@ unsigned long mp_get_long(mp_int * a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(unsigned long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); #if (ULONG_MAX != 0xffffffffuL) || (DIGIT_BIT < 32) while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } #endif return res; diff --git a/bn_mp_get_long_long.c b/bn_mp_get_long_long.c index 4b959e6..1e194d0 100644 --- a/bn_mp_get_long_long.c +++ b/bn_mp_get_long_long.c @@ -26,14 +26,14 @@ unsigned long long mp_get_long_long (mp_int * a) } /* get number of digits of the lsb we have to read */ - i = MIN(a->used,(int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; + i = MIN(a->used, (int)(((sizeof(unsigned long long) * CHAR_BIT) + DIGIT_BIT - 1) / DIGIT_BIT)) - 1; /* get most significant digit of result */ - res = DIGIT(a,i); + res = DIGIT(a, i); #if DIGIT_BIT < 64 while (--i >= 0) { - res = (res << DIGIT_BIT) | DIGIT(a,i); + res = (res << DIGIT_BIT) | DIGIT(a, i); } #endif return res; diff --git a/bn_mp_is_square.c b/bn_mp_is_square.c index 10f8816..8666b0b 100644 --- a/bn_mp_is_square.c +++ b/bn_mp_is_square.c @@ -38,7 +38,7 @@ static const char rem_105[105] = { }; /* Store non-zero to ret if arg is square, and zero if not */ -int mp_is_square(mp_int *arg,int *ret) +int mp_is_square(mp_int *arg, int *ret) { int res; mp_digit c; @@ -58,12 +58,12 @@ int mp_is_square(mp_int *arg,int *ret) } /* First check mod 128 (suppose that DIGIT_BIT is at least 7) */ - if (rem_128[127 & DIGIT(arg,0)] == 1) { + if (rem_128[127 & DIGIT(arg, 0)] == 1) { return MP_OKAY; } /* Next check mod 105 (3*5*7) */ - if ((res = mp_mod_d(arg,105,&c)) != MP_OKAY) { + if ((res = mp_mod_d(arg, 105, &c)) != MP_OKAY) { return res; } if (rem_105[c] == 1) { @@ -71,10 +71,10 @@ int mp_is_square(mp_int *arg,int *ret) } - if ((res = mp_init_set_int(&t,11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { + if ((res = mp_init_set_int(&t, 11L*13L*17L*19L*23L*29L*31L)) != MP_OKAY) { return res; } - if ((res = mp_mod(arg,&t,&t)) != MP_OKAY) { + if ((res = mp_mod(arg, &t, &t)) != MP_OKAY) { goto ERR; } r = mp_get_int(&t); @@ -91,14 +91,14 @@ int mp_is_square(mp_int *arg,int *ret) if (((1L<<(r%31)) & 0x6DE2B848L) != 0L) goto ERR; /* Final check - is sqr(sqrt(arg)) == arg ? */ - if ((res = mp_sqrt(arg,&t)) != MP_OKAY) { + if ((res = mp_sqrt(arg, &t)) != MP_OKAY) { goto ERR; } - if ((res = mp_sqr(&t,&t)) != MP_OKAY) { + if ((res = mp_sqr(&t, &t)) != MP_OKAY) { goto ERR; } - *ret = (mp_cmp_mag(&t,arg) == MP_EQ) ? MP_YES : MP_NO; + *ret = (mp_cmp_mag(&t, arg) == MP_EQ) ? MP_YES : MP_NO; ERR:mp_clear(&t); return res; } diff --git a/bn_mp_sqrt.c b/bn_mp_sqrt.c index 31ab214..6adb2fb 100644 --- a/bn_mp_sqrt.c +++ b/bn_mp_sqrt.c @@ -19,7 +19,7 @@ int mp_sqrt(mp_int *arg, mp_int *ret) { int res; - mp_int t1,t2; + mp_int t1, t2; /* must be positive */ if (arg->sign == MP_NEG) { @@ -41,33 +41,33 @@ int mp_sqrt(mp_int *arg, mp_int *ret) } /* First approx. (not very bad for large arg) */ - mp_rshd (&t1,t1.used/2); + mp_rshd (&t1, t1.used/2); /* t1 > 0 */ - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { + if ((res = mp_div(arg, &t1, &t2, NULL)) != MP_OKAY) { goto E1; } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { + if ((res = mp_add(&t1, &t2, &t1)) != MP_OKAY) { goto E1; } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) { goto E1; } /* And now t1 > sqrt(arg) */ do { - if ((res = mp_div(arg,&t1,&t2,NULL)) != MP_OKAY) { + if ((res = mp_div(arg, &t1, &t2, NULL)) != MP_OKAY) { goto E1; } - if ((res = mp_add(&t1,&t2,&t1)) != MP_OKAY) { + if ((res = mp_add(&t1, &t2, &t1)) != MP_OKAY) { goto E1; } - if ((res = mp_div_2(&t1,&t1)) != MP_OKAY) { + if ((res = mp_div_2(&t1, &t1)) != MP_OKAY) { goto E1; } /* t1 >= sqrt(arg) >= t2 at this point */ - } while (mp_cmp_mag(&t1,&t2) == MP_GT); + } while (mp_cmp_mag(&t1, &t2) == MP_GT); - mp_exch(&t1,ret); + mp_exch(&t1, ret); E1: mp_clear(&t2); E2: mp_clear(&t1); diff --git a/tommath.h b/tommath.h index 80bae69..ff57218 100644 --- a/tommath.h +++ b/tommath.h @@ -169,9 +169,9 @@ typedef struct { typedef int ltm_prime_callback(unsigned char *dst, int len, void *dat); -#define USED(m) ((m)->used) -#define DIGIT(m,k) ((m)->dp[(k)]) -#define SIGN(m) ((m)->sign) +#define USED(m) ((m)->used) +#define DIGIT(m, k) ((m)->dp[(k)]) +#define SIGN(m) ((m)->sign) /* error code to char* string */ const char *mp_error_to_string(int code); diff --git a/tommath_private.h b/tommath_private.h index aeda684..b4c2d89 100644 --- a/tommath_private.h +++ b/tommath_private.h @@ -19,11 +19,11 @@ #include #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