Skip to content

Commit 681925a

Browse files
committed
checking for deprecated functions
1 parent 5961083 commit 681925a

File tree

1 file changed

+43
-4
lines changed

1 file changed

+43
-4
lines changed

etc/make_small_lib.pl

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,40 @@
2727
s_mp_toom_mul => 1,
2828
s_mp_toom_sqr => 1
2929
);
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+
3064
# The global variable where gather_functions() puts all it's findings in.
3165
my @dependency_list = ();
3266

@@ -274,7 +308,8 @@ sub start
274308
my @tmp;
275309

276310
# 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";
278313

279314
%depmap = gather_functions($td);
280315
%user_functions = gather_functions($sd);
@@ -285,9 +320,13 @@ sub start
285320
}
286321
@functions = uniq(sort @functions);
287322

288-
# No functions starting with "mp_" other than those in LibTomMath are allowed.
289-
# For now.
290323
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.
291330
exists $depmap{$_} or die "Function \"$_\" does not exist in LibTomMath.\n";
292331
}
293332

@@ -297,7 +336,7 @@ sub start
297336
}
298337
@dependency_list = uniq(sort @dependency_list);
299338

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)
301340
if ($no == 1) {
302341
foreach (@dependency_list) {
303342
next if exists $fast_functions{$_};

0 commit comments

Comments
 (0)