Commit 32f3ba18 authored by Niels Möller's avatar Niels Möller
Browse files

Merge branch 'ecc-support'.

parents 11609bf3 33304507
RCS
SCCS
CVS
CVS.adm
RCSLOG
cvslog.*
tags tags
TAGS TAGS
.make.state
.nse_depinfo
*~ *~
#*
.#* .#*
,*
_$*
*$
*.old *.old
*.bak
*.BAK
*.orig *.orig
*.rej *.rej
.del-*
*.a *.a
*.olb
*.o *.o
*.obj *.obj
*.so *.so
*.exe *.exe
*.Z
*.elc
*.ln
core core
/*.d /*.d
/*.po /*.po
...@@ -37,9 +18,7 @@ core ...@@ -37,9 +18,7 @@ core
/*.tar.gz.asc /*.tar.gz.asc
/.lib /.lib
/*.asm /*.asm
/autom4te.cache
/Makefile /Makefile
/aesdata
/config.cache /config.cache
/config.h /config.h
/config.h.in /config.h.in
...@@ -48,12 +27,27 @@ core ...@@ -48,12 +27,27 @@ core
/config.make /config.make
/config.status /config.status
/configure /configure
/autom4te.cache
/stamp-h
/stamp-h.in
/nettle-stdint.h
/*.pc /*.pc
/machine.m4 /machine.m4
/aesdata
/desdata /desdata
/eccdata
/eccdata.stamp
/gcmdata /gcmdata
/shadata
/twofishdata
/keymap.h /keymap.h
/nettle-stdint.h /parity.h
/rotors.h
/ecc-192.h
/ecc-224.h
/ecc-256.h
/ecc-384.h
/ecc-521.h
/nettle.aux /nettle.aux
/nettle.cp /nettle.cp
/nettle.cps /nettle.cps
...@@ -71,8 +65,3 @@ core ...@@ -71,8 +65,3 @@ core
/nettle.tps /nettle.tps
/nettle.vr /nettle.vr
/nettle.vrs /nettle.vrs
/parity.h
/rotors.h
/shadata
/stamp-h
/stamp-h.in
2013-03-07 Niels Möller <nisse@lysator.liu.se>
* gmp-glue.c (mpz_limbs_cmp): Don't use PTR and SIZ macros.
* Makefile.in (aesdata, desdata, twofishdata, shadata, gcmdata)
(eccdata): Arrange for compiling these programs for running on the
build system, also when cross compiling everything else.
* config.make.in (CC_FOR_BUILD, EXEEXT_FOR_BUILD): New variables.
* configure.ac: Use GMP_PROG_CC_FOR_BUILD and
GMP_PROG_EXEEXT_FOR_BUILD.
* aclocal.m4 (GMP_PROG_CC_FOR_BUILD, GMP_PROG_CC_FOR_BUILD_WORKS)
(GMP_PROG_EXEEXT_FOR_BUILD): New macros, based on GMP's.
* aesdata.c: Deleted includes of config.h and nettle-types.h. Use
unsigned char and unsigned long instead of stdint.h types.
* desdata.c: Deleted includes of config.h and desCode.h.
(main): Return 1 on invalid argument. Don't use ROR macro. Use
unsigned long instead of uint32_t, and make it work if unsigned
long is larger than 32 bits.
* gcmdata.c: Deleted include of config.h and use UNUSED macro.
* shadata.c: Likewise.
* twofishdata.c: Deleted include of nettle-types.h. Use unsigned
char instead of stdint.h types.
* x86_64/ecc-521-modp.asm: New file. 2.4 time speedup.
2013-03-06 Niels Möller <nisse@lysator.liu.se>
* x86_64/ecc-384-modp.asm: New file, 3 time speedup.
* x86_64/ecc-256-redc.asm: New file, 2.5 time speedup.
* x86_64/ecc-224-modp.asm: New file, 5 time speedup over C
version.
2013-03-05 Niels Möller <nisse@lysator.liu.se>
* configure.ac (asm_optional_list): Added ecc-521-modp.asm.
* ecc-521.c: Check HAVE_NATIVE_ecc_521_modp, and use native
version if available.
* armv7/ecc-521-modp.asm: New file, 2 time speedup over C version.
2013-03-04 Niels Möller <nisse@lysator.liu.se>
* configure.ac (asm_optional_list): Added ecc-384-modp.asm. Deleted
bogus reference to $asm_search_list.
* ecc-384.c: Check HAVE_NATIVE_ecc_384_modp, and use native
version if available.
* armv7/ecc-384-modp.asm: New file, 3 time speedup over C version.
2013-03-03 Niels Möller <nisse@lysator.liu.se>
* ecc-256.c: Fixed definition of USE_REDC.
2013-03-01 Niels Möller <nisse@lysator.liu.se>
* ecc-256.c: Check HAVE_NATIVE_ecc_256_redc, and use native
version if available.
* armv7/ecc-256-redc.asm: New file, 4 time speedup over C version.
* testsuite/ecc-redc-test.c: Increased test count.
* ecc-224.c: Check HAVE_NATIVE_ecc_224_modp, and use native
version if available.
* armv7/ecc-224-modp.asm: New file, 4.5 time speedup over C
version.
* configure.ac (asm_optional_list): Added ecc-224-modp.asm.
(OPT_ASM_SOURCES): Fixed assignment.
2013-02-28 Niels Möller <nisse@lysator.liu.se>
* x86_64/ecc-192-modp.asm: Reorganized to reduce number of
additions. Use setc instruction.
* examples/Makefile.in: Let $(HOGWEED_TARGETS) depend on
../libhogweed.a.
* armv7/ecc-192-modp.asm: New file. 2.5 time speedup over C
version.
2013-02-27 Niels Möller <nisse@lysator.liu.se>
* ecc-192.c: Check HAVE_NATIVE_ecc_192_modp, and use native
version if available.
(ecc_192_modp): Fixed carry handling bug in 32-bit version.
* x86_64/ecc-192-modp.asm: New file. 3.8 times speedup over C
version.
* configure.ac (OPT_ASM_SOURCES): New substituted variable.
(asm_replace_list, asm_optional_list): New variables. For files in
asm_optional_list, also add them to OPT_ASM_SOURCES and define
appropriate HAVE_NATIVE_* symbols found.
* Makefile.in (OPT_ASM_SOURCES): New variable. Used for setting
hogweed_OBJS and hogweed_PURE_OBJS.
* testsuite/ecc-mod-test.c: Increased test count.
* ecc-384.c (ecc_384_modp): Fixed typo which broke carry handling
in the 64-bit version.
* examples/ecc-benchmark.c (bench_add_jjj): Typo fix, benchmark
the right function.
* gmp-glue.h: Check if GMP provides mpz_limbs_read (expected in
next release).
* gmp-glue.c: Use GMP's mpz_limbs_read and friends if available.
Renamed all functions for consistency with GMP. Updated all
callers.
2013-02-20 Niels Möller <nisse@lysator.liu.se>
* examples/Makefile.in (HOGWEED_TARGETS): Added
hogweed-benchmark$(EXEEXT).
(SOURCES): Added hogweed-benchmark.c.
(hogweed-benchmark$(EXEEXT)): New target.
* examples/hogweed-benchmark.c: New file.
* ecdsa-keygen.c (ecdsa_generate_keypair): New file and function.
* Makefile.in (hogweed_SOURCES): Added ecdsa-keygen.c.
* testsuite/ecdsa-keygen-test.c: New testcase.
* testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
ecdsa-keygen-test.c.
* nettle-internal.h (TMP_ALLOC): Added missing parentheses.
2013-02-18 Niels Möller <nisse@lysator.liu.se>
* testsuite/ecdsa-verify-test.c: New testcase.
* testsuite/ecdsa-sign-test.c: New testcase.
* testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
ecdsa-sign-test.c and ecdsa-verify-test.c.
* testsuite/testutils.h: Include ecdsa.h.
(SHEX): Deleted const cast.
* ecc-point.c: New file, struct ecc_point abstraction.
* ecc-scalar.c: New file, struct ecc_scalar abstraction.
* ecc-random.c (ecc_modq_random, ecc_scalar_random): New file, new
functions.
* ecc-hash.c (ecc_hash): New file and function.
* ecc-ecdsa-sign.c: New file, low-level signing interface.
* ecc-ecdsa-verify.c: New file, low-level ecdsa verify.
* ecdsa-sign.c: (ecdsa_sign): New file and function.
* ecdsa-verify.c (ecdsa_verify): New file and function.
* ecdsa.h: New header file.
* ecc.h: Declare ecc_point and ecc_scalar functions.
* ecc-internal.h: Added declarations.
* Makefile.in (hogweed_SOURCES): Added new source files.
(HEADERS): Added ecdsa.h.
* gmp-glue.c (_mpz_set_mpn): New convenience function.
(_mpn_set_base256): New function.
(_gmp_alloc_limbs): New function.
(_gmp_free_limbs): New function.
* gmp-glue.h: Corresponding declarations. Include nettle-stdinh.h.
* examples/Makefile.in (HOGWEED_TARGETS): Renamed, was
RSA_TARGETS. Added ecc-benchmark$(EXEEXT).
(SOURCES): Added ecc-benchmark.c.
(ecc-benchmark$(EXEEXT)): New target.
* examples/ecc-benchmark.c: New file, benchmarking ecc primitives.
2013-02-15 Niels Möller <nisse@lysator.liu.se>
Integrate ecc_mul_a.
* ecc-a-to-j.c: New file.
* ecc-add-jjj.c: New file.
* ecc-mul-a.c: New file.
* Makefile.in (hogweed_SOURCES): Added new files.
* testsuite/ecc-mul-a-test.c: New file.
* testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
ecc-mul-a-test.c.
* testsuite/testutils.c: Removed redundant includes.
(die): New function.
Integrate ecc_mul_g.
* ecc.h: New file.
* ecc-j-to-a.c: New file.
* ecc-size.c: New file.
* ecc-add-jja.c: New file.
* ecc-dup-jj.c: New file.
* ecc-mul-g.c: New file.
* sec-tabselect.c: New file.
* Makefile.in (hogweed_SOURCES): Added new files.
(HEADERS): Added ecc.h
* testsuite/ecc-mul-g-test.c: New file.
* testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added
ecc-mul-g-test.c.
* testsuite/testutils.c (xalloc_limbs): New function.
(test_mpn): New function.
(test_ecc_point): New function.
(test_ecc_mul_a): New function.
(test_ecc_mul_j): New function.
* testsuite/testutils.h: Corresponding declarations.
Integrate ECC internals.
* ecc-curve.h: New file.
* ecc-internal.h: New file.
* cnd-copy.c: New file.
* ecc-192.c: New file.
* ecc-224.c: New file.
* ecc-256.c: New file.
* ecc-384.c: New file.
* ecc-521.c: New file.
* ecc-generic-modp.c: New file.
* ecc-generic-modq.c: New file.
* ecc-generic-redc.c: New file.
* ecc-mod.c: New file.
* ecc-modp.c: New file.
* ecc-modq.c: New file.
* sec-add-1.c: New file.
* sec-modinv.c: New file.
* sec-sub-1.c: New file.
* Makefile.in (hogweed_SOURCES): Added new files.
(HEADERS): Added ecc-curve.h.
(DISTFILES): Added ecc-internal.h.
* testsuite/ecc-mod-test.c: New file.
* testsuite/ecc-modinv-test.c: New file.
* testsuite/ecc-redc-test.c: New file.
* testsuite/testutils.c (ecc_curves): New constant array.
* testsuite/testutils.h: Include ecc-related headers. Declare
ecc_curves array.
* testsuite/Makefile.in (TS_HOGWEED_SOURCES): Added ecc-mod-test.c
ecc-modinv-test.c ecc-redc-test.c.
* gmp-glue.c: New file, mpn <-> mpz conversions.
* gmp-glue.h: New file.
* Makefile.in: Added to hogweed_SOURCES and DISTFILES, respectively.
* eccdata.c: New program, for generating ECC-related tables.
* Makefile.in (ecc-192.h, ecc-224.h, ecc-256.h, ecc-384.h)
(ecc-512.h): New generated files.
2013-02-19 Niels Möller <nisse@lysator.liu.se> 2013-02-19 Niels Möller <nisse@lysator.liu.se>
* armv7/memxor.asm (memxor): Software pipelining for the aligned * armv7/memxor.asm (memxor): Software pipelining for the aligned
...@@ -8,6 +250,9 @@ ...@@ -8,6 +250,9 @@
2013-02-14 Niels Möller <nisse@lysator.liu.se> 2013-02-14 Niels Möller <nisse@lysator.liu.se>
* configure.ac: Find GMP's GMP_NUMB_BITS. Substitute in Makefile.
* config.make.in (GMP_NUMB_BITS): New variable.
* examples/rsa-keygen.c (uint_arg): New function. * examples/rsa-keygen.c (uint_arg): New function.
(main): New options -s and -e, to specify key size and public (main): New options -s and -e, to specify key size and public
exponent. Increased default key size to 2048. exponent. Increased default key size to 2048.
......
...@@ -14,6 +14,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ ...@@ -14,6 +14,8 @@ INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = $(INSTALL_PROGRAM) -s INSTALL_STRIP_PROGRAM = $(INSTALL_PROGRAM) -s
MKDIR_P = @MKDIR_P@ MKDIR_P = @MKDIR_P@
OPT_ASM_SOURCES = @OPT_ASM_SOURCES@
SUBDIRS = tools testsuite examples SUBDIRS = tools testsuite examples
include config.make include config.make
...@@ -30,7 +32,7 @@ internal_SOURCES = nettle-internal.c ...@@ -30,7 +32,7 @@ internal_SOURCES = nettle-internal.c
internal_TARGETS = $(internal_SOURCES:.c=.$(OBJEXT)) internal_TARGETS = $(internal_SOURCES:.c=.$(OBJEXT))
TARGETS = aesdata$(EXEEXT) desdata$(EXEEXT) twofishdata$(EXEEXT) \ TARGETS = aesdata$(EXEEXT) desdata$(EXEEXT) twofishdata$(EXEEXT) \
shadata$(EXEEXT) gcmdata$(EXEEXT) \ shadata$(EXEEXT) gcmdata$(EXEEXT) eccdata$(EXEEXT) \
$(getopt_TARGETS) $(internal_TARGETS) \ $(getopt_TARGETS) $(internal_TARGETS) \
$(LIBTARGETS) $(SHLIBTARGETS) $(LIBTARGETS) $(SHLIBTARGETS)
IMPLICIT_TARGETS = @IF_DLL@ $(LIBNETTLE_FILE) $(LIBHOGWEED_FILE) IMPLICIT_TARGETS = @IF_DLL@ $(LIBNETTLE_FILE) $(LIBHOGWEED_FILE)
...@@ -122,21 +124,31 @@ hogweed_SOURCES = sexp.c sexp-format.c \ ...@@ -122,21 +124,31 @@ hogweed_SOURCES = sexp.c sexp-format.c \
dsa-sha256-sign.c dsa-sha256-verify.c \ dsa-sha256-sign.c dsa-sha256-verify.c \
dsa2sexp.c sexp2dsa.c \ dsa2sexp.c sexp2dsa.c \
pgp-encode.c rsa2openpgp.c \ pgp-encode.c rsa2openpgp.c \
der-iterator.c der2rsa.c der2dsa.c der-iterator.c der2rsa.c der2dsa.c \
sec-add-1.c sec-sub-1.c sec-modinv.c sec-tabselect.c \
gmp-glue.c cnd-copy.c \
ecc-mod.c ecc-generic-modp.c ecc-generic-modq.c \
ecc-modp.c ecc-modq.c ecc-generic-redc.c \
ecc-192.c ecc-224.c ecc-256.c ecc-384.c ecc-521.c \
ecc-size.c ecc-j-to-a.c ecc-a-to-j.c \
ecc-dup-jj.c ecc-add-jja.c ecc-add-jjj.c \
ecc-mul-g.c ecc-mul-a.c ecc-hash.c ecc-random.c \
ecc-point.c ecc-scalar.c \
ecc-ecdsa-sign.c ecdsa-sign.c \
ecc-ecdsa-verify.c ecdsa-verify.c ecdsa-keygen.c
HEADERS = aes.h arcfour.h arctwo.h asn1.h bignum.h blowfish.h \ HEADERS = aes.h arcfour.h arctwo.h asn1.h bignum.h blowfish.h \
base16.h base64.h buffer.h camellia.h cast128.h \ base16.h base64.h buffer.h camellia.h cast128.h \
cbc.h ctr.h gcm.h \ cbc.h ctr.h \
des.h des-compat.h dsa.h \ des.h des-compat.h dsa.h ecc-curve.h ecc.h ecdsa.h \
hmac.h \ gcm.h gosthash94.h hmac.h \
pbkdf2.h \
knuth-lfib.h \ knuth-lfib.h \
macros.h \ macros.h \
md2.h md4.h \ md2.h md4.h \
gosthash94.h \
md5.h md5-compat.h \ md5.h md5-compat.h \
memxor.h \ memxor.h \
nettle-meta.h nettle-types.h \ nettle-meta.h nettle-types.h \
pbkdf2.h \
pgp.h pkcs1.h realloc.h ripemd160.h rsa.h rsa-compat.h \ pgp.h pkcs1.h realloc.h ripemd160.h rsa.h rsa-compat.h \
salsa20.h sexp.h \ salsa20.h sexp.h \
serpent.h sha.h sha1.h sha2.h sha3.h twofish.h \ serpent.h sha.h sha1.h sha2.h sha3.h twofish.h \
...@@ -146,7 +158,7 @@ INSTALL_HEADERS = $(HEADERS) nettle-stdint.h ...@@ -146,7 +158,7 @@ INSTALL_HEADERS = $(HEADERS) nettle-stdint.h
SOURCES = $(nettle_SOURCES) $(hogweed_SOURCES) \ SOURCES = $(nettle_SOURCES) $(hogweed_SOURCES) \
$(getopt_SOURCES) $(internal_SOURCES) \ $(getopt_SOURCES) $(internal_SOURCES) \
aesdata.c desdata.c twofishdata.c shadata.c gcmdata.c aesdata.c desdata.c twofishdata.c shadata.c gcmdata.c eccdata.c
DISTFILES = $(SOURCES) $(HEADERS) getopt.h .bootstrap run-tests \ DISTFILES = $(SOURCES) $(HEADERS) getopt.h .bootstrap run-tests \
aclocal.m4 configure.ac \ aclocal.m4 configure.ac \
...@@ -159,6 +171,7 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h .bootstrap run-tests \ ...@@ -159,6 +171,7 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h .bootstrap run-tests \
aes-internal.h camellia-internal.h serpent-internal.h \ aes-internal.h camellia-internal.h serpent-internal.h \
cast128_sboxes.h desinfo.h desCode.h \ cast128_sboxes.h desinfo.h desCode.h \
nettle-internal.h nettle-write.h prime-list.h \ nettle-internal.h nettle-write.h prime-list.h \
gmp-glue.h ecc-internal.h \
asm.m4 \ asm.m4 \
nettle.texinfo nettle.info nettle.html nettle.pdf sha-example.c nettle.texinfo nettle.info nettle.html nettle.pdf sha-example.c
...@@ -166,8 +179,8 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h .bootstrap run-tests \ ...@@ -166,8 +179,8 @@ DISTFILES = $(SOURCES) $(HEADERS) getopt.h .bootstrap run-tests \
nettle_OBJS = $(nettle_SOURCES:.c=.$(OBJEXT)) $(LIBOBJS) nettle_OBJS = $(nettle_SOURCES:.c=.$(OBJEXT)) $(LIBOBJS)
nettle_PURE_OBJS = $(nettle_OBJS:.$(OBJEXT)=.p$(OBJEXT)) nettle_PURE_OBJS = $(nettle_OBJS:.$(OBJEXT)=.p$(OBJEXT))
hogweed_OBJS = $(hogweed_SOURCES:.c=.$(OBJEXT)) hogweed_OBJS = $(hogweed_SOURCES:.c=.$(OBJEXT)) $(OPT_ASM_SOURCES:.asm=.$(OBJEXT))
hogweed_PURE_OBJS = $(hogweed_OBJS:.$(OBJEXT)=.p$(OBJEXT)) hogweed_PURE_OBJS = $(hogweed_OBJS:.$(OBJEXT)=.p$(OBJEXT)) $(OPT_ASM_SOURCES:.asm=.p$(OBJEXT))
libnettle.a: $(nettle_OBJS) libnettle.a: $(nettle_OBJS)
-rm -f $@ -rm -f $@
...@@ -208,24 +221,32 @@ $(LIBHOGWEED_FORLINK): $(hogweed_PURE_OBJS) $(LIBNETTLE_FORLINK) ...@@ -208,24 +221,32 @@ $(LIBHOGWEED_FORLINK): $(hogweed_PURE_OBJS) $(LIBNETTLE_FORLINK)
$(COMPILE) $(SHLIBCFLAGS) -c $< -o $@ \ $(COMPILE) $(SHLIBCFLAGS) -c $< -o $@ \
&& $(DEP_PROCESS) && $(DEP_PROCESS)
# For Solaris and BSD make, we have to use an explicit rule for each executable # For Solaris and BSD make, we have to use an explicit rule for each
aesdata$(EXEEXT): aesdata.$(OBJEXT) # executable. Avoid object file targets to make it easy to run the
$(LINK) aesdata.$(OBJEXT) $(LIBS) -o aesdata$(EXEEXT) # right compiler.
aesdata$(EXEEXT_FOR_BUILD): aesdata.c
$(CC_FOR_BUILD) `test -f aesdata.c || echo '$(srcdir)/'`aesdata.c \
-o aesdata$(EXEEXT_FOR_BUILD)
desdata$(EXEEXT): desdata.$(OBJEXT) desdata$(EXEEXT_FOR_BUILD): desdata.c
$(LINK) desdata.$(OBJEXT) $(LIBS) -o desdata$(EXEEXT) $(CC_FOR_BUILD) `test -f desdata.c || echo '$(srcdir)/'`desdata.c \
-o desdata$(EXEEXT_FOR_BUILD)
twofishdata$(EXEEXT): twofishdata.$(OBJEXT) twofishdata$(EXEEXT_FOR_BUILD): twofishdata.c
$(LINK) twofishdata.$(OBJEXT) $(LIBS) -o twofishdata$(EXEEXT) $(CC_FOR_BUILD) `test -f twofishdata.c || echo '$(srcdir)/'`twofishdata.c \
-o twofishdata$(EXEEXT_FOR_BUILD)
shadata$(EXEEXT): shadata.$(OBJEXT) shadata$(EXEEXT_FOR_BUILD): shadata.c
$(LINK) shadata.$(OBJEXT) $(LIBS) -lm -o shadata$(EXEEXT) $(CC_FOR_BUILD) `test -f shadata.c || echo '$(srcdir)/'`shadata.c -lm \
-o shadata$(EXEEXT_FOR_BUILD)
gcmdata$(EXEEXT): gcmdata.$(OBJEXT) gcmdata$(EXEEXT_FOR_BUILD): gcmdata.c
$(LINK) gcmdata.$(OBJEXT) $(LIBS) -o gcmdata$(EXEEXT) $(CC_FOR_BUILD) `test -f gcmdata.c || echo '$(srcdir)/'`gcmdata.c \
-o gcmdata$(EXEEXT_FOR_BUILD)
# .$(OBJEXT)$(EXEEXT): eccdata$(EXEEXT_FOR_BUILD): eccdata.c
# $(LINK) $< $(LIBS) -o $@ $(CC_FOR_BUILD) `test -f eccdata.c || echo '$(srcdir)/'`eccdata.c -lgmp \
-o eccdata$(EXEEXT_FOR_BUILD)
# desCore rules # desCore rules
# It seems using $(srcdir)/ doesn't work with GNU make 3.79.1 # It seems using $(srcdir)/ doesn't work with GNU make 3.79.1
...@@ -241,6 +262,64 @@ $(des_headers): desdata.c ...@@ -241,6 +262,64 @@ $(des_headers): desdata.c
des.$(OBJEXT): des.c des.h $(des_headers) des.$(OBJEXT): des.c des.h $(des_headers)
# Generate ECC files.
# Some possible choices for 192:
# k = 15, c = 4, 64 entries, ~3 KB
# k = 20, c = 6, 128 entries, ~6 KB
# k = 10, c = 6, 256 entries, ~12 KB
# k = 7, c = 6, 320 entries, ~15 KB
# k = 9, c = 7, 512 entries, ~24 KB
ecc-192.h: eccdata.stamp
./eccdata$(EXEEXT) 192 7 6 $(GMP_NUMB_BITS) > $@T && mv $@T $@
# Some possible choices for 224:
# k = 18, c = 4, 64 entries, ~4 KB
# k = 24, c = 6, 128 entries, ~8 KB
# k = 12, c = 6, 256 entries, ~16 KB
# k = 8, c = 6, 320 entries, ~20 KB
# k = 10, c = 7, 512 entries, ~32 KB
ecc-224.h: eccdata.stamp
./eccdata$(EXEEXT) 224 12 6 $(GMP_NUMB_BITS) > $@T && mv $@T $@
# Some possible choices for 256:
# k = 20, c = 4, 64 entries, ~4 KB
# k = 27, c = 6, 128 entries, ~8 KB
# k = 14, c = 6, 256 entries, ~16 KB
# k = 9, c = 6, 320 entries, ~20 KB
# k = 12, c = 7, 512 entries, ~32 KB
ecc-256.h: eccdata.stamp
./eccdata$(EXEEXT) 256 14 6 $(GMP_NUMB_BITS) > $@T && mv $@T $@
# Some possible choices for 384:
# k = 31, c = 4, 64 entries, ~6 KB
# k = 41, c = 6, 128 entries, ~12 KB
# k = 20, c = 6, 256 entries, ~24 KB
# k = 14, c = 6, 320 entries, ~30 KB
# k = 18, c = 7, 512 entries, ~48 KB
ecc-384.h: eccdata.stamp
./eccdata$(EXEEXT) 384 41 6 $(GMP_NUMB_BITS) > $@T && mv $@T $@
# Some possible choices for 521:
# k = 42, c = 4, 64 entries, ~9 KB
# k = 56, c = 6, 128 entries, ~18 KB
# k = 28, c = 6, 256 entries, ~35 KB
# k = 19, c = 6, 320 entries, ~44 KB
# k = 24, c = 7, 512 entries, ~70 KB
ecc-521.h: eccdata.stamp
./eccdata$(EXEEXT) 521 56 6 $(GMP_NUMB_BITS) > $@T && mv $@T $@
eccdata.stamp: eccdata.c
$(MAKE) eccdata$(EXEEXT)
echo stamp > eccdata.stamp
ecc-192.$(OBJEXT): ecc-192.h
ecc-224.$(OBJEXT): ecc-224.h
ecc-256.$(OBJEXT): ecc-256.h
ecc-384.$(OBJEXT): ecc-384.h
ecc-521.$(OBJEXT): ecc-521.h
ecc-192.p$(OBJEXT): ecc-192.h
ecc-224.p$(OBJEXT): ecc-224.h
ecc-256.p$(OBJEXT): ecc-256.h
ecc-384.p$(OBJEXT): ecc-384.h
ecc-521.p$(OBJEXT): ecc-521.h
.asm.s: .asm.s:
$(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$@T \ $(M4) $(srcdir)/asm.m4 machine.m4 config.m4 $< >$@T \
&& test -s $@T && mv -f $@T $@ && test -s $@T && mv -f $@T $@
...@@ -490,7 +569,8 @@ distcheck: dist ...@@ -490,7 +569,8 @@ distcheck: dist
$(rm_distcheck) $(rm_distcheck)
clean-here: clean-here:
-rm -f $(TARGETS) $(IMPLICIT_TARGETS) *.$(OBJEXT) *.p$(OBJEXT) *.s -rm -f $(TARGETS) $(IMPLICIT_TARGETS) *.$(OBJEXT) *.p$(OBJEXT) *.s \
ecc-192.h ecc-224.h ecc-256.h ecc-384.h ecc-521.h eccdata.stamp
-rm -rf .lib -rm -rf .lib
distclean-here: clean-here distclean-here: clean-here
......
...@@ -496,6 +496,118 @@ fi ...@@ -496,6 +496,118 @@ fi
rm -f conftest* rm -f conftest*
]) ])
dnl GMP_PROG_CC_FOR_BUILD
dnl ---------------------
dnl Establish CC_FOR_BUILD, a C compiler for the build system.
dnl
dnl If CC_FOR_BUILD is set then it's expected to work, likewise the old
dnl style HOST_CC, otherwise some likely candidates are tried, the same as
dnl configfsf.guess.
AC_DEFUN([GMP_PROG_CC_FOR_BUILD],
[AC_REQUIRE([AC_PROG_CC])
if test -n "$CC_FOR_BUILD"; then
GMP_PROG_CC_FOR_BUILD_WORKS($CC_FOR_BUILD,,
[AC_MSG_ERROR([Specified CC_FOR_BUILD doesn't seem to work])])
elif test -n "$HOST_CC"; then
GMP_PROG_CC_FOR_BUILD_WORKS($HOST_CC,
[CC_FOR_BUILD=$HOST_CC],
[AC_MSG_ERROR([Specified HOST_CC doesn't seem to work])])
elif test $cross_compiling = no ; then
CC_FOR_BUILD="$CC"
else
for i in cc gcc c89 c99; do
GMP_PROG_CC_FOR_BUILD_WORKS($i,
[CC_FOR_BUILD=$i
break])
done
if test -z "$CC_FOR_BUILD"; then
AC_MSG_ERROR([Cannot find a build system compiler])
fi
fi
AC_ARG_VAR(CC_FOR_BUILD,[build system C compiler])
AC_SUBST(CC_FOR_BUILD)
])
dnl GMP_PROG_CC_FOR_BUILD_WORKS(cc/cflags[,[action-if-good][,action-if-bad]])