Browse Source

trim trailing spaces

Steffen Jaeckel 11 years ago
parent
commit
5d2fe0da8c
3 changed files with 34 additions and 34 deletions
  1. 7 7
      src/math/gmp_desc.c
  2. 10 10
      src/math/ltm_desc.c
  3. 17 17
      src/math/tfm_desc.c

+ 7 - 7
src/math/gmp_desc.c

@@ -18,7 +18,7 @@
 #include <gmp.h>
 #include <gmp.h>
 
 
 static int init(void **a)
 static int init(void **a)
-{ 
+{
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
 
 
    *a = XCALLOC(1, sizeof(__mpz_struct));
    *a = XCALLOC(1, sizeof(__mpz_struct));
@@ -85,7 +85,7 @@ static int get_digit_count(void *a)
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
    return mpz_size(a);
    return mpz_size(a);
 }
 }
-   
+
 static int compare(void *a, void *b)
 static int compare(void *a, void *b)
 {
 {
    int ret;
    int ret;
@@ -234,7 +234,7 @@ static int add(void *a, void *b, void *c)
    mpz_add(c, a, b);
    mpz_add(c, a, b);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
-  
+
 static int addi(void *a, unsigned long b, void *c)
 static int addi(void *a, unsigned long b, void *c)
 {
 {
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
@@ -321,10 +321,10 @@ static int modi(void *a, unsigned long b, unsigned long *c)
 {
 {
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(c != NULL);
    LTC_ARGCHK(c != NULL);
-   
+
    *c = mpz_fdiv_ui(a, b);
    *c = mpz_fdiv_ui(a, b);
    return CRYPT_OK;
    return CRYPT_OK;
-}  
+}
 
 
 /* gcd */
 /* gcd */
 static int gcd(void *a, void *b, void *c)
 static int gcd(void *a, void *b, void *c)
@@ -440,7 +440,7 @@ static int exptmod(void *a, void *b, void *c, void *d)
    LTC_ARGCHK(d != NULL);
    LTC_ARGCHK(d != NULL);
    mpz_powm(d, a, b, c);
    mpz_powm(d, a, b, c);
    return CRYPT_OK;
    return CRYPT_OK;
-}   
+}
 
 
 static int isprime(void *a, int *b)
 static int isprime(void *a, int *b)
 {
 {
@@ -539,7 +539,7 @@ const ltc_math_descriptor gmp_desc = {
 #endif
 #endif
    &addmod,
    &addmod,
    &submod,
    &submod,
-   
+
    &set_rand,
    &set_rand,
 
 
 };
 };

+ 10 - 10
src/math/ltm_desc.c

@@ -25,7 +25,7 @@ static const struct {
 };
 };
 
 
 /**
 /**
-   Convert a MPI error to a LTC error (Possibly the most powerful function ever!  Oh wait... no) 
+   Convert a MPI error to a LTC error (Possibly the most powerful function ever!  Oh wait... no)
    @param err    The error to convert
    @param err    The error to convert
    @return The equivalent LTC error code or CRYPT_ERROR if none found
    @return The equivalent LTC error code or CRYPT_ERROR if none found
 */
 */
@@ -34,7 +34,7 @@ static int mpi_to_ltc_error(int err)
    int x;
    int x;
 
 
    for (x = 0; x < (int)(sizeof(mpi_to_ltc_codes)/sizeof(mpi_to_ltc_codes[0])); x++) {
    for (x = 0; x < (int)(sizeof(mpi_to_ltc_codes)/sizeof(mpi_to_ltc_codes[0])); x++) {
-       if (err == mpi_to_ltc_codes[x].mpi_code) { 
+       if (err == mpi_to_ltc_codes[x].mpi_code) {
           return mpi_to_ltc_codes[x].ltc_code;
           return mpi_to_ltc_codes[x].ltc_code;
        }
        }
    }
    }
@@ -51,7 +51,7 @@ static int init(void **a)
    if (*a == NULL) {
    if (*a == NULL) {
       return CRYPT_MEM;
       return CRYPT_MEM;
    }
    }
-   
+
    if ((err = mpi_to_ltc_error(mp_init(*a))) != CRYPT_OK) {
    if ((err = mpi_to_ltc_error(mp_init(*a))) != CRYPT_OK) {
       XFREE(*a);
       XFREE(*a);
    }
    }
@@ -115,7 +115,7 @@ static int get_digit_count(void *a)
    A = a;
    A = a;
    return A->used;
    return A->used;
 }
 }
