Skip to content

Commit 7a68f12

Browse files
committed
Execute move.sh - Rename files from bn_* to match the function names.
* git blame <renamed-file> is not affected * git log --follow <renamed-file> can be used to show log across renames
1 parent de48463 commit 7a68f12

File tree

173 files changed

+1635
-1701
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+1635
-1701
lines changed

demo/test.c

Lines changed: 116 additions & 116 deletions
Large diffs are not rendered by default.

doc/bn.tex

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ \subsubsection{OpenBSD}
174174
cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo...
175175
cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo...
176176
cc -I./ -Wall -Wsign-compare -Wextra -Wshadow -Wsystem-headers -Wdeclaration-afo...
177-
libtool --mode=link --tag=CC cc bn_error.lo bn_s_mp_invmod_fast.lo bn_fast_mp_mo
178-
libtool: link: cc bn_error.lo bn_s_mp_invmod_fast.lo bn_s_mp_montgomery_reduce_fast0
179-
bn_error.lo: file not recognized: File format not recognized
177+
libtool --mode=link --tag=CC cc error.lo s_mp_invmod_fast.lo fast_mp_mo
178+
libtool: link: cc error.lo s_mp_invmod_fast.lo s_mp_montgomery_reduce_fast0
179+
error.lo: file not recognized: File format not recognized
180180
cc: error: linker command failed with exit code 1 (use -v to see invocation)
181-
Error while executing cc bn_error.lo bn_s_mp_invmod_fast.lo bn_fast_mp_montgomery0
181+
Error while executing cc error.lo s_mp_invmod_fast.lo fast_mp_montgomery0
182182
gmake: *** [makefile.shared:64: libtommath.la] Error 1
183183
\end{alltt}
184184

