[Cryptech-Commits] [user/sra/libtfm] 03/05: Make bignum size configurable.

git at cryptech.is git at cryptech.is
Fri Jun 19 17:39:07 UTC 2015


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository user/sra/libtfm.

commit 652a357ac9e6db1818945963515516db44c297b6
Author: Rob Austein <sra at hactrn.net>
Date:   Thu Jun 18 23:37:41 2015 -0400

    Make bignum size configurable.
---
 GNUmakefile | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index 533bb42..35cc7d5 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -3,20 +3,25 @@
 # Perhaps we should be using a git subrepository instead of this hack?
 # Work that out later.
 
+# See tfm.pdf section 1.3.6 ("Precision configuration") for details on
+# how FP_MAX_SIZE works.
+
+BITS	:= 8192
+
 URL	:= https://github.com/libtom/tomsfastmath.git
 
 REPO	:= $(notdir $(basename ${URL}))
 HDR	:= ${REPO}/src/headers/tfm.h
 LIB	:= ${REPO}/libtfm.a
 
-FLAGS	:= CFLAGS='-fPIC -Wall -W -Wshadow -Isrc/headers -g3'
+FLAGS	:= CFLAGS='-fPIC -Wall -W -Wshadow -Isrc/headers -g3 -DFP_MAX_SIZE="(${BITS}+(8*DIGIT_BIT))"'
 
 TARGETS	:= $(notdir ${HDR} ${LIB})
 
 all: ${TARGETS}
 
 clean:
-	rm -f ${TARGETS}
+	rm -f ${TARGETS} $(notdir ${HDR}.tmp)
 	cd ${REPO}; git clean -dxf
 
 distclean: clean
@@ -31,7 +36,11 @@ ${LIB}: ${HDR}
 	cd ${REPO}; ${MAKE} ${FLAGS}
 
 $(notdir ${HDR}): ${HDR}
-	ln -f $^ $@
+	echo  >$@.tmp '/* Configure size of largest bignum we want to handle -- see notes in tfm.pdf */'
+	echo >>$@.tmp '#define   FP_MAX_SIZE   (${BITS}+(8*DIGIT_BIT))'
+	echo >>$@.tmp ''
+	cat  >>$@.tmp $^
+	mv -f $@.tmp $@
 
 $(notdir ${LIB}): ${LIB}
 	ln -f $^ $@



More information about the Commits mailing list