2 # Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (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/;
17 my $opt = shift @ARGV;
18 die "Unrecognised option, must be -C or -H\n"
19 unless ($opt eq '-H' || $opt eq '-C');
22 my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
23 my $apps_openssl = shift @ARGV;
24 my $YEAR = [localtime()]->[5] + 1900;
26 # because the program apps/openssl has object files as sources, and
27 # they then have the corresponding C files as source, we need to chain
28 # the lookups in %unified_info
30 map { @{$unified_info{sources}->{$_}} }
32 @{$unified_info{sources}->{$apps_openssl}};
34 foreach my $filename (@openssl_source) {
35 open F, $filename or die "Couldn't open $filename: $!\n";
36 foreach ( grep /$cmdre/, <F> ) {
43 @ARGV = sort keys %commands;
48 * WARNING: do not edit!
49 * Generated by apps/progs.pl
51 * Copyright 1995-$YEAR The OpenSSL Project Authors. All Rights Reserved.
53 * Licensed under the Apache License 2.0 (the "License"). You may not use
54 * this file except in compliance with the License. You can obtain a copy
55 * in the file LICENSE in the source distribution or at
56 * https://www.openssl.org/source/license.html
64 printf "extern int %s_main(int argc, char *argv[]);\n", $_;
69 printf "extern const OPTIONS %s_options[];\n", $_;
72 print "extern FUNCTION functions[];\n";
78 * WARNING: do not edit!
79 * Generated by apps/progs.pl
81 * Copyright 1995-$YEAR The OpenSSL Project Authors. All Rights Reserved.
83 * Licensed under the Apache License 2.0 (the "License"). You may not use
84 * this file except in compliance with the License. You can obtain a copy
85 * in the file LICENSE in the source distribution or at
86 * https://www.openssl.org/source/license.html
105 print "FUNCTION functions[] = {\n";
106 foreach my $cmd ( @ARGV ) {
108 " {FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options},\n";
110 print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n";
111 } elsif (grep { $cmd eq $_ } @disablables) {
112 print "#ifndef OPENSSL_NO_" . uc($cmd) . "\n${str}#endif\n";
113 } elsif (my $disabler = $cmd_disabler{$cmd}) {
114 print "#ifndef OPENSSL_NO_" . uc($disabler) . "\n${str}#endif\n";
121 blake2b512 => "blake2",
122 blake2s256 => "blake2",
127 "sha1", "sha224", "sha256", "sha384",
128 "sha512", "sha512-224", "sha512-256",
129 "sha3-224", "sha3-256", "sha3-384", "sha3-512",
130 "shake128", "shake256",
131 "mdc2", "rmd160", "blake2b512", "blake2s256",
134 my $str = " {FT_md, \"$cmd\", dgst_main},\n";
135 if (grep { $cmd eq $_ } @disablables) {
136 print "#ifndef OPENSSL_NO_" . uc($cmd) . "\n${str}#endif\n";
137 } elsif (my $disabler = $md_disabler{$cmd}) {
138 print "#ifndef OPENSSL_NO_" . uc($disabler) . "\n${str}#endif\n";
144 my %cipher_disabler = (
150 "aes-128-cbc", "aes-128-ecb",
151 "aes-192-cbc", "aes-192-ecb",
152 "aes-256-cbc", "aes-256-ecb",
153 "aria-128-cbc", "aria-128-cfb",
154 "aria-128-ctr", "aria-128-ecb", "aria-128-ofb",
155 "aria-128-cfb1", "aria-128-cfb8",
156 "aria-192-cbc", "aria-192-cfb",
157 "aria-192-ctr", "aria-192-ecb", "aria-192-ofb",
158 "aria-192-cfb1", "aria-192-cfb8",
159 "aria-256-cbc", "aria-256-cfb",
160 "aria-256-ctr", "aria-256-ecb", "aria-256-ofb",
161 "aria-256-cfb1", "aria-256-cfb8",
162 "camellia-128-cbc", "camellia-128-ecb",
163 "camellia-192-cbc", "camellia-192-ecb",
164 "camellia-256-cbc", "camellia-256-ecb",
166 "des", "des3", "desx", "idea", "seed", "rc4", "rc4-40",
167 "rc2", "bf", "cast", "rc5",
168 "des-ecb", "des-ede", "des-ede3",
169 "des-cbc", "des-ede-cbc","des-ede3-cbc",
170 "des-cfb", "des-ede-cfb","des-ede3-cfb",
171 "des-ofb", "des-ede-ofb","des-ede3-ofb",
172 "idea-cbc","idea-ecb", "idea-cfb", "idea-ofb",
173 "seed-cbc","seed-ecb", "seed-cfb", "seed-ofb",
174 "rc2-cbc", "rc2-ecb", "rc2-cfb","rc2-ofb", "rc2-64-cbc", "rc2-40-cbc",
175 "bf-cbc", "bf-ecb", "bf-cfb", "bf-ofb",
176 "cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
177 "cast-cbc", "rc5-cbc", "rc5-ecb", "rc5-cfb", "rc5-ofb",
178 "sm4-cbc", "sm4-ecb", "sm4-cfb", "sm4-ofb", "sm4-ctr"
180 my $str = " {FT_cipher, \"$cmd\", enc_main, enc_options},\n";
181 (my $algo = $cmd) =~ s/-.*//g;
182 if ($cmd eq "zlib") {
183 print "#ifdef ZLIB\n${str}#endif\n";
184 } elsif (grep { $algo eq $_ } @disablables) {
185 print "#ifndef OPENSSL_NO_" . uc($algo) . "\n${str}#endif\n";
186 } elsif (my $disabler = $cipher_disabler{$algo}) {
187 print "#ifndef OPENSSL_NO_" . uc($disabler) . "\n${str}#endif\n";
193 print " {0, NULL, NULL}\n};\n";