Codebase list libcryptx-perl / 74d4b17
fix compiler warning Karel Miko 9 years ago
2 changed file(s) with 11 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
55 use File::Spec::Functions qw(catfile catdir splitpath);
66 use File::Slurp;
77 use File::Find qw(find);
8
98
109 sub replace_text {
1110 my ($dir, $oldstring, $newstring) = @_;
3736 my $srcdir = catdir($FindBin::Bin, "..", "src/ltc");
3837
3938 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;
4139 @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;
4340 write_file("$srcdir/headers/tomcrypt_custom.h", {binmode => ':raw'}, @lines);
4441
4542 my @rename2inc = (qw[
4643 ciphers/aes/aes_tab.c
4744 ciphers/twofish/twofish_tab.c
48 hashes/sha2/sha224.c
49 hashes/sha2/sha384.c
45 ciphers/safer/safer_tab.c
5046 hashes/whirl/whirltab.c
5147 prngs/sober128tab.c
52 pk/dh/dh_sys.c
5348 ]);
5449
5550 for my $f (@rename2inc) {
6560 remove_files($srcdir, qr/f8_test_mode\.c$/);
6661 remove_files($srcdir, qr/gmp_desc\.c$/);
6762 remove_files($srcdir, qr/tfm_desc\.c$/);
68 remove_files("$srcdir/encauth/ocb", qr/.*/);
63 remove_files("$srcdir/encauth/ocb", qr/.*/);
33 /* macros for various libc functions you can change for embedded targets */
44 #ifndef XMALLOC
55 #ifdef malloc
6 #define LTC_NO_PROTOTYPES
6 /* #define LTC_NO_PROTOTYPES */
77 #endif
88 #define XMALLOC malloc
99 #endif
1010 #ifndef XREALLOC
1111 #ifdef realloc
12 #define LTC_NO_PROTOTYPES
12 /* #define LTC_NO_PROTOTYPES */
1313 #endif
1414 #define XREALLOC realloc
1515 #endif
1616 #ifndef XCALLOC
1717 #ifdef calloc
18 #define LTC_NO_PROTOTYPES
18 /* #define LTC_NO_PROTOTYPES */
1919 #endif
2020 #define XCALLOC calloc
2121 #endif
2222 #ifndef XFREE
2323 #ifdef free
24 #define LTC_NO_PROTOTYPES
24 /* #define LTC_NO_PROTOTYPES */
2525 #endif
2626 #define XFREE free
2727 #endif
2828
2929 #ifndef XMEMSET
3030 #ifdef memset
31 #define LTC_NO_PROTOTYPES
31 /* #define LTC_NO_PROTOTYPES */
3232 #endif
3333 #define XMEMSET memset
3434 #endif
3535 #ifndef XMEMCPY
3636 #ifdef memcpy
37 #define LTC_NO_PROTOTYPES
37 /* #define LTC_NO_PROTOTYPES */
3838 #endif
3939 #define XMEMCPY memcpy
4040 #endif
4141 #ifndef XMEMCMP
4242 #ifdef memcmp
43 #define LTC_NO_PROTOTYPES
43 /* #define LTC_NO_PROTOTYPES */
4444 #endif
4545 #define XMEMCMP memcmp
4646 #endif
4949 #endif
5050 #ifndef XSTRCMP
5151 #ifdef strcmp
52 #define LTC_NO_PROTOTYPES
52 /* #define LTC_NO_PROTOTYPES */
5353 #endif
5454 #define XSTRCMP strcmp
5555 #endif
6363
6464 #ifndef XQSORT
6565 #ifdef qsort
66 #define LTC_NO_PROTOTYPES
66 /* #define LTC_NO_PROTOTYPES */
6767 #endif
6868 #define XQSORT qsort
6969 #endif