]> git.ipfire.org Git - thirdparty/openssl.git/blame - apps/progs.pl
Memory leaks fix. It now looks like all memory leaks, at least around
[thirdparty/openssl.git] / apps / progs.pl
CommitLineData
d02b48c6
RE
1#!/usr/local/bin/perl
2
29a28ee5
BM
3print "/* apps/progs.h */\n";
4print "/* automatically generated by progs.pl for openssl.c */\n\n";
c1cf1eec 5
d02b48c6
RE
6grep(s/^asn1pars$/asn1parse/,@ARGV);
7
8foreach (@ARGV)
9 { printf "extern int %s_main(int argc,char *argv[]);\n",$_; }
d02b48c6
RE
10
11print <<'EOF';
12
d02b48c6
RE
13#define FUNC_TYPE_GENERAL 1
14#define FUNC_TYPE_MD 2
15#define FUNC_TYPE_CIPHER 3
16
17typedef struct {
18 int type;
19 char *name;
20 int (*func)();
21 } FUNCTION;
22
23FUNCTION functions[] = {
24EOF
25
26foreach (@ARGV)
27 {
28 push(@files,$_);
29 $str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
30 if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
a31011e8 31 { print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(NO_SSL3))\n${str}#endif\n"; }
06d5b162 32 elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) )
d02b48c6
RE
33 { print "#ifndef NO_RSA\n${str}#endif\n"; }
34 elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
35 { print "#ifndef NO_DSA\n${str}#endif\n"; }
09483c58 36 elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/) || ($_ =~ /^dhparam$/))
d02b48c6 37 { print "#ifndef NO_DH\n${str}#endif\n"; }
a31011e8
BM
38 elsif ( ($_ =~ /^pkcs12$/))
39 { print "#if !defined(NO_DES) && !defined(NO_SHA1)\n${str}#endif\n"; }
d02b48c6
RE
40 else
41 { print $str; }
42 }
43
dfeab068 44foreach ("md2","md5","sha","sha1","mdc2","rmd160")
d02b48c6
RE
45 {
46 push(@files,$_);
47 printf "\t{FUNC_TYPE_MD,\"%s\",dgst_main},\n",$_;
48 }
49
50foreach (
51 "base64",
91895a59 52 "des", "des3", "desx", "idea", "rc4", "rc4-40",
a0e9f529 53 "rc2", "bf", "cast", "rc5",
d02b48c6
RE
54 "des-ecb", "des-ede", "des-ede3",
55 "des-cbc", "des-ede-cbc","des-ede3-cbc",
56 "des-cfb", "des-ede-cfb","des-ede3-cfb",
57 "des-ofb", "des-ede-ofb","des-ede3-ofb",
58 "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
a0e9f529 59 "rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
58964a49
RE
60 "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
61 "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
62 "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb")
d02b48c6
RE
63 {
64 push(@files,$_);
65
66 $t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
67 if ($_ =~ /des/) { $t="#ifndef NO_DES\n${t}#endif\n"; }
68 elsif ($_ =~ /idea/) { $t="#ifndef NO_IDEA\n${t}#endif\n"; }
69 elsif ($_ =~ /rc4/) { $t="#ifndef NO_RC4\n${t}#endif\n"; }
70 elsif ($_ =~ /rc2/) { $t="#ifndef NO_RC2\n${t}#endif\n"; }
b5929507 71 elsif ($_ =~ /bf/) { $t="#ifndef NO_BF\n${t}#endif\n"; }
58964a49
RE
72 elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
73 elsif ($_ =~ /rc5/) { $t="#ifndef NO_RC5\n${t}#endif\n"; }
d02b48c6
RE
74 print $t;
75 }
76
77print "\t{0,NULL,NULL}\n\t};\n";