2 # Generate progs.h file by looking for command mains in list of C files
3 # passed on the command line.
9 my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
11 foreach my $filename (@ARGV) {
12 open F, $filename or die "Coudn't open $_: $!\n";
13 foreach (grep /$cmdre/, <F>) {
20 @ARGV = sort keys %commands;
24 * Automatically generated by progs.pl for openssl.c
25 * Copyright (c) 2008 The OpenSSL Project. All rights reserved.
26 * See the openssl.c for copyright details.
29 typedef enum FUNC_TYPE {
30 FT_none, FT_general, FT_md, FT_cipher, FT_pkey,
31 FT_md_alg, FT_cipher_alg
34 typedef struct function_st {
37 int (*func)(int argc,char *argv[]);
41 DEFINE_LHASH_OF(FUNCTION);
46 printf "extern int %s_main(int argc, char *argv[]);\n", $_;
52 printf "extern OPTIONS %s_options[];\n", $_;
54 print "\n#ifdef INCLUDE_FUNCTION_TABLE\n";
55 print "static FUNCTION functions[] = {\n";
57 my $str=" { FT_general, \"$_\", ${_}_main, ${_}_options },\n";
58 if (/^s_/ || /^ciphers$/) {
59 print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n";
60 } elsif (/^engine$/) {
61 print "#ifndef OPENSSL_NO_ENGINE\n${str}#endif\n";
62 } elsif (/^rsa$/ || /^genrsa$/ || /^rsautl$/) {
63 print "#ifndef OPENSSL_NO_RSA\n${str}#endif\n";
64 } elsif (/^dsa$/ || /^gendsa$/ || /^dsaparam$/) {
65 print "#ifndef OPENSSL_NO_DSA\n${str}#endif\n";
66 } elsif (/^ec$/ || /^ecparam$/) {
67 print "#ifndef OPENSSL_NO_EC\n${str}#endif\n";
68 } elsif (/^dh$/ || /^gendh$/ || /^dhparam$/) {
69 print "#ifndef OPENSSL_NO_DH\n${str}#endif\n";
70 } elsif (/^pkcs12$/) {
71 print "#if !defined(OPENSSL_NO_DES)\n${str}#endif\n";
73 print "#ifndef OPENSSL_NO_CMS\n${str}#endif\n";
75 print "#ifndef OPENSSL_NO_OCSP\n${str}#endif\n";
77 print "#ifndef OPENSSL_NO_SRP\n${str}#endif\n";
86 "sha1", "sha224", "sha256", "sha384", "sha512",
89 printf "#ifndef OPENSSL_NO_".uc($_)."\n" if ! /sha/;
90 printf " { FT_md, \"".$_."\", dgst_main},\n";
91 printf "#endif\n" if ! /sha/;
95 "aes-128-cbc", "aes-128-ecb",
96 "aes-192-cbc", "aes-192-ecb",
97 "aes-256-cbc", "aes-256-ecb",
98 "camellia-128-cbc", "camellia-128-ecb",
99 "camellia-192-cbc", "camellia-192-ecb",
100 "camellia-256-cbc", "camellia-256-ecb",
102 "des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
103 "rc2", "bf", "cast", "rc5",
104 "des-ecb", "des-ede", "des-ede3",
105 "des-cbc", "des-ede-cbc","des-ede3-cbc",
106 "des-cfb", "des-ede-cfb","des-ede3-cfb",
107 "des-ofb", "des-ede-ofb","des-ede3-ofb",
108 "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
109 "seed-cbc","seed-ecb", "seed-cfb", "seed-ofb",
110 "rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
111 "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
112 "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
113 "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb"
115 my $str=" { FT_cipher, \"$_\", enc_main, enc_options },\n";
117 printf "#ifndef OPENSSL_NO_DES\n${str}#endif\n";
119 printf "#ifndef OPENSSL_NO_AES\n${str}#endif\n";
120 } elsif (/camellia/) {
121 printf "#ifndef OPENSSL_NO_CAMELLIA\n${str}#endif\n";
123 printf "#ifndef OPENSSL_NO_IDEA\n${str}#endif\n";
125 printf "#ifndef OPENSSL_NO_SEED\n${str}#endif\n";
127 printf "#ifndef OPENSSL_NO_RC4\n${str}#endif\n";
129 printf "#ifndef OPENSSL_NO_RC2\n${str}#endif\n";
131 printf "#ifndef OPENSSL_NO_BF\n${str}#endif\n";
133 printf "#ifndef OPENSSL_NO_CAST\n${str}#endif\n";
135 printf "#ifndef OPENSSL_NO_RC5\n${str}#endif\n";
137 printf "#ifdef ZLIB\n${str}#endif\n";
143 print " { 0, NULL, NULL}\n};\n";