Skip to content

Commit

Permalink
trim trailing spaces/clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaeckel committed Jun 12, 2014
1 parent bea9b1c commit 86e7c59
Show file tree
Hide file tree
Showing 41 changed files with 1,181 additions and 1,176 deletions.
10 changes: 5 additions & 5 deletions makefile
Expand Up @@ -47,7 +47,7 @@ src/sqr/fp_sqr_comba_4.o src/sqr/fp_sqr_comba_48.o src/sqr/fp_sqr_comba_6.o src/
src/sqr/fp_sqr_comba_7.o src/sqr/fp_sqr_comba_8.o src/sqr/fp_sqr_comba_9.o \
src/sqr/fp_sqr_comba_generic.o src/sqr/fp_sqr_comba_small_set.o src/sqr/fp_sqrmod.o

HEADERS=src/headers/tfm.h
HEADERS=src/headers/tfm.h

#END_INS

Expand Down Expand Up @@ -104,7 +104,7 @@ profiled:
rm -f test
CFLAGS="${CFLAGS} -fprofile-use" MAKE=${MAKE} ${MAKE} timing

stest: $(LIBNAME) demo/stest.o
stest: $(LIBNAME) demo/stest.o
$(CC) $(CFLAGS) demo/stest.o $(LIBNAME) -o stest

rsatest: $(LIBNAME) demo/rsa.o
Expand Down Expand Up @@ -154,6 +154,6 @@ zipup: no_oops docs clean
zip -9r tfm-$(VERSION).zip tomsfastmath-$(VERSION)/* ; \
mv -f tfm* ~ ; rm -rf tomsfastmath-$(VERSION)

# $Source: /cvs/libtom/tomsfastmath/makefile,v $
# $Revision: 1.38 $
# $Date: 2007/03/13 01:23:03 $
# $Source$
# $Revision$
# $Date$
10 changes: 5 additions & 5 deletions makefile.shared
Expand Up @@ -45,7 +45,7 @@ src/sqr/fp_sqr_comba_4.o src/sqr/fp_sqr_comba_48.o src/sqr/fp_sqr_comba_6.o src/
src/sqr/fp_sqr_comba_7.o src/sqr/fp_sqr_comba_8.o src/sqr/fp_sqr_comba_9.o \
src/sqr/fp_sqr_comba_generic.o src/sqr/fp_sqr_comba_small_set.o src/sqr/fp_sqrmod.o

HEADERS=src/headers/tfm.h
HEADERS=src/headers/tfm.h

#END_INS

Expand Down Expand Up @@ -100,10 +100,10 @@ test: $(LIBNAME) demo/test.o mtest/mtest
timing: $(LIBNAME) demo/test.o
$(CC) $(CFLAGS) demo/test.o $(LIBNAME_S) $(PROF) -o test

stest: $(LIBNAME) demo/stest.o
stest: $(LIBNAME) demo/stest.o
$(CC) $(CFLAGS) demo/stest.o $(LIBNAME_S) -o stest

# $Source: /cvs/libtom/tomsfastmath/makefile.shared,v $
# $Revision: 1.19 $
# $Date: 2007/03/13 01:23:03 $
# $Source$
# $Revision$
# $Date$

6 changes: 3 additions & 3 deletions src/bin/fp_radix_size.c
@@ -1,10 +1,10 @@
/* TomsFastMath, a fast ISO C bignum library.
*
*
* This project is meant to fill in where LibTomMath
* falls short. That is speed ;-)
*
* This project is public domain and free for all purposes.
*
*
* Tom St Denis, tomstdenis@gmail.com
*/
#include <tfm.h>
Expand All @@ -14,7 +14,7 @@ int fp_radix_size(fp_int *a, int radix, int *size)
int digs;
fp_int t;
fp_digit d;

*size = 0;

/* check range of the radix */
Expand Down
4 changes: 2 additions & 2 deletions src/generators/comba_mult_gen.c
@@ -1,10 +1,10 @@
/* TomsFastMath, a fast ISO C bignum library.
*
*
* This project is meant to fill in where LibTomMath
* falls short. That is speed ;-)
*
* This project is public domain and free for all purposes.
*
*
* Tom St Denis, tomstdenis@gmail.com
*/

