Browse Source

Merge branch 'fix/x32' into develop

This closes #51
Steffen Jaeckel 11 years ago
parent
commit
cb2322f8de

+ 1 - 1
makefile.mingw

@@ -210,7 +210,7 @@ library: $(LIBNAME)
 
 
 .PHONY: testprof/$(LIBTEST)
 .PHONY: testprof/$(LIBTEST)
 testprof/$(LIBTEST):
 testprof/$(LIBTEST):
-	$(MAKE) -C testprof -f makefile.mingw CFLAGS_OPTS="$(CFLAGS)" LIBTEST_S=$(LIBTEST) CC=$(CC) LD=$(LD) AR=$(AR) ARFLAGS=$(ARFLAGS) RANLIB=$(RANLIB)
+	$(MAKE) -C testprof -f makefile.mingw CFLAGS_OPTS="$(CFLAGS)" LIBTEST_S=$(LIBTEST) CC="$(CC)" LD=$(LD) AR=$(AR) ARFLAGS="$(ARFLAGS)" RANLIB=$(RANLIB)
 
 
 $(LIBNAME): $(OBJECTS)
 $(LIBNAME): $(OBJECTS)
 	$(AR) $(ARFLAGS) $@ $(OBJECTS)
 	$(AR) $(ARFLAGS) $@ $(OBJECTS)

+ 1 - 1
makefile.shared

@@ -263,7 +263,7 @@ library: $(LIBNAME)
 
 
 .PHONY: testprof/$(LIBTEST)
 .PHONY: testprof/$(LIBTEST)
 testprof/$(LIBTEST):
 testprof/$(LIBTEST):
-	cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) LT=$(LT) CC=$(CC) make -f makefile.shared
+	cd testprof ; CFLAGS="$(CFLAGS)" GROUP=$(GROUP) USER=$(USER) VERSION=$(VERSION) LIBPATH=$(LIBPATH) LIBTEST=$(LIBTEST) LIBTEST_S=$(LIBTEST_S) LT=$(LT) CC="$(CC)" make -f makefile.shared
 
 
 .c.o:
 .c.o:
 	$(LTCOMPILE) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -c $<
 	$(LTCOMPILE) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -c $<

+ 1 - 1
makefile.unix

@@ -210,7 +210,7 @@ library: $(LIBNAME)
 
 
 .PHONY: testprof/$(LIBTEST)
 .PHONY: testprof/$(LIBTEST)
 testprof/$(LIBTEST):
 testprof/$(LIBTEST):
-	cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) $(MAKE)
+	cd testprof ; CFLAGS="$(CFLAGS)" LIBTEST_S=$(LIBTEST_S) CC="$(CC)" LD="$(LD)" AR="$(AR)" RANLIB="$(RANLIB)" $(MAKE)
 
 
 $(LIBNAME): $(OBJECTS)
 $(LIBNAME): $(OBJECTS)
 	$(AR) $(ARFLAGS) $@ $(OBJECTS)
 	$(AR) $(ARFLAGS) $@ $(OBJECTS)

+ 5 - 0
src/headers/tomcrypt_cfg.h

@@ -122,6 +122,11 @@ typedef ulong32 __attribute__((__may_alias__)) LTC_FAST_TYPE;
   #endif
   #endif
 #endif
 #endif
 
 
+#ifdef ENDIAN_64BITWORD
+typedef ulong64 ltc_mp_digit;
+#else
+typedef ulong32 ltc_mp_digit;
+#endif
 
 
 #ifdef LTC_NO_FAST
 #ifdef LTC_NO_FAST
    #ifdef LTC_FAST
    #ifdef LTC_FAST

+ 1 - 1
src/headers/tomcrypt_math.h

@@ -80,7 +80,7 @@ typedef struct {
      @param n  The number of the digit to fetch
      @param n  The number of the digit to fetch
      @return  The bits_per_digit  sized n'th digit of a
      @return  The bits_per_digit  sized n'th digit of a
    */
    */
-   unsigned long (*get_digit)(void *a, int n);
+   ltc_mp_digit (*get_digit)(void *a, int n);
 
 
    /** Get the number of digits that represent the number
    /** Get the number of digits that represent the number
      @param a   The number to count
      @param a   The number to count

+ 2 - 1
src/math/gmp_desc.c

@@ -74,7 +74,7 @@ static unsigned long get_int(void *a)
    return mpz_get_ui(a);
    return mpz_get_ui(a);
 }
 }
 
 
-static unsigned long get_digit(void *a, int n)
+static ltc_mp_digit get_digit(void *a, int n)
 {
 {
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);
    return mpz_getlimbn(a, n);
    return mpz_getlimbn(a, n);
@@ -430,6 +430,7 @@ static int montgomery_reduce(void *a, void *b, void *c)
 /* clean up */
 /* clean up */
 static void montgomery_deinit(void *a)
 static void montgomery_deinit(void *a)
 {
 {
+  LTC_UNUSED_PARAM(a);
 }
 }
 
 
 static int exptmod(void *a, void *b, void *c, void *d)
 static int exptmod(void *a, void *b, void *c, void *d)

+ 1 - 1
src/math/ltm_desc.c

@@ -100,7 +100,7 @@ static unsigned long get_int(void *a)
    return mp_get_int(a);
    return mp_get_int(a);
 }
 }
 
 
