Skip to content
Snippets Groups Projects
Commit d72f50ff authored by Matt Johnston's avatar Matt Johnston
Browse files

Update to libtommath v1.0.1

parent debb2085
No related branches found
No related tags found
No related merge requests found
Showing
with 110 additions and 138 deletions
Loading
Loading
@@ -14,12 +14,6 @@ else
silent=@
endif
 
%.o: %.c
ifneq ($V,1)
@echo " * ${CC} $@"
endif
${silent} ${CC} -c ${CFLAGS} $^ -o $@
#default files to install
ifndef LIBNAME
LIBNAME=libtommath.a
Loading
Loading
@@ -27,6 +21,14 @@ endif
 
coverage: LIBNAME:=-Wl,--whole-archive $(LIBNAME) -Wl,--no-whole-archive
 
include $(srcdir)/makefile_include.mk
%.o: %.c
ifneq ($V,1)
@echo " * ${CC} $@"
endif
${silent} ${CC} -c ${CFLAGS} $< -o $@
LCOV_ARGS=--directory .
 
#START_INS
Loading
Loading
@@ -57,6 +59,8 @@ bn_s_mp_sqr.o bn_s_mp_sub.o
 
#END_INS
 
$(OBJECTS): $(HEADERS)
$(LIBNAME): $(OBJECTS)
$(AR) $(ARFLAGS) $@ $(OBJECTS)
$(RANLIB) $@
Loading
Loading
@@ -90,6 +94,10 @@ install: $(LIBNAME)
install -m 644 $(LIBNAME) $(DESTDIR)$(LIBPATH)
install -m 644 $(HEADERS_PUB) $(DESTDIR)$(INCPATH)
 
uninstall:
rm $(DESTDIR)$(LIBPATH)/$(LIBNAME)
rm $(HEADERS_PUB:%=$(DESTDIR)$(INCPATH)/%)
test: $(LIBNAME) demo/demo.o
$(CC) $(CFLAGS) demo/demo.o $(LIBNAME) $(LFLAGS) -o test
 
Loading
Loading
@@ -100,71 +108,30 @@ test_standalone: $(LIBNAME) demo/demo.o
mtest:
cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LFLAGS) -o mtest
 
travis_mtest: test mtest
@ for i in `seq 1 10` ; do sleep 500 && echo alive; done &
./mtest/mtest 666666 | ./test > test.log
timing: $(LIBNAME)
$(CC) $(CFLAGS) -DTIMER demo/timing.c $(LIBNAME) $(LFLAGS) -o ltmtest
 
