v1.2.0
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Gnu Privacy Tools iF4EABEIAAYFAl2uz5oACgkQrwyxdiHtrXLIngD/WoeRRt9sYkjNiSmiKYuBvgAi pF0Sdfe7vAAhY3jpRX0A/2rJdJFGiFiuAB72qWiGJZg0Rr+kbOGwKfvYgE6jROw6 =EL7p -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Gnu Privacy Tools iF4EABEIAAYFAl2u0EEACgkQrwyxdiHtrXIQkQD+I8Z6IYTtVmG0patanpT1EFyA SZUKP2z50owej4uF3QAA/32m1dmpG6MSYhfu9zu4435PwaI+RgCaUrZ1YaoWroXJ =agqw -----END PGP SIGNATURE----- Merge tag 'v1.2.0' into develop v1.2.0
This commit is contained in:
commit
d06e2986ca
@ -1,4 +1,4 @@
|
||||
version: 1.1.0-{build}
|
||||
version: 1.2.0-{build}
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
@ -6,10 +6,12 @@ branches:
|
||||
- /^release/
|
||||
- /^travis/
|
||||
image:
|
||||
- Visual Studio 2019
|
||||
- Visual Studio 2017
|
||||
- Visual Studio 2015
|
||||
build_script:
|
||||
- cmd: >-
|
||||
if "Visual Studio 2019"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
if "Visual Studio 2017"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
|
||||
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
|
||||
if "Visual Studio 2015"=="%APPVEYOR_BUILD_WORKER_IMAGE%" call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86_amd64
|
||||
|
37
changes.txt
37
changes.txt
@ -1,3 +1,40 @@
|
||||
XXX XXth, 2019
|
||||
v1.2.0
|
||||
-- A huge refactoring of the library happened - renaming,
|
||||
deprecating and replacing existing functions by improved API's.
|
||||
|
||||
All deprecated functions, macros and symbols are only marked as such
|
||||
so this version is still API and ABI compatible to v1.x.
|
||||
|
||||
-- Daniel Mendler was pushing for those changes and contributing a load of patches,
|
||||
refactorings, code reviews and whatnotelse.
|
||||
-- Christoph Zurnieden re-worked internals of the library, improved the performance,
|
||||
did code reviews and wrote documentation.
|
||||
-- Francois Perrad did some refactoring and took again care of linting the sources and
|
||||
provided all fixes.
|
||||
-- Jan Nijtmans, Karel Miko and Joachim Breitner contributed various patches.
|
||||
|
||||
-- Private symbols can now be hidden for the shared library builds, disabled by default.
|
||||
-- All API's follow a single code style, are prefixed the same etc.
|
||||
-- Unified, safer and improved API's
|
||||
-- Less magic numbers - return values (where appropriate) and most flags are now enums,
|
||||
this was implemented in a backwards compatible way where return values were int.
|
||||
-- API's with return values are now by default marked as "warn on unsused result", this
|
||||
can be disabled if required (which will most likely hide bugs), c.f. MP_WUR in tommath.h
|
||||
-- Provide a whole set of setters&getters for different primitive types (long, uint32_t, etc.)
|
||||
-- All those primitive setters are now optimized.
|
||||
-- It's possible to automatically tune the cutoff values for Karatsuba&Toom-Cook
|
||||
-- The custom allocators which were formerly known as XMALLOC(), XFREE() etc. are now available
|
||||
as MP_MALLOC(), MP_REALLOC(), MP_CALLOC() and MP_FREE(). MP_REALLOC() and MP_FREE() now also
|
||||
provide the allocated size to ease the usage of simple allocators without tracking.
|
||||
-- Building is now also possible with MSVC 2015, 2017 and 2019 (use makefile.msvc)
|
||||
-- Added mp_decr() and mp_incr()
|
||||
-- Added mp_log_u32()
|
||||
-- Improved prime-checking
|
||||
-- Improved Toom-Cook multiplication
|
||||
-- Removed the LTM book (`make docs` now builds the user manual)
|
||||
|
||||
|
||||
Jan 28th, 2019
|
||||
v1.1.0
|
||||
-- Christoph Zurnieden contributed FIPS 186.4 compliant
|
||||
|
20
doc/bn.tex
20
doc/bn.tex
@ -50,7 +50,7 @@
|
||||
\begin{document}
|
||||
\frontmatter
|
||||
\pagestyle{empty}
|
||||
\title{LibTomMath User Manual \\ v1.1.0}
|
||||
\title{LibTomMath User Manual \\ v1.2.0}
|
||||
\author{LibTom Projects \\ www.libtom.net}
|
||||
\maketitle
|
||||
This text, the library and the accompanying textbook are all hereby placed in the public domain. This book has been
|
||||
@ -825,7 +825,8 @@ int main(void)
|
||||
|
||||
These functions can be used to set a constant with 32 or 64 bits.
|
||||
|
||||
\index{mp\_set\_int}
|
||||
\index{mp\_set\_i32} \index{mp\_set\_u32}
|
||||
\index{mp\_set\_i64} \index{mp\_set\_u64}
|
||||
\begin{alltt}
|
||||
void mp_set_i32 (mp_int * a, int32_t b);
|
||||
void mp_set_u32 (mp_int * a, uint32_t b);
|
||||
@ -836,7 +837,8 @@ void mp_set_u64 (mp_int * a, uint64_t b);
|
||||
These functions assign the sign and value of the input \texttt{b} to \texttt{mp\_int a}.
|
||||
The value can be obtained again by calling the following functions.
|
||||
|
||||
\index{mp\_get\_int}
|
||||
\index{mp\_get\_i32} \index{mp\_get\_u32} \index{mp\_get\_mag\_u32}
|
||||
\index{mp\_get\_i64} \index{mp\_get\_u64} \index{mp\_get\_mag\_u64}
|
||||
\begin{alltt}
|
||||
int32_t mp_get_i32 (mp_int * a);
|
||||
uint32_t mp_get_u32 (mp_int * a);
|
||||
@ -881,7 +883,7 @@ number == 654321
|
||||
|
||||
\subsection{Long Constants - platform dependant}
|
||||
|
||||
\index{mp\_set\_ulong}
|
||||
\index{mp\_set\_l} \index{mp\_set\_ul}
|
||||
\begin{alltt}
|
||||
void mp_set_l (mp_int * a, long b);
|
||||
void mp_set_ul (mp_int * a, unsigned long b);
|
||||
@ -891,7 +893,7 @@ This will assign the value of the platform-dependent sized variable $b$ to the m
|
||||
|
||||
To retrieve the value, the following functions can be used.
|
||||
|
||||
\index{mp\_get\_ulong}
|
||||
\index{mp\_get\_l} \index{mp\_get\_ul} \index{mp\_get\_mag\_ul}
|
||||
\begin{alltt}
|
||||
long mp_get_l (mp_int * a);
|
||||
unsigned long mp_get_ul (mp_int * a);
|
||||
@ -902,7 +904,7 @@ This will return the least significant bits of the mp\_int $a$ that fit into a `
|
||||
|
||||
\subsection{Long Long Constants - platform dependant}
|
||||
|
||||
\index{mp\_set\_ulonglong}
|
||||
\index{mp\_set\_ll} \index{mp\_set\_ull}
|
||||
\begin{alltt}
|
||||
void mp_set_ll (mp_int * a, long long b);
|
||||
void mp_set_ull (mp_int * a, unsigned long long b);
|
||||
@ -912,7 +914,9 @@ This will assign the value of the platform-dependent sized variable $b$ to the m
|
||||
|
||||
To retrieve the value, the following functions can be used.
|
||||
|
||||
\index{mp\_get\_ulonglong}
|
||||
\index{mp\_get\_ll}
|
||||
\index{mp\_get\_ull}
|
||||
\index{mp\_get\_mag\_ull}
|
||||
\begin{alltt}
|
||||
long long mp_get_ll (mp_int * a);
|
||||
unsigned long long mp_get_ull (mp_int * a);
|
||||
@ -2073,7 +2077,7 @@ mp\_prime\_is\_prime for details regarding the use of the argument $t$. Set $bb
|
||||
want only the next prime congruent to $3 \mbox{ mod } 4$, otherwise set it to zero to find any next prime.
|
||||
|
||||
\section{Random Primes}
|
||||
\index{mp\_prime\_random\_ex}
|
||||
\index{mp\_prime\_rand}
|
||||
\begin{alltt}
|
||||
int mp_prime_rand(mp_int *a, int t,
|
||||
int size, int flags);
|
||||
|
296
doc/booker.pl
296
doc/booker.pl
@ -1,296 +0,0 @@
|
||||
#!/bin/perl
|
||||
#
|
||||
#Used to prepare the book "tommath.src" for LaTeX by pre-processing it into a .tex file
|
||||
#
|
||||
#Essentially you write the "tommath.src" as normal LaTex except where you want code snippets you put
|
||||
#
|
||||
#EXAM,file
|
||||
#
|
||||
#This preprocessor will then open "file" and insert it as a verbatim copy.
|
||||
#
|
||||
#Tom St Denis
|
||||
use strict;
|
||||
|
||||
#get graphics type
|
||||
my $graph;
|
||||
if (shift =~ /PDF/) {
|
||||
$graph = "";
|
||||
} else {
|
||||
$graph = ".ps";
|
||||
}
|
||||
|
||||
open(my $in, '<', 'tommath.src') or die "Can't open source file";
|
||||
open(my $out, '>', 'tommath.tex') or die "Can't open destination file";
|
||||
|
||||
print "Scanning for sections\n";
|
||||
my $chapter = 0;
|
||||
my $section = 0;
|
||||
my $subsection = 0;
|
||||
my $x = 0;
|
||||
my %index1;
|
||||
my %index2;
|
||||
my %index3;
|
||||
while (<$in>) {
|
||||
print ".";
|
||||
if (!(++$x % 80)) { print "\n"; }
|
||||
#update the headings
|
||||
if (~($_ =~ /\*/)) {
|
||||
if ($_ =~ /\\chapter\{.+}/) {
|
||||
++$chapter;
|
||||
$section = $subsection = 0;
|
||||
} elsif ($_ =~ /\\section\{.+}/) {
|
||||
++$section;
|
||||
$subsection = 0;
|
||||
} elsif ($_ =~ /\\subsection\{.+}/) {
|
||||
++$subsection;
|
||||
}
|
||||
}
|
||||
|
||||
if ($_ =~ m/MARK/) {
|
||||
my @m = split ',', $_;
|
||||
chomp $m[1];
|
||||
$index1{$m[1]} = $chapter;
|
||||
$index2{$m[1]} = $section;
|
||||
$index3{$m[1]} = $subsection;
|
||||
}
|
||||
}
|
||||
close $in;
|
||||
|
||||
open($in, '<', 'tommath.src') or die "Can't open source file";
|
||||
my $readline = 0;
|
||||
my $wroteline = 0;
|
||||
my $srcline = 0;
|
||||
my $totlines;
|
||||
my @text;
|
||||
|
||||
while (<$in>) {
|
||||
++$readline;
|
||||
++$srcline;
|
||||
|
||||
if ($_ =~ m/MARK/) {
|
||||
} elsif ($_ =~ m/EXAM/ || $_ =~ m/LIST/) {
|
||||
my $skipheader;
|
||||
if ($_ =~ m/EXAM/) {
|
||||
$skipheader = 1;
|
||||
} else {
|
||||
$skipheader = 0;
|
||||
}
|
||||
|
||||
# EXAM,file
|
||||
chomp($_);
|
||||
my @m = split ',', $_;
|
||||
open(my $src, '<', "../$m[1]") or die "Error:$srcline:Can't open source file $m[1]";
|
||||
|
||||
print "$srcline:Inserting $m[1]:";
|
||||
|
||||
my $line = 0;
|
||||
my $tmp = $m[1];
|
||||
my $fun = $tmp;
|
||||
$tmp =~ s/_/"\\_"/ge;
|
||||
$fun =~ s/^bn_//;
|
||||
$fun =~ s/\.c$//;
|
||||
$fun =~ s/_/"\\_"/ge;
|
||||
print {$out} "\\index{$fun}\\vspace{+3mm}\\begin{small}\n\\hspace{-5.1mm}{\\bf File}: $tmp\n\\vspace{-3mm}\n\\begin{alltt}\n";
|
||||
$wroteline += 5;
|
||||
|
||||
if ($skipheader == 1) {
|
||||
# scan till next end of comment, e.g. skip license
|
||||
while (<$src>) {
|
||||
if ($_ =~ /#ifdef BN/) {
|
||||
printf {$out} ("%03d ", $line);
|
||||
for ($x = 0; $x < length($_); $x++) {
|
||||
print {$out} chr(vec($_, $x, 8));
|
||||
if ($x == 75) {
|
||||
print {$out} "\n ";
|
||||
++$wroteline;
|
||||
}
|
||||
}
|
||||
print {$out} "...\n";
|
||||
++$wroteline;
|
||||
}
|
||||
$text[$line++] = $_;
|
||||
last if ($_ =~ /libtom\.org/);
|
||||
}
|
||||
<$src>;
|
||||
$text[$line++] = $_;
|
||||
<$src>;
|
||||
$text[$line++] = $_;
|
||||
}
|
||||
|
||||
my $inline = 0;
|
||||
while (<$src>) {
|
||||
$text[$line++] = $_;
|
||||
++$inline;
|
||||
chomp($_);
|
||||
$_ =~ s/\t/" "/ge;
|
||||
$_ =~ s/{/"^{"/ge;
|
||||
$_ =~ s/}/"^}"/ge;
|
||||
$_ =~ s/\\/'\symbol{92}'/ge;
|
||||
$_ =~ s/\^/"\\"/ge;
|
||||
|
||||
printf {$out} ("%03d ", $line);
|
||||
for ($x = 0; $x < length($_); $x++) {
|
||||
print {$out} chr(vec($_, $x, 8));
|
||||
if ($x == 75) {
|
||||
print {$out} "\n ";
|
||||
++$wroteline;
|
||||
}
|
||||
}
|
||||
print {$out} "\n";
|
||||
++$wroteline;
|
||||
}
|
||||
$totlines = $line;
|
||||
print {$out} "\\end{alltt}\n\\end{small}\n";
|
||||
close $src;
|
||||
print "$inline lines\n";
|
||||
$wroteline += 2;
|
||||
} elsif ($_ =~ m/@\d+,.+@/) {
|
||||
# line contains [number,text]
|
||||
# e.g. @14,for (ix = 0)@
|
||||
my $txt = $_;
|
||||
while ($txt =~ m/@\d+,.+@/) {
|
||||
my @m = split '@', $txt; # splits into text, one, two
|
||||
my @parms = split ',', $m[1]; # splits one,two into two elements
|
||||
|
||||
# now search from $parms[0] down for $parms[1]
|
||||
my $found;
|
||||
my $found1 = 0;
|
||||
my $found2 = 0;
|
||||
my $foundline;
|
||||
my $foundline1;
|
||||
my $foundline2;
|
||||
for (my $i = $parms[0]; $i < $totlines && $found1 == 0; $i++) {
|
||||
if ($text[$i] =~ m/\Q$parms[1]\E/) {
|
||||
$foundline1 = $i + 1;
|
||||
$found1 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# now search backwards
|
||||
for (my $i = $parms[0] - 1; $i >= 0 && $found2 == 0; $i--) {
|
||||
if ($text[$i] =~ m/\Q$parms[1]\E/) {
|
||||
$foundline2 = $i + 1;
|
||||
$found2 = 1;
|
||||
}
|
||||
}
|
||||
|
||||
# now use the closest match or the first if tied
|
||||
if ($found1 == 1 && $found2 == 0) {
|
||||
$found = 1;
|
||||
$foundline = $foundline1;
|
||||
} elsif ($found1 == 0 && $found2 == 1) {
|
||||
$found = 1;
|
||||
$foundline = $foundline2;
|
||||
} elsif ($found1 == 1 && $found2 == 1) {
|
||||
$found = 1;
|
||||
if (($foundline1 - $parms[0]) <= ($parms[0] - $foundline2)) {
|
||||
$foundline = $foundline1;
|
||||
} else {
|
||||
$foundline = $foundline2;
|
||||
}
|
||||
} else {
|
||||
$found = 0;
|
||||
}
|
||||
|
||||
# if found replace
|
||||
if ($found == 1) {
|
||||
my $delta = $parms[0] - $foundline;
|
||||
print "Found replacement tag for \"$parms[1]\" on line $srcline which refers to line $foundline (delta $delta)\n";
|
||||
$_ =~ s/@\Q$m[1]\E@/$foundline/;
|
||||
} else {
|
||||
print "ERROR: The tag \"$parms[1]\" on line $srcline was not found in the most recently parsed source!\n";
|
||||
}
|
||||
|
||||
# remake the rest of the line
|
||||
$txt = "";
|
||||
for (my $i = 2; $i < scalar(@m); $i++) {
|
||||
$txt = $txt . $m[$i] . "@";
|
||||
}
|
||||
}
|
||||
print {$out} $_;
|
||||
++$wroteline;
|
||||
} elsif ($_ =~ /~.+~/) {
|
||||
# line contains a ~text~ pair used to refer to indexing :-)
|
||||
my $txt = $_;
|
||||
while ($txt =~ /~.+~/) {
|
||||
my @m = split '~', $txt;
|
||||
|
||||
# word is the second position
|
||||
my $word = $m[1];
|
||||
my $a = $index1{$word};
|
||||
my $b = $index2{$word};
|
||||
my $c = $index3{$word};
|
||||
|
||||
# if chapter (a) is zero it wasn't found
|
||||
if ($a == 0) {
|
||||
print "ERROR: the tag \"$word\" on line $srcline was not found previously marked.\n";
|
||||
} else {
|
||||
# format the tag as x, x.y or x.y.z depending on the values
|
||||
my $str = $a;
|
||||
$str = $str . ".$b" if ($b != 0);
|
||||
$str = $str . ".$c" if ($c != 0);
|
||||
|
||||
if ($b == 0 && $c == 0) {
|
||||
# its a chapter
|
||||
if ($a <= 10) {
|
||||
if ($a == 1) {
|
||||
$str = "chapter one";
|
||||
} elsif ($a == 2) {
|
||||
$str = "chapter two";
|
||||
} elsif ($a == 3) {
|
||||
$str = "chapter three";
|
||||
} elsif ($a == 4) {
|
||||
$str = "chapter four";
|
||||
} elsif ($a == 5) {
|
||||
$str = "chapter five";
|
||||
} elsif ($a == 6) {
|
||||
$str = "chapter six";
|
||||
} elsif ($a == 7) {
|
||||
$str = "chapter seven";
|
||||
} elsif ($a == 8) {
|
||||
$str = "chapter eight";
|
||||
} elsif ($a == 9) {
|
||||
$str = "chapter nine";
|
||||
} elsif ($a == 10) {
|
||||
$str = "chapter ten";
|
||||
}
|
||||
} else {
|
||||
$str = "chapter " . $str;
|
||||
}
|
||||
} else {
|
||||
$str = "section " . $str if ($b != 0 && $c == 0);
|
||||
$str = "sub-section " . $str if ($b != 0 && $c != 0);
|
||||
}
|
||||
|
||||
#substitute
|
||||
$_ =~ s/~\Q$word\E~/$str/;
|
||||
|
||||
print "Found replacement tag for marker \"$word\" on line $srcline which refers to $str\n";
|
||||
}
|
||||
|
||||
# remake rest of the line
|
||||
$txt = "";
|
||||
for (my $i = 2; $i < scalar(@m); $i++) {
|
||||
$txt = $txt . $m[$i] . "~";
|
||||
}
|
||||
}
|
||||
print {$out} $_;
|
||||
++$wroteline;
|
||||
} elsif ($_ =~ m/FIGU/) {
|
||||
# FIGU,file,caption
|
||||
chomp($_);
|
||||
my @m = split ',', $_;
|
||||
print {$out} "\\begin{center}\n\\begin{figure}[h]\n\\includegraphics{pics/$m[1]$graph}\n";
|
||||
print {$out} "\\caption{$m[2]}\n\\label{pic:$m[1]}\n\\end{figure}\n\\end{center}\n";
|
||||
$wroteline += 4;
|
||||
} else {
|
||||
print {$out} $_;
|
||||
++$wroteline;
|
||||
}
|
||||
}
|
||||
print "Read $readline lines, wrote $wroteline lines\n";
|
||||
|
||||
close $out;
|
||||
close $in;
|
||||
|
||||
system('perl -pli -e "s/\s*$//" tommath.tex');
|
36
doc/makefile
36
doc/makefile
@ -9,41 +9,10 @@ ifeq ($(PLATFORM), Darwin)
|
||||
err:
|
||||
$(error Docs can't be built on Mac)
|
||||
|
||||
docdvi poster docs mandvi manual: err
|
||||
docs mandvi manual: err
|
||||
endif
|
||||
|
||||
# makes the LTM book DVI file, requires tetex, perl and makeindex [part of tetex I think]
|
||||
docdvi: tommath.src
|
||||
${MAKE} -C pics/ MAKE=${MAKE}
|
||||
echo "hello" ${silent_stdout}
|
||||
perl booker.pl
|
||||
touch tommath.ind
|
||||
latex tommath ${silent_stdout}
|
||||
latex tommath ${silent_stdout}
|
||||
makeindex tommath
|
||||
latex tommath ${silent_stdout}
|
||||
|
||||
# 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
|
||||
${MAKE} -C pics/ clean MAKE=${MAKE}
|
||||
docs: manual
|
||||
|
||||
#LTM user manual
|
||||
mandvi: bn.tex
|
||||
@ -70,5 +39,4 @@ manual: mandvi
|
||||
rm -f bn.aux bn.dvi bn.log bn.idx bn.lof bn.out bn.toc
|
||||
|
||||
clean:
|
||||
${MAKE} -C pics/ clean MAKE=${MAKE}
|
||||
rm -f *.idx *.toc *.log *.aux *.dvi *.lof *.ind *.ilg *.ps *.log tommath.tex
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,35 +0,0 @@
|
||||
# makes the images... yeah
|
||||
|
||||
default: pses
|
||||
|
||||
design_process.ps: design_process.tif
|
||||
tiff2ps -s -e design_process.tif > design_process.ps
|
||||
|
||||
sliding_window.ps: sliding_window.tif
|
||||
tiff2ps -s -e sliding_window.tif > sliding_window.ps
|
||||
|
||||
expt_state.ps: expt_state.tif
|
||||
tiff2ps -s -e expt_state.tif > expt_state.ps
|
||||
|
||||
primality.ps: primality.tif
|
||||
tiff2ps -s -e primality.tif > primality.ps
|
||||
|
||||
design_process.pdf: design_process.ps
|
||||
epstopdf design_process.ps
|
||||
|
||||
sliding_window.pdf: sliding_window.ps
|
||||
epstopdf sliding_window.ps
|
||||
|
||||
expt_state.pdf: expt_state.ps
|
||||
epstopdf expt_state.ps
|
||||
|
||||
primality.pdf: primality.ps
|
||||
epstopdf primality.ps
|
||||
|
||||
|
||||
pses: sliding_window.ps expt_state.ps primality.ps design_process.ps
|
||||
pdfes: sliding_window.pdf expt_state.pdf primality.pdf design_process.pdf
|
||||
|
||||
clean:
|
||||
rm -rf *.ps *.pdf .xvpics
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,35 +0,0 @@
|
||||
\documentclass[landscape,11pt]{article}
|
||||
\usepackage{amsmath, amssymb}
|
||||
\usepackage{hyperref}
|
||||
\begin{document}
|
||||
\hspace*{-3in}
|
||||
\begin{tabular}{llllll}
|
||||
$c = a + b$ & {\tt mp\_add(\&a, \&b, \&c)} & $b = 2a$ & {\tt mp\_mul\_2(\&a, \&b)} & \\
|
||||
$c = a - b$ & {\tt mp\_sub(\&a, \&b, \&c)} & $b = a/2$ & {\tt mp\_div\_2(\&a, \&b)} & \\
|
||||
$c = ab $ & {\tt mp\_mul(\&a, \&b, \&c)} & $c = 2^ba$ & {\tt mp\_mul\_2d(\&a, b, \&c)} \\
|
||||
$b = a^2 $ & {\tt mp\_sqr(\&a, \&b)} & $c = a/2^b, d = a \mod 2^b$ & {\tt mp\_div\_2d(\&a, b, \&c, \&d)} \\
|
||||
$c = \lfloor a/b \rfloor, d = a \mod b$ & {\tt mp\_div(\&a, \&b, \&c, \&d)} & $c = a \mod 2^b $ & {\tt mp\_mod\_2d(\&a, b, \&c)} \\
|
||||
&& \\
|
||||
$a = b $ & {\tt mp\_set\_int(\&a, b)} & $c = a \vee b$ & {\tt mp\_or(\&a, \&b, \&c)} \\
|
||||
$b = a $ & {\tt mp\_copy(\&a, \&b)} & $c = a \wedge b$ & {\tt mp\_and(\&a, \&b, \&c)} \\
|
||||
&& $c = a \oplus b$ & {\tt mp\_xor(\&a, \&b, \&c)} \\
|
||||
& \\
|
||||
$b = -a $ & {\tt mp\_neg(\&a, \&b)} & $d = a + b \mod c$ & {\tt mp\_addmod(\&a, \&b, \&c, \&d)} \\
|
||||
$b = |a| $ & {\tt mp\_abs(\&a, \&b)} & $d = a - b \mod c$ & {\tt mp\_submod(\&a, \&b, \&c, \&d)} \\
|
||||
&& $d = ab \mod c$ & {\tt mp\_mulmod(\&a, \&b, \&c, \&d)} \\
|
||||
Compare $a$ and $b$ & {\tt mp\_cmp(\&a, \&b)} & $c = a^2 \mod b$ & {\tt mp\_sqrmod(\&a, \&b, \&c)} \\
|
||||
Is Zero? & {\tt mp\_iszero(\&a)} & $c = a^{-1} \mod b$ & {\tt mp\_invmod(\&a, \&b, \&c)} \\
|
||||
Is Even? & {\tt mp\_iseven(\&a)} & $d = a^b \mod c$ & {\tt mp\_exptmod(\&a, \&b, \&c, \&d)} \\
|
||||
Is Odd ? & {\tt mp\_isodd(\&a)} \\
|
||||
&\\
|
||||
$\vert \vert a \vert \vert$ & {\tt mp\_unsigned\_bin\_size(\&a)} & $res$ = 1 if $a$ prime to $t$ rounds? & {\tt mp\_prime\_is\_prime(\&a, t, \&res)} \\
|
||||
$buf \leftarrow a$ & {\tt mp\_to\_unsigned\_bin(\&a, buf)} & Next prime after $a$ to $t$ rounds. & {\tt mp\_prime\_next\_prime(\&a, t, bbs\_style)} \\
|
||||
$a \leftarrow buf[0..len-1]$ & {\tt mp\_read\_unsigned\_bin(\&a, buf, len)} \\
|
||||
&\\
|
||||
$b = \sqrt{a}$ & {\tt mp\_sqrt(\&a, \&b)} & $c = \mbox{gcd}(a, b)$ & {\tt mp\_gcd(\&a, \&b, \&c)} \\
|
||||
$c = a^{1/b}$ & {\tt mp\_n\_root(\&a, b, \&c)} & $c = \mbox{lcm}(a, b)$ & {\tt mp\_lcm(\&a, \&b, \&c)} \\
|
||||
&\\
|
||||
Greater Than & MP\_GT & Equal To & MP\_EQ \\
|
||||
Less Than & MP\_LT & Bits per digit & DIGIT\_BIT \\
|
||||
\end{tabular}
|
||||
\end{document}
|
6350
doc/tommath.src
6350
doc/tommath.src
File diff suppressed because it is too large
Load Diff
7
makefile
7
makefile
@ -115,7 +115,7 @@ tune: $(LIBNAME)
|
||||
coveralls: lcov
|
||||
coveralls-lcov
|
||||
|
||||
docdvi poster docs mandvi manual:
|
||||
docs manual:
|
||||
$(MAKE) -C doc/ $@ V=$(V)
|
||||
|
||||
.PHONY: pre_gen
|
||||
@ -125,7 +125,7 @@ pre_gen:
|
||||
sed -e 's/[[:blank:]]*$$//' mpi.c > pre_gen/mpi.c
|
||||
rm mpi.c
|
||||
|
||||
zipup: clean astyle new_file manual poster docs
|
||||
zipup: clean astyle new_file 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.
|
||||
@ -137,12 +137,11 @@ zipup: clean astyle new_file manual poster docs
|
||||
@echo 'fixme check'
|
||||
-@(find libtommath-$(VERSION)/ -type f | xargs grep 'FIXM[E]') && echo '############## BEWARE: the "fixme" marker was found !!! ##############' || true
|
||||
mkdir -p libtommath-$(VERSION)/doc
|
||||
cp doc/bn.pdf doc/tommath.pdf doc/poster.pdf libtommath-$(VERSION)/doc/
|
||||
cp doc/bn.pdf libtommath-$(VERSION)/doc/
|
||||
$(MAKE) -C libtommath-$(VERSION)/ pre_gen
|
||||
tar -c libtommath-$(VERSION)/ | xz -6e -c - > ltm-$(VERSION).tar.xz
|
||||
zip -9rq ltm-$(VERSION).zip libtommath-$(VERSION)
|
||||
cp doc/bn.pdf bn-$(VERSION).pdf
|
||||
cp doc/tommath.pdf tommath-$(VERSION).pdf
|
||||
rm -rf libtommath-$(VERSION)
|
||||
gpg -b -a ltm-$(VERSION).tar.xz
|
||||
gpg -b -a ltm-$(VERSION).zip
|
||||
|
@ -14,7 +14,7 @@ PREFIX = c:\devel
|
||||
CFLAGS = /Ox
|
||||
|
||||
#Compilation flags
|
||||
LTM_CFLAGS = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D__STDC_WANT_SECURE_LIB__=1 /D_CRT_HAS_CXX17=0 /Wall /wd4146 /wd4127 /wd4710 /wd4711 /wd4820 /wd4003 /WX $(CFLAGS)
|
||||
LTM_CFLAGS = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /D__STDC_WANT_SECURE_LIB__=1 /D_CRT_HAS_CXX17=0 /Wall /wd4146 /wd4127 /wd4668 /wd4710 /wd4711 /wd4820 /wd5045 /WX $(CFLAGS)
|
||||
LTM_LDFLAGS = advapi32.lib
|
||||
|
||||
#Libraries to be created (this makefile builds only static libraries)
|
||||
|
@ -21,7 +21,7 @@ RANLIB = ranlib
|
||||
CFLAGS = -O2
|
||||
LDFLAGS =
|
||||
|
||||
VERSION = 1.1.0
|
||||
VERSION = 1.2.0
|
||||
|
||||
#Compilation flags
|
||||
LTM_CFLAGS = -I. $(CFLAGS)
|
||||
|
@ -3,9 +3,9 @@
|
||||
#
|
||||
|
||||
#version of library
|
||||
VERSION=1.1.0-develop
|
||||
VERSION_PC=1.1.0
|
||||
VERSION_SO=2:0:1
|
||||
VERSION=1.2.0
|
||||
VERSION_PC=1.2.0
|
||||
VERSION_SO=3:0:2
|
||||
|
||||
PLATFORM := $(shell uname | sed -e 's/_.*//')
|
||||
|
||||
|
@ -494,7 +494,7 @@ void mp_set(mp_int *mp, mp_digit d)
|
||||
mp_err mp_set_int(mp_int *mp, long z)
|
||||
{
|
||||
int ix;
|
||||
unsigned long v = abs(z);
|
||||
unsigned long v = labs(z);
|
||||
mp_err res;
|
||||
|
||||
ARGCHK(mp != NULL, MP_BADARG);
|
||||
|
@ -27,16 +27,9 @@ static mp_err s_read_arc4random(void *p, size_t n)
|
||||
#define ARM
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning (disable : 4668)
|
||||
#endif
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
static mp_err s_read_wincsp(void *p, size_t n)
|
||||
{
|
||||
|
@ -140,6 +140,10 @@ extern void MP_FREE(void *mem, size_t size);
|
||||
#endif
|
||||
|
||||
/* feature detection macro */
|
||||
#ifdef _MSC_VER
|
||||
/* Prevent false positive: not enough arguments for function-like macro invocation */
|
||||
#pragma warning(disable: 4003)
|
||||
#endif
|
||||
#define MP_STRINGIZE(x) MP__STRINGIZE(x)
|
||||
#define MP__STRINGIZE(x) ""#x""
|
||||
#define MP_HAS(x) (sizeof(MP_STRINGIZE(x##_C)) == 1u)
|
||||
|
Loading…
Reference in New Issue
Block a user