@@ -259,7 +259,7 @@ \section{Build Configuration}
259259
\subsection{Build Depends}
260260
In the file tommath\_class.h you will see a large list of C ``defines'' followed by a series of ``ifdefs''
261261
which further define symbols. All of the symbols (technically they're macros $\ldots$) represent a given C source
262-
file. For instance, BN\_MP\_ADD\_C represents the file ``bn\_mp\_add.c''. When a define has been enabled the
262+
file. For instance, MP\_ADD\_C represents the file ``bn\_mp\_add.c''. When a define has been enabled the
263263
function in the respective file will be compiled and linked into the library. Accordingly when the define
264264
is absent the file will not be compiled and not contribute any size to the library.
265265

@@ -275,7 +275,7 @@ \subsection{Build Tweaks}
275275
\begin{center}
276276
\begin{tabular}{|l|l|}
277277
\hline \textbf{Define} & \textbf{Purpose} \\
278-
\hline BN\_MP\_DIV\_SMALL & Enables a slower, smaller and equally \\
278+
\hline MP\_DIV\_SMALL & Enables a slower, smaller and equally \\
279279
& functional mp\_div() function \\
280280
\hline
281281
\end{tabular}
@@ -293,20 +293,20 @@ \subsubsection{Moduli Related}
293293
\begin{center}
294294
\begin{tabular}{|l|l|}
295295
\hline \textbf{Restriction} & \textbf{Undefine} \\
296-
\hline Exponentiation with odd moduli only & BN\_S\_MP\_EXPTMOD\_C \\
297-
& BN\_MP\_REDUCE\_C \\
298-
& BN\_MP\_REDUCE\_SETUP\_C \\
299-
& BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\
300-
& BN\_FAST\_S\_MP\_MUL\_HIGH\_DIGS\_C \\
296+
\hline Exponentiation with odd moduli only & S\_MP\_EXPTMOD\_C \\
297+
& MP\_REDUCE\_C \\
298+
& MP\_REDUCE\_SETUP\_C \\
299+
& S\_MP\_MUL\_HIGH\_DIGS\_C \\
300+
& FAST\_S\_MP\_MUL\_HIGH\_DIGS\_C \\
301301
\hline Exponentiation with random odd moduli & (The above plus the following) \\
302-
& BN\_MP\_REDUCE\_2K\_C \\
303-
& BN\_MP\_REDUCE\_2K\_SETUP\_C \\
304-
& BN\_MP\_REDUCE\_IS\_2K\_C \\
305-
& BN\_MP\_DR\_IS\_MODULUS\_C \\
306-
& BN\_MP\_DR\_REDUCE\_C \\
307-
& BN\_MP\_DR\_SETUP\_C \\
308-
\hline Modular inverse odd moduli only & BN\_MP\_INVMOD\_SLOW\_C \\
309-
\hline Modular inverse (both, smaller/slower) & BN\_FAST\_MP\_INVMOD\_C \\
302+
& MP\_REDUCE\_2K\_C \\
303+
& MP\_REDUCE\_2K\_SETUP\_C \\
304+
& MP\_REDUCE\_IS\_2K\_C \\
305+
& MP\_DR\_IS\_MODULUS\_C \\
306+
& MP\_DR\_REDUCE\_C \\
307+
& MP\_DR\_SETUP\_C \\
308+
\hline Modular inverse odd moduli only & MP\_INVMOD\_SLOW\_C \\
309+
\hline Modular inverse (both, smaller/slower) & FAST\_MP\_INVMOD\_C \\
310310
\hline
311311
\end{tabular}
312312
\end{center}
@@ -317,14 +317,14 @@ \subsubsection{Operand Size Related}
317317
\begin{center}
318318
\begin{tabular}{|l|l|}
319319
\hline \textbf{Restriction} & \textbf{Undefine} \\
320-
\hline Moduli $\le 2560$ bits & BN\_MP\_MONTGOMERY\_REDUCE\_C \\
321-
& BN\_S\_MP\_MUL\_DIGS\_C \\
322-
& BN\_S\_MP\_MUL\_HIGH\_DIGS\_C \\
323-
& BN\_S\_MP\_SQR\_C \\
324-
\hline Polynomial Schmolynomial & BN\_MP\_KARATSUBA\_MUL\_C \\
325-
& BN\_MP\_KARATSUBA\_SQR\_C \\
326-
& BN\_MP\_TOOM\_MUL\_C \\
327-
& BN\_MP\_TOOM\_SQR\_C \\
320+
\hline Moduli $\le 2560$ bits & MP\_MONTGOMERY\_REDUCE\_C \\
321+
& S\_MP\_MUL\_DIGS\_C \\
322+
& S\_MP\_MUL\_HIGH\_DIGS\_C \\
323+
& S\_MP\_SQR\_C \\
324+
\hline Polynomial Schmolynomial & MP\_KARATSUBA\_MUL\_C \\
325+
& MP\_KARATSUBA\_SQR\_C \\
326+
& MP\_TOOM\_MUL\_C \\
327+
& MP\_TOOM\_SQR\_C \\
328328

329329
\hline
330330
\end{tabular}

etc/tune.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,39 +67,39 @@ static uint64_t s_time_mul(int size)
6767

6868
if ((e = mp_init_multi(&a, &b, &c, &d, NULL)) != MP_OKAY) {
6969
t1 = UINT64_MAX;
70-
goto LTM_ERR;
70+
goto LBL_ERR;
7171
}
7272

7373
if ((e = mp_rand(&a, size * s_offset)) != MP_OKAY) {
7474
t1 = UINT64_MAX;
75-
goto LTM_ERR;
75+
goto LBL_ERR;
7676
}
7777
if ((e = mp_rand(&b, size)) != MP_OKAY) {
7878
t1 = UINT64_MAX;
79-
goto LTM_ERR;
79+
goto LBL_ERR;
8080
}
8181

8282
s_timer_start();
8383
for (x = 0; x < s_number_of_test_loops; x++) {
8484
if ((e = mp_mul(&a,&b,&c)) != MP_OKAY) {
8585
t1 = UINT64_MAX;
86-
goto LTM_ERR;
86+
goto LBL_ERR;
8787
}
8888
if (s_check_result == 1) {
8989
if ((e = s_mp_mul(&a,&b,&d)) != MP_OKAY) {
9090
t1 = UINT64_MAX;
91-
goto LTM_ERR;
91+
goto LBL_ERR;
9292
}
9393
if (mp_cmp(&c, &d) != MP_EQ) {
9494
/* Time of 0 cannot happen (famous last words?) */
9595
t1 = 0uLL;
96-
goto LTM_ERR;
96+
goto LBL_ERR;
9797
}
9898
}
9999
}
100100

101101
t1 = s_timer_stop();
102-
LTM_ERR:
102+
LBL_ERR:
103103
mp_clear_multi(&a, &b, &c, &d, NULL);
104104
return t1;
105105
}
@@ -112,34 +112,34 @@ static uint64_t s_time_sqr(int size)
112112

