fix compiler warning
Karel Miko
9 years ago
5 | 5 |
use File::Spec::Functions qw(catfile catdir splitpath);
|
6 | 6 |
use File::Slurp;
|
7 | 7 |
use File::Find qw(find);
|
8 | |
|
9 | 8 |
|
10 | 9 |
sub replace_text {
|
11 | 10 |
my ($dir, $oldstring, $newstring) = @_;
|
|
37 | 36 |
my $srcdir = catdir($FindBin::Bin, "..", "src/ltc");
|
38 | 37 |
|
39 | 38 |
my @lines = read_file("$srcdir/headers/tomcrypt_custom.h");
|
40 | |
@lines = map { s|^([\t\s]*)#define LTC_YARROW_AES \d+|$1#define LTC_YARROW_AES 3|; $_ } @lines;
|
41 | 39 |
@lines = map { s|^([\t\s]*)#define LTC_NO_PROTOTYPES|$1/* #define LTC_NO_PROTOTYPES */|; $_ } @lines;
|
42 | |
@lines = map { s|^([\t\s]*)/\* #define LTM_DESC \*/|#define LTM_DESC|;$_ } @lines;
|
43 | 40 |
write_file("$srcdir/headers/tomcrypt_custom.h", {binmode => ':raw'}, @lines);
|
44 | 41 |
|
45 | 42 |
my @rename2inc = (qw[
|
46 | 43 |
ciphers/aes/aes_tab.c
|
47 | 44 |
ciphers/twofish/twofish_tab.c
|
48 | |
hashes/sha2/sha224.c
|
49 | |
hashes/sha2/sha384.c
|
|
45 |
ciphers/safer/safer_tab.c
|
50 | 46 |
hashes/whirl/whirltab.c
|
51 | 47 |
prngs/sober128tab.c
|
52 | |
pk/dh/dh_sys.c
|
53 | 48 |
]);
|
54 | 49 |
|
55 | 50 |
for my $f (@rename2inc) {
|
|
65 | 60 |
remove_files($srcdir, qr/f8_test_mode\.c$/);
|
66 | 61 |
remove_files($srcdir, qr/gmp_desc\.c$/);
|
67 | 62 |
remove_files($srcdir, qr/tfm_desc\.c$/);
|
68 | |
remove_files("$srcdir/encauth/ocb", qr/.*/);⏎
|
|
63 |
remove_files("$srcdir/encauth/ocb", qr/.*/);
|
3 | 3 |
/* macros for various libc functions you can change for embedded targets */
|
4 | 4 |
#ifndef XMALLOC
|
5 | 5 |
#ifdef malloc
|
6 | |
#define LTC_NO_PROTOTYPES
|
|
6 |
/* #define LTC_NO_PROTOTYPES */
|
7 | 7 |
#endif
|
8 | 8 |
#define XMALLOC malloc
|
9 | 9 |
#endif
|
10 | 10 |
#ifndef XREALLOC
|
11 | 11 |
#ifdef realloc
|
12 | |
#define LTC_NO_PROTOTYPES
|
|
12 |
/* #define LTC_NO_PROTOTYPES */
|
13 | 13 |
#endif
|
14 | 14 |
#define XREALLOC realloc
|
15 | 15 |
#endif
|
16 | 16 |
#ifndef XCALLOC
|
17 | 17 |
#ifdef calloc
|
18 | |
#define LTC_NO_PROTOTYPES
|
|
18 |
/* #define LTC_NO_PROTOTYPES */
|
19 | 19 |
#endif
|
20 | 20 |
#define XCALLOC calloc
|
21 | 21 |
#endif
|
22 | 22 |
#ifndef XFREE
|
23 | 23 |
#ifdef free
|
24 | |
#define LTC_NO_PROTOTYPES
|
|
24 |
/* #define LTC_NO_PROTOTYPES */
|
25 | 25 |
#endif
|
26 | 26 |
#define XFREE free
|
27 | 27 |
#endif
|
28 | 28 |
|
29 | 29 |
#ifndef XMEMSET
|
30 | 30 |
#ifdef memset
|
31 | |
#define LTC_NO_PROTOTYPES
|
|
31 |
/* #define LTC_NO_PROTOTYPES */
|
32 | 32 |
#endif
|
33 | 33 |
#define XMEMSET memset
|
34 | 34 |
#endif
|
35 | 35 |
#ifndef XMEMCPY
|
36 | 36 |
#ifdef memcpy
|
37 | |
#define LTC_NO_PROTOTYPES
|
|
37 |
/* #define LTC_NO_PROTOTYPES */
|
38 | 38 |
#endif
|
39 | 39 |
#define XMEMCPY memcpy
|
40 | 40 |
#endif
|
41 | 41 |
#ifndef XMEMCMP
|
42 | 42 |
#ifdef memcmp
|
43 | |
#define LTC_NO_PROTOTYPES
|
|
43 |
/* #define LTC_NO_PROTOTYPES */
|
44 | 44 |
#endif
|
45 | 45 |
#define XMEMCMP memcmp
|
46 | 46 |
#endif
|
|
49 | 49 |
#endif
|
50 | 50 |
#ifndef XSTRCMP
|
51 | 51 |
#ifdef strcmp
|
52 | |
#define LTC_NO_PROTOTYPES
|
|
52 |
/* #define LTC_NO_PROTOTYPES */
|
53 | 53 |
#endif
|
54 | 54 |
#define XSTRCMP strcmp
|
55 | 55 |
#endif
|
|
63 | 63 |
|
64 | 64 |
#ifndef XQSORT
|
65 | 65 |
#ifdef qsort
|
66 | |
#define LTC_NO_PROTOTYPES
|
|
66 |
/* #define LTC_NO_PROTOTYPES */
|
67 | 67 |
#endif
|
68 | 68 |
#define XQSORT qsort
|
69 | 69 |
#endif
|