-   
+
 static int compare(void *a, void *b)
 static int compare(void *a, void *b)
 {
 {
    int ret;
    int ret;
@@ -211,7 +211,7 @@ static int add(void *a, void *b, void *c)
    LTC_ARGCHK(c != NULL);
    LTC_ARGCHK(c != NULL);
    return mpi_to_ltc_error(mp_add(a, b, c));
    return mpi_to_ltc_error(mp_add(a, b, c));
 }
 }
-  
+
 static int addi(void *a, unsigned long b, void *c)
 static int addi(void *a, unsigned long b, void *c)
 {
 {
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
@@ -288,7 +288,7 @@ static int modi(void *a, unsigned long b, unsigned long *c)
    }
    }
    *c = tmp;
    *c = tmp;
    return CRYPT_OK;
    return CRYPT_OK;
-}  
+}
 
 
 /* gcd */
 /* gcd */
 static int gcd(void *a, void *b, void *c)
 static int gcd(void *a, void *b, void *c)
@@ -398,7 +398,7 @@ static int exptmod(void *a, void *b, void *c, void *d)
    LTC_ARGCHK(c != NULL);
    LTC_ARGCHK(c != NULL);
    LTC_ARGCHK(d != NULL);
    LTC_ARGCHK(d != NULL);
    return mpi_to_ltc_error(mp_exptmod(a,b,c,d));
    return mpi_to_ltc_error(mp_exptmod(a,b,c,d));
-}   
+}
 
 
 static int isprime(void *a, int *b)
 static int isprime(void *a, int *b)
 {
 {
@@ -460,7 +460,7 @@ const ltc_math_descriptor ltm_desc = {
    &mulmod,
    &mulmod,
    &sqrmod,
    &sqrmod,
    &invmod,
    &invmod,
-   
+
    &montgomery_setup,
    &montgomery_setup,
    &montgomery_normalization,
    &montgomery_normalization,
    &montgomery_reduce,
    &montgomery_reduce,
@@ -472,7 +472,7 @@ const ltc_math_descriptor ltm_desc = {
 #ifdef LTC_MECC
 #ifdef LTC_MECC
 #ifdef LTC_MECC_FP
 #ifdef LTC_MECC_FP
    &ltc_ecc_fp_mulmod,
    &ltc_ecc_fp_mulmod,
-#else   
+#else
    &ltc_ecc_mulmod,
    &ltc_ecc_mulmod,
 #endif
 #endif
    &ltc_ecc_projective_add_point,
    &ltc_ecc_projective_add_point,
@@ -499,7 +499,7 @@ const ltc_math_descriptor ltm_desc = {
 #endif
 #endif
    &addmod,
    &addmod,
    &submod,
    &submod,
-   
+
    &set_rand,
    &set_rand,
 
 
 };
 };

+ 17 - 17
src/math/tfm_desc.c

@@ -25,7 +25,7 @@ static const struct {
 };
 };
 
 
 /**
 /**
-   Convert a tfm error to a LTC error (Possibly the most powerful function ever!  Oh wait... no) 
+   Convert a tfm error to a LTC error (Possibly the most powerful function ever!  Oh wait... no)
    @param err    The error to convert
    @param err    The error to convert
    @return The equivalent LTC error code or CRYPT_ERROR if none found
    @return The equivalent LTC error code or CRYPT_ERROR if none found
 */
 */
@@ -34,7 +34,7 @@ static int tfm_to_ltc_error(int err)
    int x;
    int x;
 
 
    for (x = 0; x < (int)(sizeof(tfm_to_ltc_codes)/sizeof(tfm_to_ltc_codes[0])); x++) {
    for (x = 0; x < (int)(sizeof(tfm_to_ltc_codes)/sizeof(tfm_to_ltc_codes[0])); x++) {
-       if (err == tfm_to_ltc_codes[x].tfm_code) { 
+       if (err == tfm_to_ltc_codes[x].tfm_code) {
           return tfm_to_ltc_codes[x].ltc_code;
           return tfm_to_ltc_codes[x].ltc_code;
        }
        }
    }
    }
@@ -114,7 +114,7 @@ static int get_digit_count(void *a)
    A = a;
    A = a;
    return A->used;
    return A->used;
 }
 }