113113
if ((e = mp_init_multi(&a, &b, &c, NULL)) != MP_OKAY) {
114114
t1 = UINT64_MAX;
115-
goto LTM_ERR;
115+
goto LBL_ERR;
116116
}
117117

118118
if ((e = mp_rand(&a, size)) != MP_OKAY) {
119119
t1 = UINT64_MAX;
120-
goto LTM_ERR;
120+
goto LBL_ERR;
121121
}
122122

123123
s_timer_start();
124124
for (x = 0; x < s_number_of_test_loops; x++) {
125125
if ((e = mp_sqr(&a,&b)) != MP_OKAY) {
126126
t1 = UINT64_MAX;
127-
goto LTM_ERR;
127+
goto LBL_ERR;
128128
}
129129
if (s_check_result == 1) {
130130
if ((e = s_mp_sqr(&a,&c)) != MP_OKAY) {
131131
t1 = UINT64_MAX;
132-
goto LTM_ERR;
132+
goto LBL_ERR;
133133
}
134134
if (mp_cmp(&c, &b) != MP_EQ) {
135135
t1 = 0uLL;
136-
goto LTM_ERR;
136+
goto LBL_ERR;
137137
}
138138
}
139139
}
140140

141141
t1 = s_timer_stop();
142-
LTM_ERR:
142+
LBL_ERR:
143143
mp_clear_multi(&a, &b, &c, NULL);
144144
return t1;
145145
}

gen.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use warnings;
88

99
open(my $out, '>', 'mpi.c') or die "Couldn't open mpi.c for writing: $!";
10-
foreach my $filename (glob 'bn*.c') {
10+
foreach my $filename (glob '*mp_*.c') {
1111
open(my $src, '<', $filename) or die "Couldn't open $filename for reading: $!";
1212
print {$out} "/* Start: $filename */\n";
1313
print {$out} $_ while <$src>;

helper.pl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ sub draw_func
270270
my ($deplist, $depmap, $out, $indent, $funcslist) = @_;
271271
my @funcs = split ',', $funcslist;
272272
# try this if you want to have a look at a minimized version of the callgraph without all the trivial functions
273-
#if ($deplist =~ /$funcs[0]/ || $funcs[0] =~ /BN_MP_(ADD|SUB|CLEAR|CLEAR_\S+|DIV|MUL|COPY|ZERO|GROW|CLAMP|INIT|INIT_\S+|SET|ABS|CMP|CMP_D|EXCH)_C/) {
273+
#if ($deplist =~ /$funcs[0]/ || $funcs[0] =~ /MP_(ADD|SUB|CLEAR|CLEAR_\S+|DIV|MUL|COPY|ZERO|GROW|CLAMP|INIT|INIT_\S+|SET|ABS|CMP|CMP_D|EXCH)_C/) {
274274
if ($deplist =~ /$funcs[0]/) {
275275
return $deplist;
276276
} else {
@@ -309,7 +309,7 @@ sub update_dep
309309
#if defined(LTM_ALL)
310310
EOS
311311

312-
foreach my $filename (glob 'bn*.c') {
312+
foreach my $filename (glob '*mp_*.c') {
313313
my $define = $filename;
314314

315315
print "Processing $filename\n";
@@ -356,7 +356,7 @@ sub update_dep
356356

357357
# now do classes
358358
my %depmap;
359-
foreach my $filename (glob 'bn*.c') {
359+
foreach my $filename (glob '*mp_*.c') {
360360
my $content;
361361
my $cc = $ENV{'CC'} || 'gcc';
362362
$content = `$cc -E -x c -DLTM_ALL $filename`;
@@ -379,7 +379,7 @@ sub update_dep
379379
my $a = $&;
380380
next if $a eq "mp_err";
381381
$a =~ tr/[a-z]/[A-Z]/;
382-
$a = 'BN_' . $a . '_C';
382+
$a = $a . '_C';
383383
push @deps, $a;
384384
}
385385
}

0 commit comments

Comments
 (0)