2 # Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
9 # Generate progs.h file by looking for command mains in list of C files
10 # passed on the command line.
15 use configdata qw/@disablables %unified_info/;
18 my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
20 my $apps_openssl = shift @ARGV;
21 # because the program apps/openssl has object files as sources, and
22 # they then have the corresponding C files as source, we need to chain
23 # the lookups in %unified_info
25 map { @{$unified_info{sources}->{$_}} }
26 @{$unified_info{sources}->{$apps_openssl}};
28 foreach my $filename (@openssl_source) {
29 open F, $filename or die "Coudn't open $_: $!\n";
30 foreach (grep /$cmdre/, <F>) {
37 @ARGV = sort keys %commands;
41 * WARNING: do not edit!
42 * Generated by apps/progs.pl
44 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
46 * Licensed under the OpenSSL license (the "License"). You may not use
47 * this file except in compliance with the License. You can obtain a copy
48 * in the file LICENSE in the source distribution or at
49 * https://www.openssl.org/source/license.html
52 typedef enum FUNC_TYPE {
53 FT_none, FT_general, FT_md, FT_cipher, FT_pkey,
54 FT_md_alg, FT_cipher_alg
57 typedef struct function_st {
60 int (*func)(int argc, char *argv[]);
64 DEFINE_LHASH_OF(FUNCTION);
69 printf "extern int %s_main(int argc, char *argv[]);\n", $_;
75 printf "extern const OPTIONS %s_options[];\n", $_;
78 print "\n#ifdef INCLUDE_FUNCTION_TABLE\n";
79 print "static FUNCTION functions[] = {\n";
91 foreach my $cmd (@ARGV) {
92 my $str=" {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options},\n";
94 print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n";
95 } elsif (grep { $cmd eq $_ } @disablables) {
96 print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
97 } elsif (my $disabler = $cmd_disabler{$cmd}) {
98 print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
105 blake2b512 => "blake2",
106 blake2s256 => "blake2",
111 "sha1", "sha224", "sha256", "sha384", "sha512",
112 "mdc2", "rmd160", "blake2b512", "blake2s256"
114 my $str = " {FT_md, \"".$cmd."\", dgst_main},\n";
115 if (grep { $cmd eq $_ } @disablables) {
116 print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
117 } elsif (my $disabler = $md_disabler{$cmd}) {
118 print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
124 my %cipher_disabler = (
130 "aes-128-cbc", "aes-128-ecb",
131 "aes-192-cbc", "aes-192-ecb",
132 "aes-256-cbc", "aes-256-ecb",
133 "camellia-128-cbc", "camellia-128-ecb",
134 "camellia-192-cbc", "camellia-192-ecb",
135 "camellia-256-cbc", "camellia-256-ecb",
137 "des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
138 "rc2", "bf", "cast", "rc5",
139 "des-ecb", "des-ede", "des-ede3",
140 "des-cbc", "des-ede-cbc","des-ede3-cbc",
141 "des-cfb", "des-ede-cfb","des-ede3-cfb",
142 "des-ofb", "des-ede-ofb","des-ede3-ofb",
143 "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
144 "seed-cbc","seed-ecb", "seed-cfb", "seed-ofb",
145 "rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
146 "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
147 "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
148 "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb"
150 my $str=" {FT_cipher, \"$cmd\", enc_main, enc_options},\n";
151 (my $algo= $cmd) =~ s/-.*//g;
152 if ($cmd eq "zlib") {
153 print "#ifdef ZLIB\n${str}#endif\n";
154 } elsif (grep { $algo eq $_ } @disablables) {
155 print "#ifndef OPENSSL_NO_".uc($algo)."\n${str}#endif\n";
156 } elsif (my $disabler = $cipher_disabler{$algo}) {
157 print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
163 print " { 0, NULL, NULL}\n};\n";