34dcac16813c26d462ef8a552b1167c1ba02ac77
[openssl.git] / apps / progs.pl
1 #!/usr/local/bin/perl
2
3 print "/* This file was generated by progs.pl. */\n\n";
4
5 print "#ifndef NOPROTO\n";
6
7 grep(s/^asn1pars$/asn1parse/,@ARGV);
8
9 foreach (@ARGV)
10         { printf "extern int %s_main(int argc,char *argv[]);\n",$_; }
11 print "#else\n";
12 foreach (@ARGV)
13         { printf "extern int %s_main();\n",$_; }
14 print "#endif\n";
15
16
17 print <<'EOF';
18
19 #ifdef SSLEAY_SRC  /* Defined only in openssl.c. */
20
21 #define FUNC_TYPE_GENERAL       1
22 #define FUNC_TYPE_MD            2
23 #define FUNC_TYPE_CIPHER        3
24
25 typedef struct {
26         int type;
27         char *name;
28         int (*func)();
29         } FUNCTION;
30
31 FUNCTION functions[] = {
32 EOF
33
34 foreach (@ARGV)
35         {
36         push(@files,$_);
37         $str="\t{FUNC_TYPE_GENERAL,\"$_\",${_}_main},\n";
38         if (($_ =~ /^s_/) || ($_ =~ /^ciphers$/))
39                 { print "#if !defined(NO_SOCK) && !(defined(NO_SSL2) && defined(O_SSL3))\n${str}#endif\n"; } 
40         elsif ( ($_ =~ /^rsa$/) || ($_ =~ /^genrsa$/) ) 
41                 { print "#ifndef NO_RSA\n${str}#endif\n";  }
42         elsif ( ($_ =~ /^dsa$/) || ($_ =~ /^gendsa$/) || ($_ =~ /^dsaparam$/))
43                 { print "#ifndef NO_DSA\n${str}#endif\n"; }
44         elsif ( ($_ =~ /^dh$/) || ($_ =~ /^gendh$/))
45                 { print "#ifndef NO_DH\n${str}#endif\n"; }
46         else
47                 { print $str; }
48         }
49
50 foreach ("md2","md5","sha","sha1","mdc2","rmd160")
51         {
52         push(@files,$_);
53         printf "\t{FUNC_TYPE_MD,\"%s\",dgst_main},\n",$_;
54         }
55
56 foreach (
57         "base64",
58         "des", "des3", "desx", "idea", "rc4", "rc2","bf","cast","rc5",
59         "des-ecb", "des-ede",    "des-ede3",
60         "des-cbc", "des-ede-cbc","des-ede3-cbc",
61         "des-cfb", "des-ede-cfb","des-ede3-cfb",
62         "des-ofb", "des-ede-ofb","des-ede3-ofb",
63         "idea-cbc","idea-ecb",   "idea-cfb", "idea-ofb",
64         "rc2-cbc", "rc2-ecb",    "rc2-cfb",  "rc2-ofb",
65         "bf-cbc",  "bf-ecb",     "bf-cfb",   "bf-ofb",
66         "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
67         "cast-cbc", "rc5-cbc",   "rc5-ecb",  "rc5-cfb",  "rc5-ofb")
68         {
69         push(@files,$_);
70
71         $t=sprintf("\t{FUNC_TYPE_CIPHER,\"%s\",enc_main},\n",$_);
72         if    ($_ =~ /des/)  { $t="#ifndef NO_DES\n${t}#endif\n"; }
73         elsif ($_ =~ /idea/) { $t="#ifndef NO_IDEA\n${t}#endif\n"; }
74         elsif ($_ =~ /rc4/)  { $t="#ifndef NO_RC4\n${t}#endif\n"; }
75         elsif ($_ =~ /rc2/)  { $t="#ifndef NO_RC2\n${t}#endif\n"; }
76         elsif ($_ =~ /bf/)   { $t="#ifndef NO_BLOWFISH\n${t}#endif\n"; }
77         elsif ($_ =~ /cast/) { $t="#ifndef NO_CAST\n${t}#endif\n"; }
78         elsif ($_ =~ /rc5/)  { $t="#ifndef NO_RC5\n${t}#endif\n"; }
79         print $t;
80         }
81
82 print "\t{0,NULL,NULL}\n\t};\n";
83 print "#endif\n\n";
84