27
27
s _ mp_ toom_ mul => 1,
28
28
s_mp_toom_sqr => 1
29
29
);
30
+
31
+ my %deprecated_functions = (
32
+ mp_get_bit => ' s_mp_get_bit' ,
33
+ mp_jacobi => ' mp_kronecker' ,
34
+ mp_prime_random_ex => ' s_mp_prime_random_ex' ,
35
+ mp_rand_digit => ' s_mp_rand_source' ,
36
+ fast_mp_invmod => ' s_mp_invmod_fast' ,
37
+ fast_mp_montgomery_reduce => ' s_mp_montgomery_reduce_fast' ,
38
+ fast_s_mp_mul_digs => ' s_mp_mul_digs_fast' ,
39
+ fast_s_mp_mul_high_digs => ' s_mp_mul_high_digs_fast' ,
40
+ fast_s_mp_sqr => ' s_mp_sqr_fast' ,
41
+ mp_balance_mul => ' s_mp_balance_mul' ,
42
+ mp_exptmod_fast => ' s_mp_exptmod_fast' ,
43
+ mp_invmod_slow => ' s_mp_invmod_slow' ,
44
+ mp_karatsuba_mul => ' s_mp_karatsuba_mul' ,
45
+ mp_karatsuba_sqr => ' s_mp_karatsuba_sqr' ,
46
+ mp_toom_mul => ' s_mp_toom_mul' ,
47
+ mp_toom_sqr => ' s_mp_toom_sqr' ,
48
+ bn_reverse => ' s_mp_reverse' ,
49
+ mp_tc_and => ' mp_and' ,
50
+ mp_tc_or => ' mp_or' ,
51
+ mp_tc_xor => ' mp_xor' ,
52
+ mp_tc_div_2d => ' mp_signed_rsh' ,
53
+ mp_init_set_int => ' mp_init_u32' ,
54
+ mp_set_int => ' mp_set_u32' ,
55
+ mp_set_long => ' mp_set_u64' ,
56
+ mp_set_long_long => ' mp_set_u64' ,
57
+ mp_get_int => ' mp_get_mag32' ,
58
+ mp_get_long_long => ' mp_get_mag64' ,
59
+ mp_prime_is_divisible => ' s_mp_prime_is_divisible' ,
60
+ mp_expt_d_ex => ' mp_expt_d' ,
61
+ mp_n_root_ex => ' mp_n_root'
62
+ );
63
+
30
64
# The global variable where gather_functions() puts all it's findings in.
31
65
my @dependency_list = ();
32
66
@@ -274,7 +308,8 @@ sub start
274
308
my @tmp ;
275
309
276
310
# TODO: checks&balances
277
- -e $td .$sep ." tommath.h" or die " $td .$sep .tommath.h not found, please check path to LibTomMath sources\n " ;
311
+ -e $td .$sep ." tommath.h"
312
+ or die " $td .$sep .tommath.h not found, please check path to LibTomMath sources\n " ;
278
313
279
314
%depmap = gather_functions($td );
280
315
%user_functions = gather_functions($sd );
@@ -285,9 +320,13 @@ sub start
285
320
}
286
321
@functions = uniq(sort @functions );
287
322
288
- # No functions starting with "mp_" other than those in LibTomMath are allowed.
289
- # For now.
290
323
foreach (@functions ) {
324
+ # Deprecated functions are not accepted.
325
+ exists $deprecated_functions {$_ }
326
+ and die " Function \" $_ \" is deprecated, please use \" " .
327
+ $deprecated_functions {$_ } . " \" instead\n " ;
328
+
329
+ # No functions starting with "mp_" other than those in LibTomMath are allowed.
291
330
exists $depmap {$_ } or die " Function \" $_ \" does not exist in LibTomMath.\n " ;
292
331
}
293
332
@@ -297,7 +336,7 @@ sub start
297
336
}
298
337
@dependency_list = uniq(sort @dependency_list );
299
338
300
- # make an even smaller lib by removing non-essential functions (e.g. Karatsuba for multiplication )
339
+ # make an even smaller lib by removing non-essential functions (e.g. Karatsuba for mp_mul )
301
340
if ($no == 1) {
302
341
foreach (@dependency_list ) {
303
342
next if exists $fast_functions {$_ };
0 commit comments