-   
+
 static int compare(void *a, void *b)
 static int compare(void *a, void *b)
 {
 {
    int ret;
    int ret;
@@ -213,7 +213,7 @@ static int add(void *a, void *b, void *c)
    fp_add(a, b, c);
    fp_add(a, b, c);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
-  
+
 static int addi(void *a, unsigned long b, void *c)
 static int addi(void *a, unsigned long b, void *c)
 {
 {
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
@@ -246,7 +246,7 @@ static int mul(void *a, void *b, void *c)
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(b != NULL);
    LTC_ARGCHK(b != NULL);
    LTC_ARGCHK(c != NULL);
    LTC_ARGCHK(c != NULL);
-   fp_mul(a, b, c); 
+   fp_mul(a, b, c);
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -297,7 +297,7 @@ static int modi(void *a, unsigned long b, unsigned long *c)
    }
    }
    *c = tmp;
    *c = tmp;
    return CRYPT_OK;
    return CRYPT_OK;
-}  
+}
 
 
 /* gcd */
 /* gcd */
 static int gcd(void *a, void *b, void *c)
 static int gcd(void *a, void *b, void *c)
@@ -411,7 +411,7 @@ static int exptmod(void *a, void *b, void *c, void *d)
    LTC_ARGCHK(c != NULL);
    LTC_ARGCHK(c != NULL);
    LTC_ARGCHK(d != NULL);
    LTC_ARGCHK(d != NULL);
    return tfm_to_ltc_error(fp_exptmod(a,b,c,d));
    return tfm_to_ltc_error(fp_exptmod(a,b,c,d));