Expand Down
2 changes: 1 addition & 1 deletion src/generators/comba_sqr_gen.c
Expand Up @@ -28,7 +28,7 @@ printf(
"#endif\n"
"\n"
" a = A->dp;\n"
" COMBA_START; \n"
" COMBA_START;\n"
"\n"
" /* clear carries */\n"
" CLEAR_CARRY;\n"
Expand Down
2 changes: 1 addition & 1 deletion src/generators/makefile
Expand Up @@ -11,7 +11,7 @@ comba_sqr_smallgen: comba_sqr_smallgen.c

regen: comba_sqr_gen comba_sqr_smallgen
for i in 3 4 6 7 8 9 12 17 20 24 28 32 48 64; do \
./comba_sqr_gen $$i > ../sqr/fp_sqr_comba_$$i.c; \
./comba_sqr_gen $$i | sed -e 's/ *$$//' > ../sqr/fp_sqr_comba_$$i.c; \
done
./comba_sqr_smallgen > ../sqr/fp_sqr_comba_small_set.c

20 changes: 10 additions & 10 deletions src/headers/tfm.h
@@ -1,10 +1,10 @@
/* TomsFastMath, a fast ISO C bignum library.
*
*
* This project is meant to fill in where LibTomMath
* falls short. That is speed ;-)
*
* This project is public domain and free for all purposes.
*
*
* Tom St Denis, tomstdenis@gmail.com
*/
#ifndef TFM_H_
Expand All @@ -27,13 +27,13 @@
/* externally define this symbol to ignore the default settings, useful for changing the build from the make process */
#ifndef TFM_ALREADY_SET

/* do we want the large set of small multiplications ?
/* do we want the large set of small multiplications ?
Enable these if you are going to be doing a lot of small (<= 16 digit) multiplications say in ECC
Or if you're on a 64-bit machine doing RSA as a 1024-bit integer == 16 digits ;-)
*/
#define TFM_SMALL_SET

/* do we want huge code
/* do we want huge code
Enable these if you are doing 20, 24, 28, 32, 48, 64 digit multiplications (useful for RSA)
Less important on 64-bit machines as 32 digits == 2048 bits
*/
Expand Down Expand Up @@ -81,7 +81,7 @@
/* #define TFM_PRESCOTT */

/* Do we want timing resistant fp_exptmod() ?
* This makes it slower but also timing invariant with respect to the exponent
* This makes it slower but also timing invariant with respect to the exponent
*/
/* #define TFM_TIMING_RESISTANT */

Expand All @@ -106,7 +106,7 @@

/* autodetect x86-64 and make sure we are using 64-bit digits with x86-64 asm */
#if defined(__x86_64__)
#if defined(TFM_X86) || defined(TFM_SSE2) || defined(TFM_ARM)
#if defined(TFM_X86) || defined(TFM_SSE2) || defined(TFM_ARM)
#error x86-64 detected, x86-32/SSE2/ARM optimizations are not valid!
#endif
#if !defined(TFM_X86_64) && !defined(TFM_NO_ASM)
Expand All @@ -121,7 +121,7 @@

/* try to detect x86-32 */
#if defined(__i386__) && !defined(TFM_SSE2)
#if defined(TFM_X86_64) || defined(TFM_ARM)
#if defined(TFM_X86_64) || defined(TFM_ARM)
#error x86-32 detected, x86-64/ARM optimizations are not valid!
#endif
#if !defined(TFM_X86) && !defined(TFM_NO_ASM)
Expand Down Expand Up @@ -185,7 +185,7 @@
#undef TFM_PPC32
#undef TFM_PPC64
#undef TFM_AVR32
#undef TFM_ASM
#undef TFM_ASM
#endif

/* ECC helpers */
Expand Down Expand Up @@ -252,7 +252,7 @@
#else
/* this is to make porting into LibTomCrypt easier :-) */
#ifndef CRYPT
#if defined(_MSC_VER) || defined(__BORLANDC__)
#if defined(_MSC_VER) || defined(__BORLANDC__)
typedef unsigned __int64 ulong64;
typedef signed __int64 long64;
#else
Expand Down Expand Up @@ -290,7 +290,7 @@
/* a FP type */
typedef struct {
fp_digit dp[FP_SIZE];
int used,
int used,
sign;
} fp_int;

Expand Down
6 changes: 3 additions & 3 deletions src/misc/fp_ident.c
@@ -1,10 +1,10 @@
/* TomsFastMath, a fast ISO C bignum library.
*
*
* This project is meant to fill in where LibTomMath
* falls short. That is speed ;-)
*
* This project is public domain and free for all purposes.
*
*
* Tom St Denis, tomstdenis@gmail.com
*/
#include "tfm.h"
Expand Down Expand Up @@ -73,7 +73,7 @@ const char *fp_ident(void)
"\n", __DATE__, sizeof(fp_digit), sizeof(fp_word), FP_MAX_SIZE);

