tomsfastmath: prefer size over speed

we can disable highly optimized mul/sqr operations for about 30% speed
decrease but saving a lot in binary size.
only build the files necessary by including an explicit list of filenames
rather than doing a wildcard over tfm/*.c.
This commit is contained in:
rofl0r 2018-01-01 16:06:12 +00:00 committed by wiire-a
parent 6985cff7b5
commit 2b229ba129
3 changed files with 42 additions and 3 deletions

View File

@ -18,7 +18,9 @@ INTFLAGS += -DUSE_OPENSSL
endif
TARGET = pixiewps
TFMSRC = $(sort $(wildcard $(SRCDIR)/crypto/tfm/*.c))
include $(SRCDIR)/crypto/tfm/sources.mak
TFMSRC = $(patsubst ./%,$(SRCDIR)/crypto/tfm/%,$(TFM_SRCS))
TFMOBJS = $(TFMSRC:.c=.o)
SOURCE = $(SRCDIR)/pixiewps.c

View File

@ -0,0 +1,37 @@
TFM_SRCS = \
./fp_2expt.c \
./fp_add.c \
./fp_cmp.c \
./fp_cmp_d.c \
./fp_cmp_mag.c \
./fp_count_bits.c \
./fp_div.c \
./fp_div_2.c \
./fp_div_2d.c \
./fp_exptmod.c \
./fp_invmod.c \
./fp_lshd.c \
./fp_mod.c \
./fp_mod_2d.c \
./fp_montgomery_reduce.c \
./fp_montgomery_setup.c \
./fp_montgomery_calc_normalization.c \
./fp_mul.c \
./fp_mul_2.c \
./fp_mul_2d.c \
./fp_mul_comba.c \
./fp_mul_comba_small_set.c \
./fp_mul_d.c \
./fp_mulmod.c \
./fp_read_unsigned_bin.c \
./fp_reverse.c \
./fp_rshd.c \
./fp_set.c \
./fp_sqr.c \
./fp_sqr_comba_generic.c \
./fp_sqr_comba_small_set.c \
./fp_sub.c \
./fp_to_unsigned_bin.c \
./fp_unsigned_bin_size.c \
./s_fp_add.c \
./s_fp_sub.c

View File

@ -59,13 +59,13 @@
#define TFM_MUL9
#define TFM_MUL12
#define TFM_MUL17
#endif
#define TFM_MUL20
#define TFM_MUL24
#define TFM_MUL28
#define TFM_MUL32
#define TFM_MUL48
#define TFM_MUL64
#endif
#if 0
#define TFM_SQR3
@ -76,13 +76,13 @@
#define TFM_SQR9
#define TFM_SQR12
#define TFM_SQR17
#endif
#define TFM_SQR20
#define TFM_SQR24
#define TFM_SQR28
#define TFM_SQR32
#define TFM_SQR48
#define TFM_SQR64
#endif
/* do we want some overflow checks
Not required if you make sure your numbers are within range (e.g. by default a modulus for fp_exptmod() can only be upto 2048 bits long)