-static unsigned long get_digit(void *a, int n)
+static ltc_mp_digit get_digit(void *a, int n)
 {
 {
    mp_int *A;
    mp_int *A;
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);

+ 1 - 1
src/math/tfm_desc.c

@@ -99,7 +99,7 @@ static unsigned long get_int(void *a)
    return A->used > 0 ? A->dp[0] : 0;
    return A->used > 0 ? A->dp[0] : 0;
 }
 }
 
 
-static unsigned long get_digit(void *a, int n)
+static ltc_mp_digit get_digit(void *a, int n)
 {
 {
    fp_int *A;
    fp_int *A;
    LTC_ARGCHK(a != NULL);
    LTC_ARGCHK(a != NULL);

+ 0 - 1
src/misc/crypt/crypt.c

@@ -393,7 +393,6 @@ const char *crypt_build_settings =
    " LTC_ECC_SHAMIR "
    " LTC_ECC_SHAMIR "
 #endif
 #endif
     "\n"
     "\n"
-    "\n\n\n"
     ;
     ;
 
 
 
 

+ 1 - 1
src/pk/ecc/ecc_test.c

@@ -19,7 +19,7 @@
 /**
 /**
   @file ecc_test.c
   @file ecc_test.c
   ECC Crypto, Tom St Denis
   ECC Crypto, Tom St Denis
-*/  
+*/
 
 
 #ifdef LTC_MECC
 #ifdef LTC_MECC
 
 

+ 3 - 3
src/pk/ecc/ltc_ecc_mulmod.c

@@ -41,7 +41,7 @@ int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map)
    ecc_point *tG, *M[8];
    ecc_point *tG, *M[8];
    int        i, j, err;
    int        i, j, err;
    void       *mu, *mp;
    void       *mu, *mp;
-   unsigned long buf;
+   ltc_mp_digit buf;
    int        first, bitbuf, bitcpy, bitcnt, mode, digidx;
    int        first, bitbuf, bitcpy, bitcnt, mode, digidx;
 
 
    LTC_ARGCHK(k       != NULL);
    LTC_ARGCHK(k       != NULL);
@@ -62,7 +62,7 @@ int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map)
       mp_clear(mu);
       mp_clear(mu);
       return err;
       return err;
    }
    }
-  
+
   /* alloc ram for window temps */
   /* alloc ram for window temps */
   for (i = 0; i < 8; i++) {
   for (i = 0; i < 8; i++) {
       M[i] = ltc_ecc_new_point();
       M[i] = ltc_ecc_new_point();
@@ -92,7 +92,7 @@ int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map)
    }
    }
    mp_clear(mu);
    mp_clear(mu);
    mu = NULL;
    mu = NULL;
-   
+
    /* calc the M tab, which holds kG for k==8..15 */
    /* calc the M tab, which holds kG for k==8..15 */
    /* M[0] == 8G */
    /* M[0] == 8G */
    if ((err = ltc_mp.ecc_ptdbl(tG, M[0], modulus, mp)) != CRYPT_OK)                 { goto done; }
    if ((err = ltc_mp.ecc_ptdbl(tG, M[0], modulus, mp)) != CRYPT_OK)                 { goto done; }

+ 1 - 1
src/pk/ecc/ltc_ecc_mulmod_timing.c

@@ -39,7 +39,7 @@ int ltc_ecc_mulmod(void *k, ecc_point *G, ecc_point *R, void *modulus, int map)
    ecc_point *tG, *M[3];
    ecc_point *tG, *M[3];
    int        i, j, err;
    int        i, j, err;
    void       *mu, *mp;
    void       *mu, *mp;
-   unsigned long buf;
+   ltc_mp_digit buf;
    int        bitcnt, mode, digidx;
    int        bitcnt, mode, digidx;
 
 
    LTC_ARGCHK(k       != NULL);
    LTC_ARGCHK(k       != NULL);