if (sizeof(fp_digit) == sizeof(fp_word)) {
strncat(buf, "WARNING: sizeof(fp_digit) == sizeof(fp_word), this build is likely to not work properly.\n",
strncat(buf, "WARNING: sizeof(fp_digit) == sizeof(fp_word), this build is likely to not work properly.\n",
sizeof(buf)-1);
}
return buf;
Expand Down
28 changes: 14 additions & 14 deletions src/mont/fp_montgomery_reduce.c
@@ -1,19 +1,19 @@
/* TomsFastMath, a fast ISO C bignum library.
*
*
* This project is meant to fill in where LibTomMath
* falls short. That is speed ;-)
*
* This project is public domain and free for all purposes.
*
*
* Tom St Denis, tomstdenis@gmail.com
*/
#include <tfm.h>

/******************************************************************/
#if defined(TFM_X86) && !defined(TFM_SSE2)
#if defined(TFM_X86) && !defined(TFM_SSE2)
/* x86-32 code */

#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -45,7 +45,7 @@ asm( \
#elif defined(TFM_X86_64)
/* x86-64 code */

#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -168,7 +168,7 @@ asm( \
: "%rax", "%cc")

/******************************************************************/
#elif defined(TFM_SSE2)
#elif defined(TFM_SSE2)
/* SSE2 code (assumes 32-bit fp_digits) */
/* XMM register assignments:
* xmm0 *tmpm++, then Mu * (*tmpm++)
Expand Down Expand Up @@ -286,7 +286,7 @@ asm( \
#elif defined(TFM_ARM)
/* ARMv4 code */

#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -315,7 +315,7 @@ asm( \
#elif defined(TFM_PPC32)

/* PPC32 */
#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -346,7 +346,7 @@ asm( \
#elif defined(TFM_PPC64)

/* PPC64 */
#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -377,7 +377,7 @@ asm( \
#elif defined(TFM_AVR32)

/* AVR32 */
#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -407,7 +407,7 @@ asm( \
#elif defined(TFM_MIPS)

/* MIPS */
#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -440,7 +440,7 @@ asm( \
#else

/* ISO C code */
#define MONT_START
#define MONT_START
#define MONT_FINI
#define LOOP_END
#define LOOP_START \
Expand Down Expand Up @@ -526,7 +526,7 @@ void fp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp)
PROPCARRY;
++_c;
}
}
}

/* now copy out */
_c = c + pa;
Expand All @@ -543,7 +543,7 @@ void fp_montgomery_reduce(fp_int *a, fp_int *m, fp_digit mp)

a->used = pa+1;
fp_clamp(a);

/* if A >= m then A = A - m */
if (fp_cmp_mag (a, m) != FP_LT) {
s_fp_sub (a, m, a);
Expand Down
12 changes: 6 additions & 6 deletions src/mul/fp_mul.c
@@ -1,10 +1,10 @@
/* TomsFastMath, a fast ISO C bignum library.
*
*
* This project is meant to fill in where LibTomMath
* falls short. That is speed ;-)
*
* This project is public domain and free for all purposes.
*
*
* Tom St Denis, tomstdenis@gmail.com
*/
#include <tfm.h>
Expand All @@ -23,9 +23,9 @@ void fp_mul(fp_int *A, fp_int *B, fp_int *C)
y = MAX(A->used, B->used);
yy = MIN(A->used, B->used);
/* pick a comba (unrolled 4/8/16/32 x or rolled) based on the size
of the largest input. We also want to avoid doing excess mults if the
of the largest input. We also want to avoid doing excess mults if the
inputs are not close to the next power of two. That is, for example,
if say y=17 then we would do (32-17)^2 = 225 unneeded multiplications
if say y=17 then we would do (32-17)^2 = 225 unneeded multiplications
*/

#ifdef TFM_MUL3 && FP_SIZE >= 6
Expand Down Expand Up @@ -82,7 +82,7 @@ void fp_mul(fp_int *A, fp_int *B, fp_int *C)
fp_mul_comba_small(A,B,C);
return;
}
#endif
#endif
#if defined(TFM_MUL20) && FP_SIZE >= 40
if (y <= 20) {
fp_mul_comba20(A,B,C);
Expand Down Expand Up @@ -112,7 +112,7 @@ void fp_mul(fp_int *A, fp_int *B, fp_int *C)
fp_mul_comba48(A,B,C);
return;
}
#endif
#endif
#if defined(TFM_MUL64) && FP_SIZE >= 128
if (yy >= 56 && y <= 64) {
fp_mul_comba64(A,B,C);
Expand Down

0 comments on commit 86e7c59

Please sign in to comment.