-}   
+}
 
 
 static int isprime(void *a, int *b)
 static int isprime(void *a, int *b)
 {
 {
@@ -455,7 +455,7 @@ static int tfm_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulu
    if (fp_cmp(R->z, modulus) != FP_LT) {
    if (fp_cmp(R->z, modulus) != FP_LT) {
       fp_sub(R->z, modulus, R->z);
       fp_sub(R->z, modulus, R->z);
    }
    }
-   
+
    /* &t2 = X - T1 */
    /* &t2 = X - T1 */
    fp_sub(R->x, &t1, &t2);
    fp_sub(R->x, &t1, &t2);
    if (fp_cmp_d(&t2, 0) == FP_LT) {
    if (fp_cmp_d(&t2, 0) == FP_LT) {
@@ -514,7 +514,7 @@ static int tfm_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulu
       fp_add(R->x, modulus, R->x);
       fp_add(R->x, modulus, R->x);
    }
    }
 
 
-   /* Y = Y - X */     
+   /* Y = Y - X */
    fp_sub(R->y, R->x, R->y);
    fp_sub(R->y, R->x, R->y);
    if (fp_cmp_d(R->y, 0) == FP_LT) {
    if (fp_cmp_d(R->y, 0) == FP_LT) {
       fp_add(R->y, modulus, R->y);
       fp_add(R->y, modulus, R->y);
@@ -527,7 +527,7 @@ static int tfm_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulu
    if (fp_cmp_d(R->y, 0) == FP_LT) {
    if (fp_cmp_d(R->y, 0) == FP_LT) {
       fp_add(R->y, modulus, R->y);
       fp_add(R->y, modulus, R->y);
    }
    }
- 
+
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -543,8 +543,8 @@ static int tfm_ecc_projective_dbl_point(ecc_point *P, ecc_point *R, void *modulu
 static int tfm_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R, void *modulus, void *Mp)
 static int tfm_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R, void *modulus, void *Mp)
 {
 {
    fp_int  t1, t2, x, y, z;
    fp_int  t1, t2, x, y, z;
-   fp_digit mp;  
-   
+   fp_digit mp;
+
    LTC_ARGCHK(P       != NULL);
    LTC_ARGCHK(P       != NULL);
    LTC_ARGCHK(Q       != NULL);
    LTC_ARGCHK(Q       != NULL);
    LTC_ARGCHK(R       != NULL);
    LTC_ARGCHK(R       != NULL);
@@ -561,7 +561,7 @@ static int tfm_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R
 
 
    /* should we dbl instead? */
    /* should we dbl instead? */
    fp_sub(modulus, Q->y, &t1);
    fp_sub(modulus, Q->y, &t1);
-   if ( (fp_cmp(P->x, Q->x) == FP_EQ) && 
+   if ( (fp_cmp(P->x, Q->x) == FP_EQ) &&
         (Q->z != NULL && fp_cmp(P->z, Q->z) == FP_EQ) &&
         (Q->z != NULL && fp_cmp(P->z, Q->z) == FP_EQ) &&
         (fp_cmp(P->y, Q->y) == FP_EQ || fp_cmp(P->y, &t1) == FP_EQ)) {
         (fp_cmp(P->y, Q->y) == FP_EQ || fp_cmp(P->y, &t1) == FP_EQ)) {
         return tfm_ecc_projective_dbl_point(P, R, modulus, Mp);
         return tfm_ecc_projective_dbl_point(P, R, modulus, Mp);
@@ -654,7 +654,7 @@ static int tfm_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R
    /* T1 = T1 * X  */
    /* T1 = T1 * X  */
    fp_mul(&t1, &x, &t1);
    fp_mul(&t1, &x, &t1);
    fp_montgomery_reduce(&t1, modulus, mp);
    fp_montgomery_reduce(&t1, modulus, mp);
- 
+
    /* X = Y*Y */
    /* X = Y*Y */
    fp_sqr(&y, &x);
    fp_sqr(&y, &x);
    fp_montgomery_reduce(&x, modulus, mp);
    fp_montgomery_reduce(&x, modulus, mp);
@@ -668,7 +668,7 @@ static int tfm_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R
    fp_sub(&t2, &x, &t2);
    fp_sub(&t2, &x, &t2);
    if (fp_cmp_d(&t2, 0) == FP_LT) {
    if (fp_cmp_d(&t2, 0) == FP_LT) {
       fp_add(&t2, modulus, &t2);
       fp_add(&t2, modulus, &t2);
-   } 
+   }
    /* T2 = T2 - X */
    /* T2 = T2 - X */
    fp_sub(&t2, &x, &t2);
    fp_sub(&t2, &x, &t2);
    if (fp_cmp_d(&t2, 0) == FP_LT) {
    if (fp_cmp_d(&t2, 0) == FP_LT) {
@@ -691,7 +691,7 @@ static int tfm_ecc_projective_add_point(ecc_point *P, ecc_point *Q, ecc_point *R
    fp_copy(&x, R->x);
    fp_copy(&x, R->x);
    fp_copy(&y, R->y);
    fp_copy(&y, R->y);
    fp_copy(&z, R->z);
    fp_copy(&z, R->z);
-   
+
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
@@ -786,7 +786,7 @@ const ltc_math_descriptor tfm_desc = {
 #endif
 #endif
    &addmod,
    &addmod,
    &submod,
    &submod,
-   
+
    NULL,
    NULL,
 
 
 };
 };