]>
Commit | Line | Data |
---|---|---|
d02b48c6 | 1 | #!/usr/local/bin/perl |
7e1b7485 | 2 | # Generate progs.h file from list of "programs" passed on the command line. |
d02b48c6 RE |
3 | |
4 | print <<'EOF'; | |
7e1b7485 RS |
5 | /* |
6 | * Automatically generated by progs.pl for openssl.c | |
7 | * Copyright (c) 2008 The OpenSSL Project. All rights reserved. | |
8 | * See the openssl.c for copyright details. | |
9 | */ | |
d02b48c6 | 10 | |
7e1b7485 RS |
11 | typedef enum FUNC_TYPE { |
12 | FT_none, FT_general, FT_md, FT_cipher, FT_pkey, | |
13 | FT_md_alg, FT_cipher_alg | |
14 | } FUNC_TYPE; | |
d02b48c6 | 15 | |
7e1b7485 RS |
16 | typedef struct function_st { |
17 | FUNC_TYPE type; | |
474e469b | 18 | const char *name; |
7e1b7485 RS |
19 | int (*func)(int argc,char *argv[]); |
20 | const OPTIONS *help; | |
474e469b | 21 | } FUNCTION; |
d02b48c6 | 22 | |
d02b48c6 RE |
23 | EOF |
24 | ||
7e1b7485 RS |
25 | grep(s/\.o//, @ARGV); |
26 | grep(s/^asn1pars$/asn1parse/, @ARGV); | |
27 | grep(s/^crl2p7$/crl2pkcs7/, @ARGV); | |
28 | push @ARGV, 'list'; | |
29 | push @ARGV, 'help'; | |
30 | push @ARGV, 'exit'; | |
31 | ||
32 | foreach (@ARGV) { | |
33 | printf "extern int %s_main(int argc, char *argv[]);\n", $_; | |
34 | } | |
35 | ||
36 | printf "\n#ifdef INCLUDE_FUNCTION_TABLE\n"; | |
37 | foreach (@ARGV) { | |
38 | printf "extern OPTIONS %s_options[];\n", $_; | |
39 | } | |
40 | printf "FUNCTION functions[] = {\n"; | |
41 | foreach (@ARGV) { | |
42 | $str=" { FT_general, \"$_\", ${_}_main, ${_}_options },\n"; | |
43 | if (/^s_/ || /^ciphers$/) { | |
44 | print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n"; | |
45 | } elsif (/^engine$/) { | |
46 | print "#ifndef OPENSSL_NO_ENGINE\n${str}#endif\n"; | |
47 | } elsif (/^rsa$/ || /^genrsa$/ || /^rsautl$/) { | |
48 | print "#ifndef OPENSSL_NO_RSA\n${str}#endif\n"; | |
49 | } elsif (/^dsa$/ || /^gendsa$/ || /^dsaparam$/) { | |
50 | print "#ifndef OPENSSL_NO_DSA\n${str}#endif\n"; | |
51 | } elsif (/^ec$/ || /^ecparam$/) { | |
52 | print "#ifndef OPENSSL_NO_EC\n${str}#endif\n"; | |
53 | } elsif (/^dh$/ || /^gendh$/ || /^dhparam$/) { | |
54 | print "#ifndef OPENSSL_NO_DH\n${str}#endif\n"; | |
55 | } elsif (/^pkcs12$/) { | |
56 | print "#if !defined(OPENSSL_NO_DES)\n${str}#endif\n"; | |
57 | } elsif (/^cms$/) { | |
58 | print "#ifndef OPENSSL_NO_CMS\n${str}#endif\n"; | |
59 | } elsif (/^ocsp$/) { | |
60 | print "#ifndef OPENSSL_NO_OCSP\n${str}#endif\n"; | |
61 | } elsif (/^srp$/) { | |
62 | print "#ifndef OPENSSL_NO_SRP\n${str}#endif\n"; | |
63 | } else { | |
64 | print $str; | |
d02b48c6 | 65 | } |
7e1b7485 | 66 | } |
d02b48c6 | 67 | |
7e1b7485 RS |
68 | foreach ( |
69 | "md2", "md4", "md5", | |
70 | "md_ghost94", | |
71 | "sha", "sha1", "sha224", "sha256", "sha384", "sha512", | |
72 | "mdc2", "rmd160" | |
73 | ) { | |
474e469b | 74 | printf "#ifndef OPENSSL_NO_".uc($_)."\n" if ! /sha/; |
7e1b7485 | 75 | printf " { FT_md, \"".$_."\", dgst_main},\n"; |
474e469b | 76 | printf "#endif\n" if ! /sha/; |
7e1b7485 | 77 | } |
d02b48c6 RE |
78 | |
79 | foreach ( | |
41450b27 BM |
80 | "aes-128-cbc", "aes-128-ecb", |
81 | "aes-192-cbc", "aes-192-ecb", | |
82 | "aes-256-cbc", "aes-256-ecb", | |
f3dea9a5 BM |
83 | "camellia-128-cbc", "camellia-128-ecb", |
84 | "camellia-192-cbc", "camellia-192-ecb", | |
85 | "camellia-256-cbc", "camellia-256-ecb", | |
8931b30d | 86 | "base64", "zlib", |
96afc1cf | 87 | "des", "des3", "desx", "idea", "seed", "rc4", "rc4-40", |
a0e9f529 | 88 | "rc2", "bf", "cast", "rc5", |
d02b48c6 RE |
89 | "des-ecb", "des-ede", "des-ede3", |
90 | "des-cbc", "des-ede-cbc","des-ede3-cbc", | |
91 | "des-cfb", "des-ede-cfb","des-ede3-cfb", | |
92 | "des-ofb", "des-ede-ofb","des-ede3-ofb", | |
96afc1cf BM |
93 | "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb", |
94 | "seed-cbc","seed-ecb", "seed-cfb", "seed-ofb", | |
a0e9f529 | 95 | "rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc", |
58964a49 RE |
96 | "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb", |
97 | "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb", | |
7e1b7485 RS |
98 | "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb" |
99 | ) { | |
100 | $str=" { FT_cipher, \"$_\", enc_main, enc_options },\n"; | |
101 | if (/des/) { | |
102 | printf "#ifndef OPENSSL_NO_DES\n${str}#endif\n"; | |
103 | } elsif (/aes/) { | |
104 | printf "#ifndef OPENSSL_NO_AES\n${str}#endif\n"; | |
105 | } elsif (/camellia/) { | |
106 | printf "#ifndef OPENSSL_NO_CAMELLIA\n${str}#endif\n"; | |
107 | } elsif (/idea/) { | |
108 | printf "#ifndef OPENSSL_NO_IDEA\n${str}#endif\n"; | |
109 | } elsif (/seed/) { | |
110 | printf "#ifndef OPENSSL_NO_SEED\n${str}#endif\n"; | |
111 | } elsif (/rc4/) { | |
112 | printf "#ifndef OPENSSL_NO_RC4\n${str}#endif\n"; | |
113 | } elsif (/rc2/) { | |
114 | printf "#ifndef OPENSSL_NO_RC2\n${str}#endif\n"; | |
115 | } elsif (/bf/) { | |
116 | printf "#ifndef OPENSSL_NO_BF\n${str}#endif\n"; | |
117 | } elsif (/cast/) { | |
118 | printf "#ifndef OPENSSL_NO_CAST\n${str}#endif\n"; | |
119 | } elsif (/rc5/) { | |
120 | printf "#ifndef OPENSSL_NO_RC5\n${str}#endif\n"; | |
121 | } elsif (/zlib/) { | |
122 | printf "#ifdef ZLIB\n${str}#endif\n"; | |
123 | } else { | |
124 | print $str; | |
d02b48c6 | 125 | } |
7e1b7485 | 126 | } |
d02b48c6 | 127 | |
7e1b7485 RS |
128 | print " { 0, NULL, NULL}\n};\n"; |
129 | printf "#endif\n"; |