[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Wed Feb 10 18:36:51 UTC 2016


The branch master has been updated
       via  f4a748a17d6a38f410acd342e8539d0e7196cbdb (commit)
       via  076e596ffb75e69c9f1aad5e06cabdd37595d695 (commit)
       via  9ca2529dbf5210e1e0413095f47d4cd79966bc94 (commit)
       via  e09621ff57f6965d30cc2d6b5045f93906d656a0 (commit)
      from  9cc55ddda5bbfde2e98fb94f312b960ab11a8c60 (commit)


- Log -----------------------------------------------------------------
commit f4a748a17d6a38f410acd342e8539d0e7196cbdb
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Feb 10 19:11:40 2016 +0100

    Produce buildinf.h on Windows the same way as on Unix
    
    Because ENGINESDIR and OPENSSLDIR typically contains backslashes, they
    need to be escaped just right.
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 076e596ffb75e69c9f1aad5e06cabdd37595d695
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Feb 10 19:09:05 2016 +0100

    Quote the CFLAG in Unixly Makefiles, for buildinf.h
    
    Because the command line definitions of OPENSSLDIR and ENGINESDIR
    contain quotes, we need a variant of CFLAG where backslashes and
    quotes are escaped when we produce buildinf.h
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit 9ca2529dbf5210e1e0413095f47d4cd79966bc94
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Feb 10 19:06:54 2016 +0100

    Make sure to escape backslashes and single quotes for buildinf.h
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

commit e09621ff57f6965d30cc2d6b5045f93906d656a0
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Feb 10 18:51:15 2016 +0100

    Make it possible to get ENGINESDIR info from OpenSSL_versions
    
    Have apps/openssl display the result along with OPENSSLDIR
    
    As part of this, add ENGINESDIR in util/mk1mf.pl
    
    Reviewed-by: Rich Salz <rsalz at openssl.org>

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

Summary of changes:
 Configurations/unix-Makefile.tmpl     |  3 +-
 Configure                             | 12 --------
 Makefile.in                           |  5 +--
 apps/version.c                        |  7 +++++
 crypto/Makefile.in                    |  2 +-
 crypto/build.info                     |  2 +-
 crypto/cversion.c                     |  7 +++++
 doc/apps/version.pod                  |  5 +++
 doc/crypto/OPENSSL_VERSION_NUMBER.pod |  5 +++
 include/openssl/crypto.h              |  1 +
 util/check-buildinfo.pl               | 43 ++++++++++++++++++++++++++
 util/mk1mf.pl                         | 57 ++++++++++++++---------------------
 util/mkbuildinf.pl                    | 29 +++++++++---------
 13 files changed, 111 insertions(+), 67 deletions(-)
 create mode 100644 util/check-buildinfo.pl

diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index 4888dd0..65f179d 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -92,7 +92,8 @@ HTMLSUFFIX=html
 
 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
 CC= $(CROSS_COMPILE){- $target{cc} -}
-CFLAGS={- join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
+CFLAGS={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
+CFLAGS_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
 DEPFLAGS= {- join(" ",map { "-D".$_} @{$config{depdefines}}) -}
 LDFLAGS= {- $config{lflags} -}
 PLIB_LDFLAGS= {- $config{plib_lflags} -}
diff --git a/Configure b/Configure
index 61d28a7..5afa63d 100755
--- a/Configure
+++ b/Configure
@@ -1793,18 +1793,6 @@ my %builders = (
         # The only reason we do this is to have something to build MINFO from
         build_Makefile();
 
-	open (OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
-	printf OUT <<"EOF";
-#ifndef MK1MF_BUILD
-  /* auto-generated by Configure for crypto/cversion.c:
-   * for Unix builds, crypto/Makefile.ssl generates functional definitions;
-   * Windows builds (and other mk1mf builds) compile cversion.c with
-   * -DMK1MF_BUILD and use definitions added to this file by util/mk1mf.pl. */
-  #error "Windows builds (PLATFORM=$target) use mk1mf.pl-created Makefiles"
-#endif
-EOF
-	close(OUT);
-
 	# create the ms/version32.rc file if needed
 	if ($platform ne "netware") {
 	    my ($v1, $v2, $v3, $v4);
diff --git a/Makefile.in b/Makefile.in
index 8083a54..a1c3252 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -90,7 +90,8 @@ ENGINESDIR={- use File::Spec::Functions;
 
 CROSS_COMPILE= {- $config{cross_compile_prefix} -}
 CC= $(CROSS_COMPILE){- $target{cc} -}
-CFLAG={- join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
+CFLAG={- our $cflags2 = join(" ",(map { "-D".$_} @{$config{defines}}),"-DOPENSSLDIR=\"\\\"\$(OPENSSLDIR)\\\"\"","-DENGINESDIR=\"\\\"\$(ENGINESDIR)\\\"\"") -} {- $config{cflags} -}
+CFLAG_Q={- $cflags2 =~ s|([\\"])|\\$1|g; $cflags2 -} {- $config{cflags} -}
 DEPFLAG= {- join(" ",map { "-D".$_} @{$config{depdefines}}) -}
 LDFLAG= {- $config{lflags} -}
 PLIB_LDFLAG= {- $config{plib_lflags} -}
@@ -243,7 +244,7 @@ CLEARENV=	TOP= && unset TOP $${LIB+LIB} $${LIBS+LIBS}	\
 # LC_ALL=C ensures that error [and other] messages are delivered in
 # same language for uniform treatment.
 BUILDENV=	LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
-		CC='$(CC)' CFLAG='$(CFLAG)' 			\
+		CC='$(CC)' CFLAG='$(CFLAG)' CFLAG_Q='$(CFLAG_Q)'	\
 		AS='$(CC)' ASFLAG='$(CFLAG) -c'			\
 		AR='$(AR)' NM='$(NM)' RANLIB='$(RANLIB)'	\
 		CROSS_COMPILE='$(CROSS_COMPILE)'	\
diff --git a/apps/version.c b/apps/version.c
index 073aa93..84929a5 100644
--- a/apps/version.c
+++ b/apps/version.c
@@ -141,6 +141,7 @@ OPTIONS version_options[] = {
     {"a", OPT_A, '-', "Show all data"},
     {"b", OPT_B, '-', "Show build date"},
     {"d", OPT_D, '-', "Show configuration directory"},
+    {"e", OPT_D, '-', "Show engines directory"},
     {"f", OPT_F, '-', "Show compiler flags used"},
     {"o", OPT_O, '-', "Show some internal datatype options"},
     {"p", OPT_P, '-', "Show target build platform"},
@@ -152,6 +153,7 @@ int version_main(int argc, char **argv)
 {
     int ret = 1, dirty = 0;
     int cflags = 0, version = 0, date = 0, options = 0, platform = 0, dir = 0;
+    int engdir = 0;
     char *prog;
     OPTION_CHOICE o;
 
@@ -172,6 +174,9 @@ int version_main(int argc, char **argv)
         case OPT_D:
             dirty = dir = 1;
             break;
+        case OPT_E:
+            dirty = engdir = 1;
+            break;
         case OPT_F:
             dirty = cflags = 1;
             break;
@@ -228,6 +233,8 @@ int version_main(int argc, char **argv)
         printf("%s\n", OpenSSL_version(OPENSSL_CFLAGS));
     if (dir)
         printf("%s\n", OpenSSL_version(OPENSSL_DIR));
+    if (engdir)
+        printf("%s\n", OpenSSL_version(OPENSSL_ENGINES_DIR));
     ret = 0;
  end:
     return (ret);
diff --git a/crypto/Makefile.in b/crypto/Makefile.in
index 4727e0a..69556f8 100644
--- a/crypto/Makefile.in
+++ b/crypto/Makefile.in
@@ -58,7 +58,7 @@ fips: cryptlib.o thr_id.o uid.o $(CPUID_OBJ)
 		done;
 
 buildinf.h: ../Makefile
-	$(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" >buildinf.h
+	$(PERL) $(TOP)/util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)" >buildinf.h
 
 x86cpuid.s:	x86cpuid.pl perlasm/x86asm.pl
 	$(PERL) x86cpuid.pl $(PERLASM_SCHEME) $(CFLAGS) $(PROCESSOR) > $@
diff --git a/crypto/build.info b/crypto/build.info
index b3591a0..9d04ba8 100644
--- a/crypto/build.info
+++ b/crypto/build.info
@@ -17,7 +17,7 @@ ENDRAW[descrip.mms]
 
 BEGINRAW[Makefile]
 crypto/buildinf.h : Makefile
-	$(PERL) $(SRCDIR)/util/mkbuildinf.pl "$(CC) $(CFLAGS)" "$(PLATFORM)" > crypto/buildinf.h
+	$(PERL) $(SRCDIR)/util/mkbuildinf.pl "$(CC) $(CFLAGS_Q)" "$(PLATFORM)" > crypto/buildinf.h
 
 ##### APPLINK, UPLINK and CPUID assembler implementations
 
diff --git a/crypto/cversion.c b/crypto/cversion.c
index 5405e5c..a13ccf4 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -102,5 +102,12 @@ const char *OpenSSL_version(int t)
         return "OPENSSLDIR: N/A";
 #endif
     }
+    if (t == OPENSSL_ENGINES_DIR) {
+#ifdef ENGINESDIR
+        return "ENGINESDIR: \"" ENGINESDIR "\"";
+#else
+        return "ENGINESDIR: N/A";
+#endif
+    }
     return ("not available");
 }
diff --git a/doc/apps/version.pod b/doc/apps/version.pod
index 8ab51dd..01f6d2a 100644
--- a/doc/apps/version.pod
+++ b/doc/apps/version.pod
@@ -15,6 +15,7 @@ B<openssl version>
 [B<-f>]
 [B<-p>]
 [B<-d>]
+[B<-e>]
 
 =head1 DESCRIPTION
 
@@ -56,6 +57,10 @@ platform setting.
 
 OPENSSLDIR setting.
 
+=item B<-e>
+
+ENGINESDIR setting.
+
 =back
 
 =head1 NOTES
diff --git a/doc/crypto/OPENSSL_VERSION_NUMBER.pod b/doc/crypto/OPENSSL_VERSION_NUMBER.pod
index fc16536..d87d719 100644
--- a/doc/crypto/OPENSSL_VERSION_NUMBER.pod
+++ b/doc/crypto/OPENSSL_VERSION_NUMBER.pod
@@ -77,6 +77,11 @@ if available or "platform: information not available" otherwise.
 The "OPENSSLDIR" setting of the library build in the form "OPENSSLDIR: "...""
 if available or "OPENSSLDIR: N/A" otherwise.
 
+=item OPENSSL_ENGINES_DIR
+
+The "ENGINESDIR" setting of the library build in the form "ENGINESDIR: "...""
+if available or "ENGINESDIR: N/A" otherwise.
+
 =back
 
 For an unknown B<t>, the text "not available" is returned.
diff --git a/include/openssl/crypto.h b/include/openssl/crypto.h
index d761a97..4199466 100644
--- a/include/openssl/crypto.h
+++ b/include/openssl/crypto.h
@@ -362,6 +362,7 @@ const char *OpenSSL_version(int type);
 # define OPENSSL_BUILT_ON         2
 # define OPENSSL_PLATFORM         3
 # define OPENSSL_DIR              4
+# define OPENSSL_ENGINES_DIR      5
 
 int OPENSSL_issetugid(void);
 
diff --git a/util/check-buildinfo.pl b/util/check-buildinfo.pl
new file mode 100644
index 0000000..176b956
--- /dev/null
+++ b/util/check-buildinfo.pl
@@ -0,0 +1,43 @@
+#! /usr/bin/perl
+
+my %MINFO_source = ();
+
+open my $minfo, "MINFO" or die "Couldn't open MINFO: $!\n";
+my $reldir = "";
+my $searchterm = "";
+my $goal = "";
+while (<$minfo>) {
+    chomp;
+
+    if (/^RELATIVE_DIRECTORY=(.*)$/) {
+        $reldir=$1;
+        next;
+    }
+
+    if (/^LIBSRC=(.*)$/) {
+        my @src = sort split(/\s+/, $1);
+        if ($reldir =~ m|^crypto(/.*)?$|) {
+            $MINFO_source{"libcrypto|$reldir"} = [ @src ];
+        } elsif ($reldir eq "ssl") {
+            $MINFO_source{"libssl|$reldir"} = [ @src ];
+        } elsif ($reldir ne "engines") {
+            warn "LIBSRC found in MINFO for $reldir";
+        }
+        next;
+    }
+
+    if (/^(?:TEST)?LIBNAMES=(.*)$/) {
+        my @names = sort split(/\s+/, $1);
+        if ($reldir eq "engines") {
+            push @{$MINFO_source{"engines|$reldir"}}, @names;
+        } else {
+            warn "(TEST)?LIBNAMES found in MINFO for $reldir";
+        }
+        next;
+    }
+    
+    } elsif ($reldir eq "apps") {
+        $searchterm = "EXE_SRC";
+        $goal = "apps|openssl";
+    } elsif ($reldir eq "engines") {
+        $searchterm = "
diff --git a/util/mk1mf.pl b/util/mk1mf.pl
index 1e72b90..07968c4 100755
--- a/util/mk1mf.pl
+++ b/util/mk1mf.pl
@@ -11,6 +11,7 @@ use Cwd;
 
 $INSTALLTOP="/usr/local";
 $OPENSSLDIR="/usr/local/ssl";
+$ENGINESDIR="/usr/local/lib/engines";
 $OPTIONS="";
 $ssl_version="";
 $banner="\t\@echo Building OpenSSL";
@@ -47,9 +48,11 @@ my %mf_import = (
 	OPTIONS        => \$OPTIONS,
 	INSTALLTOP     => \$INSTALLTOP,
 	OPENSSLDIR     => \$OPENSSLDIR,
+	ENGINESDIR     => \$ENGINESDIR,
 	PLATFORM       => \$mf_platform,
 	CC             => \$mf_cc,
 	CFLAG	       => \$mf_cflag,
+	CFLAG_Q	       => \$mf_cflag_q,
         DEPFLAG        => \$mf_depflag,
 	CPUID_OBJ      => \$mf_cpuid_asm,
 	BN_ASM	       => \$mf_bn_asm,
@@ -614,6 +617,15 @@ EOF
 
 my $asm_def = $orig_platform eq 'copy' ? "" : "ASM=$bin_dir$asm";
 
+$cflags =~ s/\((ENGINESDIR|OPENSSLDIR)\)/\(${1}_QQ\)/g;
+(my $cflags_q = $cflags) =~ s/([\\"])/\\$1/g;
+(my $INSTALLTOP_Q = $INSTALLTOP) =~ s/([\\"])/\\$1/g;
+(my $INSTALLTOP_QQ = $INSTALLTOP_Q) =~ s/\\/\\\\/g;
+(my $OPENSSLDIR_Q = $OPENSSLDIR) =~ s/([\\"])/\\$1/g;
+(my $OPENSSLDIR_QQ = $OPENSSLDIR_Q) =~ s/\\/\\\\/g;
+(my $ENGINESDIR_Q = $ENGINESDIR) =~ s/([\\"])/\\$1/g;
+(my $ENGINESDIR_QQ = $ENGINESDIR_Q) =~ s/\\/\\\\/g;
+
 $defs= <<"EOF";
 # N.B. You MUST use -j on FreeBSD.
 # This makefile has been automatically generated from the OpenSSL distribution.
@@ -635,12 +647,17 @@ $defs .= $preamble if defined $preamble;
 
 $defs.= <<"EOF";
 INSTALLTOP=$INSTALLTOP
+INSTALLTOP_QQ=$INSTALLTOP_QQ
 OPENSSLDIR=$OPENSSLDIR
+OPENSSLDIR_QQ=$OPENSSLDIR_QQ
+ENGINESDIR=$ENGINESDIR
+ENGINESDIR_QQ=$ENGINESDIR_QQ
 
 # Set your compiler options
 PLATFORM=$platform
 CC=$bin_dir${cc}
 CFLAG=$cflags
+CFLAG_Q=$cflags_q
 APP_CFLAG=$app_cflag
 LIB_CFLAG=$lib_cflag
 SHLIB_CFLAG=$shl_cflag
@@ -770,6 +787,7 @@ install: all
 	\$(MKDIR) \"\$(INSTALLTOP)${o}include\"
 	\$(MKDIR) \"\$(INSTALLTOP)${o}include${o}openssl\"
 	\$(MKDIR) \"\$(INSTALLTOP)${o}lib\"
+	\$(MKDIR) \"\$(INSTALLTOP)${o}lib${o}engines\"
 $extra_install
 
 clean:
@@ -790,41 +808,11 @@ EOF
 $rules .= &do_rehash_rule("rehash.time", "certs/demo apps tools");
 $rules .= &do_test_rule("test", "rehash.time", "run_tests.pl");
 
-my $platform_cpp_symbol = "MK1MF_PLATFORM_$platform";
-$platform_cpp_symbol =~ s/-/_/g;
-if (open(IN,"crypto/buildinf.h"))
-	{
-	# Remove entry for this platform in existing file buildinf.h.
-
-	my $old_buildinf_h = "";
-	while (<IN>)
-		{
-		if (/^\#ifdef $platform_cpp_symbol$/)
-			{
-			while (<IN>) { last if (/^\#endif/); }
-			}
-		else
-			{
-			$old_buildinf_h .= $_;
-			}
-		}
-	close(IN);
-
-	open(OUT,">crypto/buildinf.h") || die "Can't open buildinf.h";
-	print OUT $old_buildinf_h;
-	close(OUT);
-	}
-
-open (OUT,">>crypto/buildinf.h") || die "Can't open buildinf.h";
-printf OUT <<"EOF";
-#ifdef $platform_cpp_symbol
-  /* auto-generated/updated by util/mk1mf.pl for crypto/cversion.c */
-  #define CFLAGS "compiler: $cc $cflags"
-  #define PLATFORM "$platform"
+$rules .= <<"EOF";
+crypto${o}buildinf.h : MINFO
+	\$(PERL) util${o}mkbuildinf.pl "\$(CC) \$(CFLAG_Q)" "\$(PLATFORM)" > crypto${o}buildinf.h
+$(OBJ_D)${o}cversion${obj} : crypto${o}buildinf.h
 EOF
-printf OUT "  #define DATE \"%s\"\n", scalar gmtime();
-printf OUT "#endif\n";
-close(OUT);
 
 # Strip off trailing ' '
 foreach (keys %lib_obj) { $lib_obj{$_}=&clean_up_ws($lib_obj{$_}); }
@@ -1273,7 +1261,6 @@ sub cc_compile_target
 	local($target,$source,$ex_flags)=@_;
 	local($ret);
 	
-	$ex_flags.=" -DMK1MF_BUILD -D$platform_cpp_symbol" if ($source =~ /cversion/);
 	$target =~ s/\//$o/g if $o ne "/";
 	$source =~ s/\//$o/g if $o ne "/";
 	$ret ="$target: \$(SRC_D)$o$source\n\t";
diff --git a/util/mkbuildinf.pl b/util/mkbuildinf.pl
index ffa8a39..9071b71 100755
--- a/util/mkbuildinf.pl
+++ b/util/mkbuildinf.pl
@@ -5,31 +5,30 @@ my ($cflags, $platform) = @ARGV;
 $cflags = "compiler: $cflags";
 $date = localtime();
 print <<"END_OUTPUT";
-#ifndef MK1MF_BUILD
-    /* auto-generated by util/mkbuildinf.pl for crypto/cversion.c */
-    #define CFLAGS cflags
-    /*
-     * Generate CFLAGS as an array of individual characters. This is a
-     * workaround for the situation where CFLAGS gets too long for a C90 string
-     * literal
-     */
-    static const char cflags[] = {
+/* auto-generated by util/mkbuildinf.pl for crypto/cversion.c */
+#define CFLAGS cflags
+/*
+ * Generate CFLAGS as an array of individual characters. This is a
+ * workaround for the situation where CFLAGS gets too long for a C90 string
+ * literal
+ */
+static const char cflags[] = {
 END_OUTPUT
 my $ctr = 0;
 foreach my $c (split //, $cflags) {
+    $c =~ s|([\\'])|\\$1|;
     # Max 18 characters per line
-    if  (($ctr++ % 18) == 0) {
+    if  (($ctr++ % 16) == 0) {
         if ($ctr != 1) {
             print "\n";
         }
-        print "        ";
+        print "    ";
     }
     print "'$c',";
 }
 print <<"END_OUTPUT";
 '\\0'
-    };
-    #define PLATFORM "platform: $platform"
-    #define DATE "built on: $date"
-#endif
+};
+#define PLATFORM "platform: $platform"
+#define DATE "built on: $date"
 END_OUTPUT


More information about the openssl-commits mailing list