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.
14 use configdata qw/@disablables/;
17 my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
19 foreach my $filename (@ARGV) {
20 open F, $filename or die "Coudn't open $_: $!\n";
21 foreach (grep /$cmdre/, <F>) {
28 @ARGV = sort keys %commands;
32 * WARNING: do not edit!
33 * Generated by apps/progs.pl
35 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
37 * Licensed under the OpenSSL license (the "License"). You may not use
38 * this file except in compliance with the License. You can obtain a copy
39 * in the file LICENSE in the source distribution or at
40 * https://www.openssl.org/source/license.html
43 typedef enum FUNC_TYPE {
44 FT_none, FT_general, FT_md, FT_cipher, FT_pkey,
45 FT_md_alg, FT_cipher_alg
48 typedef struct function_st {
51 int (*func)(int argc, char *argv[]);
55 DEFINE_LHASH_OF(FUNCTION);
60 printf "extern int %s_main(int argc, char *argv[]);\n", $_;
66 printf "extern OPTIONS %s_options[];\n", $_;
69 print "\n#ifdef INCLUDE_FUNCTION_TABLE\n";
70 print "static FUNCTION functions[] = {\n";
82 foreach my $cmd (@ARGV) {
83 my $str=" { FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options },\n";
85 print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n";
86 } elsif (grep { $cmd eq $_ } @disablables) {
87 print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
88 } elsif (my $disabler = $cmd_disabler{$cmd}) {
89 print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
96 blake2b512 => "blake2",
97 blake2s256 => "blake2",
102 "sha1", "sha224", "sha256", "sha384", "sha512",
103 "mdc2", "rmd160", "blake2b512", "blake2s256"
105 my $str = " { FT_md, \"".$cmd."\", dgst_main},\n";
106 if (grep { $cmd eq $_ } @disablables) {
107 print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
108 } elsif (my $disabler = $md_disabler{$cmd}) {
109 print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
115 my %cipher_disabler = (
121 "aes-128-cbc", "aes-128-ecb",
122 "aes-192-cbc", "aes-192-ecb",
123 "aes-256-cbc", "aes-256-ecb",
124 "camellia-128-cbc", "camellia-128-ecb",
125 "camellia-192-cbc", "camellia-192-ecb",
126 "camellia-256-cbc", "camellia-256-ecb",
128 "des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
129 "rc2", "bf", "cast", "rc5",
130 "des-ecb", "des-ede", "des-ede3",
131 "des-cbc", "des-ede-cbc","des-ede3-cbc",
132 "des-cfb", "des-ede-cfb","des-ede3-cfb",
133 "des-ofb", "des-ede-ofb","des-ede3-ofb",
134 "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
135 "seed-cbc","seed-ecb", "seed-cfb", "seed-ofb",
136 "rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
137 "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
138 "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
139 "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb"
141 my $str=" { FT_cipher, \"$cmd\", enc_main, enc_options },\n";
142 (my $algo= $cmd) =~ s/-.*//g;
143 if ($cmd eq "zlib") {
144 print "#ifdef ZLIB\n${str}#endif\n";
145 } elsif (grep { $algo eq $_ } @disablables) {
146 print "#ifndef OPENSSL_NO_".uc($algo)."\n${str}#endif\n";
147 } elsif (my $disabler = $cipher_disabler{$algo}) {
148 print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
154 print " { 0, NULL, NULL}\n};\n";