coveralls: coverage
cpp-coveralls
# makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
docdvi: tommath.src
cd pics ; MAKE=${MAKE} ${MAKE}
echo "hello" > tommath.ind
perl booker.pl
latex tommath > /dev/null
latex tommath > /dev/null
makeindex tommath
latex tommath > /dev/null
# poster, makes the single page PDF poster
poster: poster.tex
cp poster.tex poster.bak
touch --reference=poster.tex poster.bak
(printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y poster.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > poster-deterministic.tex
printf "%s\n" "\pdfinfo{" >> poster-deterministic.tex
printf "%s\n" " /CreationDate (\fixedpdfdate)" >> poster-deterministic.tex
printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> poster-deterministic.tex
cat poster.tex >> poster-deterministic.tex
mv poster-deterministic.tex poster.tex
touch --reference=poster.bak poster.tex
pdflatex poster
sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' poster.pdf
mv poster.bak poster.tex
rm -f poster.aux poster.log poster.out
# makes the LTM book PDF file, requires tetex, cleans up the LaTeX temp files
docs: docdvi
dvipdf tommath
rm -f tommath.log tommath.aux tommath.dvi tommath.idx tommath.toc tommath.lof tommath.ind tommath.ilg
cd pics ; MAKE=${MAKE} ${MAKE} clean
#LTM user manual
mandvi: bn.tex
cp bn.tex bn.bak
touch --reference=bn.tex bn.bak
(printf "%s" "\def\fixedpdfdate{"; date +'D:%Y%m%d%H%M%S%:z' -d @$$(stat --format=%Y bn.tex) | sed "s/:\([0-9][0-9]\)$$/'\1'}/g") > bn-deterministic.tex
printf "%s\n" "\pdfinfo{" >> bn-deterministic.tex
printf "%s\n" " /CreationDate (\fixedpdfdate)" >> bn-deterministic.tex
printf "%s\n}\n" " /ModDate (\fixedpdfdate)" >> bn-deterministic.tex
cat bn.tex >> bn-deterministic.tex
mv bn-deterministic.tex bn.tex
touch --reference=bn.bak bn.tex
echo "hello" > bn.ind
latex bn > /dev/null
latex bn > /dev/null
makeindex bn
latex bn > /dev/null
#LTM user manual [pdf]
manual: mandvi
pdflatex bn >/dev/null
sed -b -i 's,^/ID \[.*\]$$,/ID [<0> <0>],g' bn.pdf
mv bn.bak bn.tex
rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc
# You have to create a file .coveralls.yml with the content "repo_token: <the token>"
# in the base folder to be able to submit to coveralls
coveralls: lcov
coveralls-lcov
docdvi poster docs mandvi manual:
$(MAKE) -C doc/ $@ V=$(V)
 
pretty:
perl pretty.build
 
#\zipup the project (take that!)
no_oops: clean
cd .. ; cvs commit
echo Scanning for scratch/dirty files
find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
clean:
rm -f *.bat *.pdf *.o *.a *.obj *.lib *.exe *.dll etclib/*.o demo/demo.o test ltmtest mpitest mtest/mtest mtest/mtest.exe \
*.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log *.s mpi.c *.da *.dyn *.dpi tommath.tex `find . -type f | grep [~] | xargs` *.lo *.la
Loading
Loading
@@ -172,29 +139,32 @@ clean:
-cd etc && MAKE=${MAKE} ${MAKE} clean
-cd pics && MAKE=${MAKE} ${MAKE} clean
 
#\zipup the project (take that!)
no_oops: clean
cd .. ; cvs commit
echo Scanning for scratch/dirty files
find . -type f | grep -v CVS | xargs -n 1 bash mess.sh
.PHONY: pre_gen
pre_gen:
perl gen.pl
sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
rm mpi.c
 
zipup:
rm -rf ../libtommath-$(VERSION) \
&& rm -f ../ltm-$(VERSION).zip ../ltm-$(VERSION).zip.asc ../ltm-$(VERSION).tar.xz ../ltm-$(VERSION).tar.xz.asc
git archive HEAD --prefix=libtommath-$(VERSION)/ > ../libtommath-$(VERSION).tar
cd .. ; tar xf libtommath-$(VERSION).tar
MAKE=${MAKE} ${MAKE} -C ../libtommath-$(VERSION) clean manual poster docs
tar -c ../libtommath-$(VERSION)/* | xz -9 > ../ltm-$(VERSION).tar.xz
find ../libtommath-$(VERSION)/ -type f -exec unix2dos -q {} \;
cd .. ; zip -9r ltm-$(VERSION).zip libtommath-$(VERSION)
gpg -b -a ../ltm-$(VERSION).tar.xz && gpg -b -a ../ltm-$(VERSION).zip
zipup: clean pre_gen new_file manual poster docs
@# Update the index, so diff-index won't fail in case the pdf has been created.
@# As the pdf creation modifies the tex files, git sometimes detects the
@# modified files, but misses that it's put back to its original version.
@git update-index --refresh
@git diff-index --quiet HEAD -- || ( echo "FAILURE: uncommited changes or not a git" && exit 1 )
rm -rf libtommath-$(VERSION) ltm-$(VERSION).*
@# files/dirs excluded from "git archive" are defined in .gitattributes
git archive --format=tar --prefix=libtommath-$(VERSION)/ HEAD | tar x
mkdir -p libtommath-$(VERSION)/doc
cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/
tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz
zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION)
rm -rf libtommath-$(VERSION)
gpg -b -a ltm-$(VERSION).tar.xz
gpg -b -a ltm-$(VERSION).zip
 
new_file:
bash updatemakes.sh
perl dep.pl
perlcritic:
perlcritic *.pl
[![Build Status](https://travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath)
[![Build Status - master](https://travis-ci.org/libtom/libtommath.png?branch=master)](https://travis-ci.org/libtom/libtommath)
[![Build Status - develop](https://travis-ci.org/libtom/libtommath.png?branch=develop)](https://travis-ci.org/libtom/libtommath)
 
This is the git repository for [LibTomMath](http://www.libtom.org/), a free open source portable number theoretic multiple-precision integer (MPI) library written entirely in C.
 
Loading
Loading
Loading
Loading
@@ -42,6 +42,6 @@ const char *mp_error_to_string(int code)
 
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -143,6 +143,6 @@ LBL_ERR:mp_clear_multi (&x, &y, &u, &v, &B, &D, NULL);
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -167,6 +167,6 @@ int fast_mp_montgomery_reduce (mp_int * x, mp_int * n, mp_digit rho)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -102,6 +102,6 @@ int fast_s_mp_mul_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -93,6 +93,6 @@ int fast_s_mp_mul_high_digs (mp_int * a, mp_int * b, mp_int * c, int digs)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -109,6 +109,6 @@ int fast_s_mp_sqr (mp_int * a, mp_int * b)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -43,6 +43,6 @@ mp_2expt (mp_int * a, int b)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -38,6 +38,6 @@ mp_abs (mp_int * a, mp_int * b)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -48,6 +48,6 @@ int mp_add (mp_int * a, mp_int * b, mp_int * c)
 
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -49,9 +49,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
/* old number of used digits in c */
oldused = c->used;
 
/* sign always positive */
c->sign = MP_ZPOS;
/* source alias */
tmpa = a->dp;
 
Loading
Loading
@@ -96,6 +93,9 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
ix = 1;
}
 
/* sign always positive */
c->sign = MP_ZPOS;
/* now zero to oldused */
while (ix++ < oldused) {
*tmpc++ = 0;
Loading
Loading
@@ -107,6 +107,6 @@ mp_add_d (mp_int * a, mp_digit b, mp_int * c)
 
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -36,6 +36,6 @@ mp_addmod (mp_int * a, mp_int * b, mp_int * c, mp_int * d)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -52,6 +52,6 @@ mp_and (mp_int * a, mp_int * b, mp_int * c)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -39,6 +39,6 @@ mp_clamp (mp_int * a)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -36,6 +36,6 @@ mp_clear (mp_int * a)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -29,6 +29,6 @@ void mp_clear_multi(mp_int *mp, ...)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -38,6 +38,6 @@ mp_cmp (mp_int * a, mp_int * b)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -39,6 +39,6 @@ int mp_cmp_d(mp_int * a, mp_digit b)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
Loading
Loading
@@ -50,6 +50,6 @@ int mp_cmp_mag (mp_int * a, mp_int * b)
}
#endif
 
/* $Source$ */
/* $Revision$ */
/* $Date$ */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment