[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Sat Mar 19 00:52:27 UTC 2016


The branch master has been updated
       via  769777b0a24c77377c612d84537c40a2b55abfa6 (commit)
       via  91056e72693b4ee8cb5339d9091871ffc3b6f776 (commit)
       via  04e2a527379ad12ca512aef4e838f94af22d7f79 (commit)
       via  a45d7d5388c6774a484cff4af13f188240d3d50b (commit)
       via  3850f8cb15f74fd9beeb9f0743f722d41c6bdb25 (commit)
      from  d4037cea3c26b7cfdc8cc518a31ba7a89081e931 (commit)


- Log -----------------------------------------------------------------
commit 769777b0a24c77377c612d84537c40a2b55abfa6
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Mar 19 00:57:35 2016 +0100

    Use the dependencies received in generatesrc()
    
    generatesrc() did already receive dependency information, but never
    used it, and never really needed to...  until now.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 91056e72693b4ee8cb5339d9091871ffc3b6f776
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Mar 19 00:51:51 2016 +0100

    Ignore the generated apps/progs.h
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 04e2a527379ad12ca512aef4e838f94af22d7f79
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Mar 19 00:50:49 2016 +0100

    Generate apps/progs.h on the fly
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit a45d7d5388c6774a484cff4af13f188240d3d50b
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Mar 19 00:43:43 2016 +0100

    Include progs.h directly in openssl.c instead of via apps.h
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 3850f8cb15f74fd9beeb9f0743f722d41c6bdb25
Author: Richard Levitte <levitte at openssl.org>
Date:   Sat Mar 19 00:41:14 2016 +0100

    Make apps/progs.pl more flexible
    
    Make Configure write @disablables to configdata.pm and have
    apps/progs.pl use that data.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 .gitignore                           |   5 +-
 Configurations/descrip.mms.tmpl      |   3 +-
 Configurations/unix-Makefile.tmpl    |  22 +-
 Configurations/windows-makefile.tmpl |   9 +-
 Configure                            |  10 +-
 apps/apps.h                          |   2 -
 apps/build.info                      |  25 +-
 apps/openssl.c                       |   2 +-
 apps/progs.h                         | 428 -----------------------------------
 apps/progs.pl                        | 128 ++++++-----
 10 files changed, 112 insertions(+), 522 deletions(-)
 delete mode 100644 apps/progs.h

diff --git a/.gitignore b/.gitignore
index 5bc9705..05127dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,10 +41,11 @@ Makefile
 
 
 # Auto generated headers
+/apps/progs.h
 /crypto/buildinf.h
-/openssl/include/opensslconf.h
 /crypto/include/internal/*_conf.h
-util/domd
+/openssl/include/opensslconf.h
+/util/domd
 
 # Auto generated assembly language source files
 *.s
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index 512b8e5..32c8d1a 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -418,10 +418,11 @@ configdata.pm : {- join(" ", sourcefile("Configurations", "descrip.mms.tmpl"), s
   sub generatesrc {
       my %args = @_;
       my $generator = join(" ", @{$args{generator}});
+      my $deps = join(", -\n\t\t", @{$args{deps}});
 
       if ($args{src} !~ /\.[sS]$/) {
           return <<"EOF";
-$args{src} : $args{generator}->[0]
+$args{src} : $args{generator}->[0] $deps
 	\$(PERL) $generator > \$@
 EOF
       } else {
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index be6299b..77ba75b 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -617,7 +617,7 @@ generate: generate_apps generate_crypto_bn generate_crypto_objects
 lint:
 	lint -DLINT $(INCLUDES) $(SRCS)
 
-generate_apps: $(SRCDIR)/apps/openssl-vms.cnf $(SRCDIR)/apps/progs.h
+generate_apps: $(SRCDIR)/apps/openssl-vms.cnf
 
 generate_crypto_bn: $(SRCDIR)/crypto/bn/bn_prime.h
 
@@ -695,17 +695,6 @@ $(SRCDIR)/apps/openssl-vms.cnf: $(SRCDIR)/apps/openssl.cnf
 	$(PERL) $(SRCDIR)/VMS/VMSify-conf.pl \
                 < $(SRCDIR)/apps/openssl.cnf > $(SRCDIR)/apps/openssl-vms.cnf
 
-{- # because the program apps/openssl has object files as sources, and
-   # they then have the corresponding C files as source, we need to chain
-   # the lookups in %unified_info
-   my $apps_openssl = catfile("apps","openssl");
-   our @openssl_source = map { @{$unified_info{sources}->{$_}} }
-                         @{$unified_info{sources}->{$apps_openssl}};
-   ""; -}
-$(SRCDIR)/apps/progs.h:
-	$(RM) $@
-	$(PERL) $(SRCDIR)/apps/progs.pl {- join(" ", @openssl_source) -} > $@
-
 $(SRCDIR)/crypto/bn/bn_prime.h: $(SRCDIR)/crypto/bn/bn_prime.pl
 	$(PERL) $(SRCDIR)/crypto/bn/bn_prime.pl > $(SRCDIR)/crypto/bn/bn_prime.h
 
@@ -813,10 +802,11 @@ configdata.pm: $(SRCDIR)/Configurations/unix-Makefile.tmpl $(SRCDIR)/Configurati
       my %args = @_;
       my $generator = join(" ", @{$args{generator}});
       my $incs = join("", map { " -I".$_ } @{$args{incs}});
+      my $deps = join(" ", @{$args{deps}});
 
       if ($args{src} !~ /\.[sS]$/) {
           return <<"EOF";
-$args{src}: $args{generator}->[0]
+$args{src}: $args{generator}->[0] $deps
 	\$(PERL) $generator > \$@
 EOF
       } else {
@@ -836,7 +826,7 @@ EOF
               if ($args{src} =~ /\.S$/) {
                    (my $target = $args{src}) =~ s|\.S$|.s|;
                    return <<"EOF";
-$target: $args{generator}->[0]
+$target: $args{generator}->[0] $deps
 	( trap "rm -f \$@.*" INT 0; \\
 	  $generator \$@.S; \\
 	  \$(CC) \$(CFLAGS) $incs -E -P \$@.S > \$@.i && mv -f \$@.i \$@ )
@@ -844,12 +834,12 @@ EOF
               }
               # Otherwise....
               return <<"EOF";
-$args{src}: $args{generator}->[0]
+$args{src}: $args{generator}->[0] $deps
 	$generator \$@
 EOF
           }
           return <<"EOF";
-$args{src}: $args{generator}->[0]
+$args{src}: $args{generator}->[0] $deps
 	\$(CC) \$(CFLAGS) $incs -E -P \$< > \$@
 EOF
       }
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index 177d277..f40404c 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -243,10 +243,11 @@ configdata.pm: {- $config{build_file_template} -} $(SRCDIR)\Configure
       (my $target = $args{src}) =~ s/\.[sS]$/.asm/;
       my $generator = join(" ", @{$args{generator}});
       my $incs = join("", map { " /I ".$_ } @{$args{incs}});
+      my $deps = join(" ", @{$args{deps}});
 
       if ($target !~ /\.asm$/) {
           return <<"EOF";
-$target: $args{generator}->[0]
+$target: $args{generator}->[0] $deps
 	\$(PERL) $generator > \$@
 EOF
       } else {
@@ -263,7 +264,7 @@ EOF
               # end up generating foo.s in two steps.
               if ($args{src} =~ /\.S$/) {
                    return <<"EOF";
-$target: $args{generator}->[0]
+$target: $args{generator}->[0] $deps
 	set ASM=\$(AS)
 	set CC=\$(CC)
 	$generator \$@.S
@@ -273,14 +274,14 @@ EOF
               }
               # Otherwise....
               return <<"EOF";
-$target: $args{generator}->[0]
+$target: $args{generator}->[0] $deps
 	set ASM=\$(AS)
 	set CC=\$(CC)
 	$generator \$@
 EOF
           }
           return <<"EOF";
-$target: $args{generator}->[0]
+$target: $args{generator}->[0] $deps
 	\$(CC) \$(CFLAGS) $incs /EP /C \$< > \$@
 EOF
       }
diff --git a/Configure b/Configure
index 557ea22..255c2cc 100755
--- a/Configure
+++ b/Configure
@@ -1664,7 +1664,7 @@ use warnings;
 use Exporter;
 #use vars qw(\@ISA \@EXPORT);
 our \@ISA = qw(Exporter);
-our \@EXPORT = qw(\%config \%target \%disabled \%withargs \%unified_info);
+our \@EXPORT = qw(\%config \%target \%disabled \%withargs \%unified_info \@disablables);
 
 EOF
 print OUT "our %config = (\n";
@@ -1702,6 +1702,14 @@ print OUT <<"EOF";
 );
 
 EOF
+print OUT "our \@disablables = (\n";
+foreach (@disablables) {
+    print OUT "  ", quotify("perl", $_), ",\n";
+}
+print OUT <<"EOF";
+);
+
+EOF
 print OUT "our \%disabled = (\n";
 foreach (sort keys %disabled) {
     print OUT "  ", quotify("perl", $_), " => ", quotify("perl", $disabled{$_}), ",\n";
diff --git a/apps/apps.h b/apps/apps.h
index e7ea461..633b344 100644
--- a/apps/apps.h
+++ b/apps/apps.h
@@ -631,6 +631,4 @@ extern int verify_quiet;
 extern int verify_error;
 extern int verify_return_error;
 
-# include "progs.h"
-
 #endif
diff --git a/apps/build.info b/apps/build.info
index d581aad..0d4aad3 100644
--- a/apps/build.info
+++ b/apps/build.info
@@ -1,16 +1,27 @@
-{- use File::Spec::Functions qw/catdir rel2abs/; -}
+{- use File::Spec::Functions qw/catdir rel2abs/;
+   our @cmd_srcs = (
+        "asn1pars.c", "ca.c", "ciphers.c", "cms.c", "crl.c", "crl2p7.c",
+        "dgst.c", "dhparam.c", "dsa.c", "dsaparam.c", "ec.c", "ecparam.c",
+        "enc.c", "engine.c", "errstr.c", "gendsa.c", "genpkey.c", "genrsa.c",
+        "nseq.c", "ocsp.c", "passwd.c", "pkcs12.c", "pkcs7.c", "pkcs8.c",
+        "pkey.c", "pkeyparam.c", "pkeyutl.c", "prime.c", "rand.c", "req.c",
+        "rsa.c", "rsautl.c", "s_client.c", "s_server.c", "s_time.c",
+        "sess_id.c", "smime.c", "speed.c", "spkac.c", "srp.c", "ts.c",
+        "verify.c", "version.c", "x509.c", "rehash.c",
+   );
+   "";
+ -}
 PROGRAMS=openssl
 SOURCE[openssl]=\
         openssl.c \
-        asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c dhparam.c \
-        dsa.c dsaparam.c ec.c ecparam.c enc.c engine.c errstr.c gendsa.c \
-        genpkey.c genrsa.c nseq.c ocsp.c passwd.c pkcs12.c pkcs7.c pkcs8.c \
-        pkey.c pkeyparam.c pkeyutl.c prime.c rand.c req.c rsa.c rsautl.c \
-        s_client.c s_server.c s_time.c sess_id.c smime.c speed.c spkac.c \
-        srp.c ts.c verify.c version.c x509.c rehash.c \
+        {- join(" ", @cmd_srcs); -} \
         apps.c opt.c s_cb.c s_socket.c \
         app_rand.c \
         {- $target{apps_aux_src} -}
+DEPEND[openssl.o]=progs.h
+DEPEND[progs.h]={- join(" ", @cmd_srcs); -} ../configdata.pm
+GENERATE[progs.h]=progs.pl {- join(" ", map { catdir($sourcedir, $_) } @cmd_srcs); -}
+
 INCLUDE[openssl]={- rel2abs(catdir($builddir,"../include")) -} .. ../include
 DEPEND[openssl]=../libssl
 
diff --git a/apps/openssl.c b/apps/openssl.c
index d460a6b..b6ac557 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -132,8 +132,8 @@
 #ifdef OPENSSL_SYS_VMS
 # include <unixio.h>
 #endif
-#define INCLUDE_FUNCTION_TABLE
 #include "apps.h"
+#include "progs.h"
 
 
 #ifdef OPENSSL_NO_CAMELLIA
diff --git a/apps/progs.h b/apps/progs.h
deleted file mode 100644
index 3bdf821..0000000
--- a/apps/progs.h
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Automatically generated by progs.pl for openssl.c
- * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
- * See the openssl.c for copyright details.
- */
-
-typedef enum FUNC_TYPE {
-    FT_none, FT_general, FT_md, FT_cipher, FT_pkey,
-    FT_md_alg, FT_cipher_alg
-} FUNC_TYPE;
-
-typedef struct function_st {
-    FUNC_TYPE type;
-    const char *name;
-    int (*func)(int argc,char *argv[]);
-    const OPTIONS *help;
-} FUNCTION;
-
-DEFINE_LHASH_OF(FUNCTION);
-
-extern int asn1parse_main(int argc, char *argv[]);
-extern int ca_main(int argc, char *argv[]);
-extern int ciphers_main(int argc, char *argv[]);
-extern int cms_main(int argc, char *argv[]);
-extern int crl_main(int argc, char *argv[]);
-extern int crl2pkcs7_main(int argc, char *argv[]);
-extern int dgst_main(int argc, char *argv[]);
-extern int dhparam_main(int argc, char *argv[]);
-extern int dsa_main(int argc, char *argv[]);
-extern int dsaparam_main(int argc, char *argv[]);
-extern int ec_main(int argc, char *argv[]);
-extern int ecparam_main(int argc, char *argv[]);
-extern int enc_main(int argc, char *argv[]);
-extern int engine_main(int argc, char *argv[]);
-extern int errstr_main(int argc, char *argv[]);
-extern int exit_main(int argc, char *argv[]);
-extern int gendsa_main(int argc, char *argv[]);
-extern int genpkey_main(int argc, char *argv[]);
-extern int genrsa_main(int argc, char *argv[]);
-extern int help_main(int argc, char *argv[]);
-extern int list_main(int argc, char *argv[]);
-extern int nseq_main(int argc, char *argv[]);
-extern int ocsp_main(int argc, char *argv[]);
-extern int passwd_main(int argc, char *argv[]);
-extern int pkcs12_main(int argc, char *argv[]);
-extern int pkcs7_main(int argc, char *argv[]);
-extern int pkcs8_main(int argc, char *argv[]);
-extern int pkey_main(int argc, char *argv[]);
-extern int pkeyparam_main(int argc, char *argv[]);
-extern int pkeyutl_main(int argc, char *argv[]);
-extern int prime_main(int argc, char *argv[]);
-extern int rand_main(int argc, char *argv[]);
-extern int rehash_main(int argc, char *argv[]);
-extern int req_main(int argc, char *argv[]);
-extern int rsa_main(int argc, char *argv[]);
-extern int rsautl_main(int argc, char *argv[]);
-extern int s_client_main(int argc, char *argv[]);
-extern int s_server_main(int argc, char *argv[]);
-extern int s_time_main(int argc, char *argv[]);
-extern int sess_id_main(int argc, char *argv[]);
-extern int smime_main(int argc, char *argv[]);
-extern int speed_main(int argc, char *argv[]);
-extern int spkac_main(int argc, char *argv[]);
-extern int srp_main(int argc, char *argv[]);
-extern int ts_main(int argc, char *argv[]);
-extern int verify_main(int argc, char *argv[]);
-extern int version_main(int argc, char *argv[]);
-extern int x509_main(int argc, char *argv[]);
-
-extern OPTIONS asn1parse_options[];
-extern OPTIONS ca_options[];
-extern OPTIONS ciphers_options[];
-extern OPTIONS cms_options[];
-extern OPTIONS crl_options[];
-extern OPTIONS crl2pkcs7_options[];
-extern OPTIONS dgst_options[];
-extern OPTIONS dhparam_options[];
-extern OPTIONS dsa_options[];
-extern OPTIONS dsaparam_options[];
-extern OPTIONS ec_options[];
-extern OPTIONS ecparam_options[];
-extern OPTIONS enc_options[];
-extern OPTIONS engine_options[];
-extern OPTIONS errstr_options[];
-extern OPTIONS exit_options[];
-extern OPTIONS gendsa_options[];
-extern OPTIONS genpkey_options[];
-extern OPTIONS genrsa_options[];
-extern OPTIONS help_options[];
-extern OPTIONS list_options[];
-extern OPTIONS nseq_options[];
-extern OPTIONS ocsp_options[];
-extern OPTIONS passwd_options[];
-extern OPTIONS pkcs12_options[];
-extern OPTIONS pkcs7_options[];
-extern OPTIONS pkcs8_options[];
-extern OPTIONS pkey_options[];
-extern OPTIONS pkeyparam_options[];
-extern OPTIONS pkeyutl_options[];
-extern OPTIONS prime_options[];
-extern OPTIONS rand_options[];
-extern OPTIONS rehash_options[];
-extern OPTIONS req_options[];
-extern OPTIONS rsa_options[];
-extern OPTIONS rsautl_options[];
-extern OPTIONS s_client_options[];
-extern OPTIONS s_server_options[];
-extern OPTIONS s_time_options[];
-extern OPTIONS sess_id_options[];
-extern OPTIONS smime_options[];
-extern OPTIONS speed_options[];
-extern OPTIONS spkac_options[];
-extern OPTIONS srp_options[];
-extern OPTIONS ts_options[];
-extern OPTIONS verify_options[];
-extern OPTIONS version_options[];
-extern OPTIONS x509_options[];
-
-#ifdef INCLUDE_FUNCTION_TABLE
-static FUNCTION functions[] = {
-    { FT_general, "asn1parse", asn1parse_main, asn1parse_options },
-    { FT_general, "ca", ca_main, ca_options },
-#if !defined(OPENSSL_NO_SOCK)
-    { FT_general, "ciphers", ciphers_main, ciphers_options },
-#endif
-#ifndef OPENSSL_NO_CMS
-    { FT_general, "cms", cms_main, cms_options },
-#endif
-    { FT_general, "crl", crl_main, crl_options },
-    { FT_general, "crl2pkcs7", crl2pkcs7_main, crl2pkcs7_options },
-    { FT_general, "dgst", dgst_main, dgst_options },
-#ifndef OPENSSL_NO_DH
-    { FT_general, "dhparam", dhparam_main, dhparam_options },
-#endif
-#ifndef OPENSSL_NO_DSA
-    { FT_general, "dsa", dsa_main, dsa_options },
-#endif
-#ifndef OPENSSL_NO_DSA
-    { FT_general, "dsaparam", dsaparam_main, dsaparam_options },
-#endif
-#ifndef OPENSSL_NO_EC
-    { FT_general, "ec", ec_main, ec_options },
-#endif
-#ifndef OPENSSL_NO_EC
-    { FT_general, "ecparam", ecparam_main, ecparam_options },
-#endif
-    { FT_general, "enc", enc_main, enc_options },
-#ifndef OPENSSL_NO_ENGINE
-    { FT_general, "engine", engine_main, engine_options },
-#endif
-    { FT_general, "errstr", errstr_main, errstr_options },
-    { FT_general, "exit", exit_main, exit_options },
-#ifndef OPENSSL_NO_DSA
-    { FT_general, "gendsa", gendsa_main, gendsa_options },
-#endif
-    { FT_general, "genpkey", genpkey_main, genpkey_options },
-#ifndef OPENSSL_NO_RSA
-    { FT_general, "genrsa", genrsa_main, genrsa_options },
-#endif
-    { FT_general, "help", help_main, help_options },
-    { FT_general, "list", list_main, list_options },
-    { FT_general, "nseq", nseq_main, nseq_options },
-#ifndef OPENSSL_NO_OCSP
-    { FT_general, "ocsp", ocsp_main, ocsp_options },
-#endif
-    { FT_general, "passwd", passwd_main, passwd_options },
-#if !defined(OPENSSL_NO_DES)
-    { FT_general, "pkcs12", pkcs12_main, pkcs12_options },
-#endif
-    { FT_general, "pkcs7", pkcs7_main, pkcs7_options },
-    { FT_general, "pkcs8", pkcs8_main, pkcs8_options },
-    { FT_general, "pkey", pkey_main, pkey_options },
-    { FT_general, "pkeyparam", pkeyparam_main, pkeyparam_options },
-    { FT_general, "pkeyutl", pkeyutl_main, pkeyutl_options },
-    { FT_general, "prime", prime_main, prime_options },
-    { FT_general, "rand", rand_main, rand_options },
-    { FT_general, "rehash", rehash_main, rehash_options },
-    { FT_general, "req", req_main, req_options },
-#ifndef OPENSSL_NO_RSA
-    { FT_general, "rsa", rsa_main, rsa_options },
-#endif
-#ifndef OPENSSL_NO_RSA
-    { FT_general, "rsautl", rsautl_main, rsautl_options },
-#endif
-#if !defined(OPENSSL_NO_SOCK)
-    { FT_general, "s_client", s_client_main, s_client_options },
-#endif
-#if !defined(OPENSSL_NO_SOCK)
-    { FT_general, "s_server", s_server_main, s_server_options },
-#endif
-#if !defined(OPENSSL_NO_SOCK)
-    { FT_general, "s_time", s_time_main, s_time_options },
-#endif
-    { FT_general, "sess_id", sess_id_main, sess_id_options },
-    { FT_general, "smime", smime_main, smime_options },
-    { FT_general, "speed", speed_main, speed_options },
-    { FT_general, "spkac", spkac_main, spkac_options },
-#ifndef OPENSSL_NO_SRP
-    { FT_general, "srp", srp_main, srp_options },
-#endif
-#ifndef OPENSSL_NO_TS
-    { FT_general, "ts", ts_main, ts_options },
-#endif
-    { FT_general, "verify", verify_main, verify_options },
-    { FT_general, "version", version_main, version_options },
-    { FT_general, "x509", x509_main, x509_options },
-#ifndef OPENSSL_NO_MD2
-    { FT_md, "md2", dgst_main},
-#endif
-#ifndef OPENSSL_NO_MD4
-    { FT_md, "md4", dgst_main},
-#endif
-#ifndef OPENSSL_NO_MD5
-    { FT_md, "md5", dgst_main},
-#endif
-#ifndef OPENSSL_NO_MD_GHOST94
-    { FT_md, "md_ghost94", dgst_main},
-#endif
-    { FT_md, "sha1", dgst_main},
-    { FT_md, "sha224", dgst_main},
-    { FT_md, "sha256", dgst_main},
-    { FT_md, "sha384", dgst_main},
-    { FT_md, "sha512", dgst_main},
-#ifndef OPENSSL_NO_MDC2
-    { FT_md, "mdc2", dgst_main},
-#endif
-#ifndef OPENSSL_NO_RMD160
-    { FT_md, "rmd160", dgst_main},
-#endif
-#ifndef OPENSSL_NO_BLAKE2
-    { FT_md, "blake2b512", dgst_main},
-#endif
-#ifndef OPENSSL_NO_BLAKE2
-    { FT_md, "blake2s256", dgst_main},
-#endif
-#ifndef OPENSSL_NO_AES
-    { FT_cipher, "aes-128-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_AES
-    { FT_cipher, "aes-128-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_AES
-    { FT_cipher, "aes-192-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_AES
-    { FT_cipher, "aes-192-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_AES
-    { FT_cipher, "aes-256-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_AES
-    { FT_cipher, "aes-256-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-128-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-128-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-192-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-192-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-256-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAMELLIA
-    { FT_cipher, "camellia-256-ecb", enc_main, enc_options },
-#endif
-    { FT_cipher, "base64", enc_main, enc_options },
-#ifdef ZLIB
-    { FT_cipher, "zlib", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des3", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "desx", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC4
-    { FT_cipher, "rc4", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC4
-    { FT_cipher, "rc4-40", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_DES
-    { FT_cipher, "des-ede3-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_IDEA
-    { FT_cipher, "idea-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_SEED
-    { FT_cipher, "seed-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-64-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC2
-    { FT_cipher, "rc2-40-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_BF
-    { FT_cipher, "bf-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast5-ofb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_CAST
-    { FT_cipher, "cast-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-cbc", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-ecb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-cfb", enc_main, enc_options },
-#endif
-#ifndef OPENSSL_NO_RC5
-    { FT_cipher, "rc5-ofb", enc_main, enc_options },
-#endif
-    { 0, NULL, NULL}
-};
-#endif
diff --git a/apps/progs.pl b/apps/progs.pl
index 11bcbef..50b6cee 100644
--- a/apps/progs.pl
+++ b/apps/progs.pl
@@ -1,9 +1,19 @@
 #!/usr/bin/perl
+
+# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
+#
+# Licensed under the OpenSSL licenses, (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# https://www.openssl.org/source/license.html
+# or in the file LICENSE in the source distribution.
+
 # Generate progs.h file by looking for command mains in list of C files
 # passed on the command line.
 
 use strict;
 use warnings;
+use configdata qw/@disablables/;
 
 my %commands = ();
 my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
@@ -22,8 +32,13 @@ foreach my $filename (@ARGV) {
 print <<'EOF';
 /*
  * Automatically generated by progs.pl for openssl.c
- * Copyright (c) 2008 The OpenSSL Project.  All rights reserved.
- * See the openssl.c for copyright details.
+ * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL licenses, (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.openssl.org/source/license.html
+ * or in the file LICENSE in the source distribution.
  */
 
 typedef enum FUNC_TYPE {
@@ -51,54 +66,63 @@ print "\n";
 foreach (@ARGV) {
 	printf "extern OPTIONS %s_options[];\n", $_;
 }
-print "\n#ifdef INCLUDE_FUNCTION_TABLE\n";
-print "static FUNCTION functions[] = {\n";
-foreach (@ARGV) {
-	my $str="    { FT_general, \"$_\", ${_}_main, ${_}_options },\n";
-	if (/^s_/ || /^ciphers$/) {
-		print "#if !defined(OPENSSL_NO_SOCK)\n${str}#endif\n";
-	} elsif (/^engine$/) {
-		print "#ifndef OPENSSL_NO_ENGINE\n${str}#endif\n";
-	} elsif (/^rsa$/ || /^genrsa$/ || /^rsautl$/) {
-		print "#ifndef OPENSSL_NO_RSA\n${str}#endif\n";
-	} elsif (/^dsa$/ || /^gendsa$/ || /^dsaparam$/) {
-		print "#ifndef OPENSSL_NO_DSA\n${str}#endif\n";
-	} elsif (/^ec$/ || /^ecparam$/) {
-		print "#ifndef OPENSSL_NO_EC\n${str}#endif\n";
-	} elsif (/^dh$/ || /^gendh$/ || /^dhparam$/) {
-		print "#ifndef OPENSSL_NO_DH\n${str}#endif\n";
-	} elsif (/^pkcs12$/) {
-		print "#if !defined(OPENSSL_NO_DES)\n${str}#endif\n";
-	} elsif (/^cms$/) {
-		print "#ifndef OPENSSL_NO_CMS\n${str}#endif\n";
-	} elsif (/^ocsp$/) {
-		print "#ifndef OPENSSL_NO_OCSP\n${str}#endif\n";
-	} elsif (/^srp$/) {
-		print "#ifndef OPENSSL_NO_SRP\n${str}#endif\n";
-	} elsif (/^ts$/) {
-		print "#ifndef OPENSSL_NO_TS\n${str}#endif\n";
+
+my %cmd_disabler = (
+    ciphers  => "sock",
+    genrsa   => "rsa",
+    rsautl   => "rsa",
+    gendsa   => "dsa",
+    dsaparam => "dsa",
+    gendh    => "dh",
+    dhparam  => "dh",
+    ecparam  => "ec",
+    pkcs12   => "des",
+    );
+print "\nstatic FUNCTION functions[] = {\n";
+foreach my $cmd (@ARGV) {
+	my $str="    { FT_general, \"$cmd\", ${cmd}_main, ${cmd}_options },\n";
+	if ($cmd =~ /^s_/) {
+		print "#ifndef OPENSSL_NO_SOCK\n${str}#endif\n";
+	} elsif (grep { $cmd eq $_ } @disablables) {
+		print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
+	} elsif (my $disabler = $cmd_disabler{$cmd}) {
+		print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
 	} else {
 		print $str;
 	}
 }
 
-foreach (
+my %md_disabler = (
+    sha1       => "sha",
+    sha224     => "sha",
+    sha256     => "sha",
+    sha384     => "sha",
+    sha512     => "sha",
+    blake2b512 => "blake2",
+    blake2s256 => "blake2",
+    );
+foreach my $cmd (
 	"md2", "md4", "md5",
 	"md_ghost94",
 	"sha1", "sha224", "sha256", "sha384", "sha512",
 	"mdc2", "rmd160", "blake2b512", "blake2s256"
 ) {
-        my $str = "    { FT_md, \"".$_."\", dgst_main},\n";
-        if (/blake2/) {
-                print "#ifndef OPENSSL_NO_BLAKE2\n${str}#endif\n";
-        } elsif (/sha/) {
-                print "${str}";
+        my $str = "    { FT_md, \"".$cmd."\", dgst_main},\n";
+        if (grep { $cmd eq $_ } @disablables) {
+                print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
+        } elsif (my $disabler = $md_disabler{$cmd}) {
+                print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
         } else {
-                print "#ifndef OPENSSL_NO_".uc($_)."\n${str}#endif\n";
+                print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
         }
 }
 
-foreach (
+my %cipher_disabler = (
+    des3  => "des",
+    desx  => "des",
+    cast5 => "cast",
+    );
+foreach my $cmd (
 	"aes-128-cbc", "aes-128-ecb",
 	"aes-192-cbc", "aes-192-ecb",
 	"aes-256-cbc", "aes-256-ecb",
@@ -119,33 +143,17 @@ foreach (
 	"cast5-cbc","cast5-ecb", "cast5-cfb","cast5-ofb",
 	"cast-cbc", "rc5-cbc",   "rc5-ecb",  "rc5-cfb",  "rc5-ofb"
 ) {
-	my $str="    { FT_cipher, \"$_\", enc_main, enc_options },\n";
-	if (/des/) {
-		printf "#ifndef OPENSSL_NO_DES\n${str}#endif\n";
-	} elsif (/aes/) {
-		printf "#ifndef OPENSSL_NO_AES\n${str}#endif\n";
-	} elsif (/camellia/) {
-		printf "#ifndef OPENSSL_NO_CAMELLIA\n${str}#endif\n";
-	} elsif (/idea/) {
-		printf "#ifndef OPENSSL_NO_IDEA\n${str}#endif\n";
-	} elsif (/seed/) {
-		printf "#ifndef OPENSSL_NO_SEED\n${str}#endif\n";
-	} elsif (/rc4/) {
-		printf "#ifndef OPENSSL_NO_RC4\n${str}#endif\n";
-	} elsif (/rc2/) {
-		printf "#ifndef OPENSSL_NO_RC2\n${str}#endif\n";
-	} elsif (/bf/) {
-		printf "#ifndef OPENSSL_NO_BF\n${str}#endif\n";
-	} elsif (/cast/) {
-		printf "#ifndef OPENSSL_NO_CAST\n${str}#endif\n";
-	} elsif (/rc5/) {
-		printf "#ifndef OPENSSL_NO_RC5\n${str}#endif\n";
-	} elsif (/zlib/) {
-		printf "#ifdef ZLIB\n${str}#endif\n";
+	my $str="    { FT_cipher, \"$cmd\", enc_main, enc_options },\n";
+	(my $algo= $cmd) =~ s/-.*//g;
+        if ($cmd eq "zlib") {
+                print "#ifdef ZLIB\n${str}#endif\n";
+        } elsif (grep { $algo eq $_ } @disablables) {
+                print "#ifndef OPENSSL_NO_".uc($algo)."\n${str}#endif\n";
+        } elsif (my $disabler = $cipher_disabler{$algo}) {
+                print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
 	} else {
 		print $str;
 	}
 }
 
 print "    { 0, NULL, NULL}\n};\n";
-printf "#endif\n";


More information about the openssl-commits mailing list