[openssl-commits] [openssl] master update

Richard Levitte levitte at openssl.org
Wed Apr 13 09:36:50 UTC 2016


The branch master has been updated
       via  802d2243083a46fbb4afb15a78c3db07f0092af3 (commit)
       via  da430a5555b97cc0fe5e9bf6cfd64be98e8b5bcb (commit)
       via  5a5c0b953f8f97b4e604da494a65de034bbaaceb (commit)
       via  0c9b1534265a59d099886fc916b859e55d268d8b (commit)
       via  62890f47288687e4f0b7b2c1ce2da7c93ef21063 (commit)
      from  36d70ed51968adf9b2e7d7c67368aaccda7eabfe (commit)


- Log -----------------------------------------------------------------
commit 802d2243083a46fbb4afb15a78c3db07f0092af3
Author: Richard Levitte <levitte at openssl.org>
Date:   Wed Apr 13 02:40:39 2016 +0200

    Don't use FORMAT_BASE64 format when compressing / decompressing
    
    When compressing, the output / input is a binary format, not a text
    format like BASE64.  This is important on Windows, where a ^Z in a
    text file is seen as EOF, and there could be a ^Z somewhere in a
    compressed file, cutting it short as input.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

commit da430a5555b97cc0fe5e9bf6cfd64be98e8b5bcb
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Apr 12 16:35:32 2016 +0200

    Fix the handling of --with-zlib-include
    
    The handling was Unix centric, already in Configure.  Change that to
    just collect the value and let the build file templates figure out
    what to do with it.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

commit 5a5c0b953f8f97b4e604da494a65de034bbaaceb
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Apr 12 16:12:53 2016 +0200

    Remake the way dynamic zlib is loaded
    
    Instead of absolute hard coding of the libz library name, have it use
    the macro LIBZ, which is set to defaults we know in case it's
    undefined.
    
    This allows our configuration to set something that's sane on current
    or older platforms, and allows the user to override it by defining
    LIBZ themselves.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

commit 0c9b1534265a59d099886fc916b859e55d268d8b
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Apr 12 16:03:02 2016 +0200

    Configuration: Simplify the way vms information is retrieved
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

commit 62890f47288687e4f0b7b2c1ce2da7c93ef21063
Author: Richard Levitte <levitte at openssl.org>
Date:   Tue Apr 12 15:28:06 2016 +0200

    Fix zlib configuration options.
    
    The macros ZLIB and ZLIB_SHARED weren't appropriately defined,
    deviating wrongly from how they worked in earlier OpenSSL versions.
    So, restore it so that ZLIB is defined if configured "enable-zlib" and
    so that ZLIB and ZLIB_SHARED are defined if configured
    "enable-zlib-dynamic".
    
    Additionally, correct the interpretation of the --with-zlib-lib value
    on Windows and VMS, where it's used to indicate the actual zlib
    zlib library file / logical name, as that can differ depending on zlib
    version and packaging on those platforms.
    
    Finally for Windows and VMS, we also define the macro LIBZ with that
    file name / logical name when configured "zlib-dynamic", so the
    compression unit can pick it up and use it.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

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

Summary of changes:
 Configurations/00-base-templates.conf | 31 +++--------
 Configurations/10-main.conf           | 97 +++++++++++++++++++++++++++--------
 Configurations/descrip.mms.tmpl       | 11 +++-
 Configurations/unix-Makefile.tmpl     |  5 ++
 Configurations/windows-makefile.tmpl  |  5 ++
 Configure                             |  2 +-
 apps/enc.c                            | 15 +++---
 crypto/comp/c_zlib.c                  | 17 ++++--
 8 files changed, 124 insertions(+), 59 deletions(-)

diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf
index 5fe038c..0211a8c 100644
--- a/Configurations/00-base-templates.conf
+++ b/Configurations/00-base-templates.conf
@@ -43,16 +43,12 @@
     BASE_common => {
 	template	=> 1,
 	defines		=>
-	    [ sub {
-		unless ($disabled{zlib}) {
-		    if (defined($disabled{"zlib-dynamic"})) {
-			return "ZLIB";
-		    } else {
-			return "ZLIB_SHARED";
-		    }
-		}
-		return (); }
-	    ],
+	    sub {
+                my @defs = ();
+                push @defs, "ZLIB" unless $disabled{zlib};
+                push @defs, "ZLIB_SHARED" unless $disabled{"zlib-dynamic"};
+                return [ @defs ];
+            },
     },
 
     BASE_unix => {
@@ -84,7 +80,7 @@
             sub {
                 unless ($disabled{zlib}) {
                     if (defined($disabled{"zlib-dynamic"})) {
-                        return "zlib1.lib";
+                        return $withargs{zlib_lib} || "zlib1.lib";
                     }
                 }
                 return (); },
@@ -104,19 +100,6 @@
         inherit_from    => [ "BASE_common" ],
         template        => 1,
 
-        ex_libs          =>
-            sub {
-                unless ($disabled{zlib}) {
-                    if (defined($disabled{"zlib-dynamic"})) {
-                        if (defined($withargs{zlib_lib})) {
-                            return $withargs{zlib_lib}.'GNV$LIBZSHR.EXE/SHARED'
-                        } else {
-                            return 'GNV$LIBZSHR/SHARE';
-                        }
-                    }
-                }
-                return (); },
-
         build_file       => "descrip.mms",
         build_scheme     => [ "unified", "VMS" ],
     },
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 6b10d70..5bf8a0d 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -78,13 +78,28 @@ sub vc_wince_info {
 my $vms_info = {};
 sub vms_info {
     unless (%$vms_info) {
-	$vms_info->{disable_warns} = [ ];
-	$vms_info->{disable_warns_p32} = [ ];
-	$vms_info->{disable_warns_p64} = [ ];
-	`PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
-	if ($? == 0) {
-	    push @{$vms_info->{disable_warns_p64}}, "MAYLOSEDATA3";
-	}
+        my $pointer_size = shift;
+        my $pointer_size_str = $pointer_size == 0 ? "" : "$pointer_size";
+
+        $vms_info->{disable_warns} = [ ];
+        if ($pointer_size == 64) {
+            `PIPE CC /NOCROSS_REFERENCE /NOLIST /NOOBJECT /WARNINGS = DISABLE = ( MAYLOSEDATA3, EMPTYFILE ) NL: 2> NL:`;
+            if ($? == 0) {
+                push @{$vms_info->{disable_warns}}, "MAYLOSEDATA3";
+            }
+        }
+
+        unless ($disabled{zlib}) {
+            my $default_zlib = 'GNV$LIBZSHR' . $pointer_size_str;
+            if (defined($disabled{"zlib-dynamic"})) {
+                $vms_info->{zlib} = $withargs{zlib_lib} || "$default_zlib/SHARE";
+            } else {
+                $vms_info->{def_zlib} = $withargs{zlib_lib} || $default_zlib;
+                # In case the --with-zlib-lib value contains something like
+                # /SHARE or /LIB or so at the end, remove it.
+                $vms_info->{def_zlib} =~ s|/.*$||g;
+            }
+        }
     }
     return $vms_info;
 }
@@ -1234,6 +1249,14 @@ sub vms_info {
         template         => 1,
         cc               => "cl",
         cflags           => "-W3 -wd4090 -Gs0 -GF -Gy -nologo -DOPENSSL_SYS_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -D_CRT_SECURE_NO_DEPRECATE",
+        defines          => add(sub { my @defs = ();
+                                      unless ($disabled{"zlib-dynamic"}) {
+                                          push @defs,
+                                              quotify("perl",
+                                                      'LIBZ="' . $withargs{zlib_lib} . '"');
+                                      }
+                                      return [ @defs ];
+                                    }),
         coutflag         => "/Fo",
         rc               => "rc",
         rcoutflag        => "/fo",
@@ -1752,68 +1775,100 @@ sub vms_info {
     "vms-alpha" => {
         inherit_from     => [ "vms-generic" ],
         cflags           => add(sub { my @warnings =
-                                          @{vms_info()->{disable_warns}};
+                                          @{vms_info(0)->{disable_warns}};
                                       @warnings
                                           ? "/WARNINGS=DISABLE=(".join(",", at warnings).")" : (); }),
+        defines          =>
+                    add(sub {
+                            return vms_info(0)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : ();
+                            }),
+        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }),
         #as               => "???",
         #debug_aflags     => "/NOOPTIMIZE/DEBUG",
         #release_aflags   => "/OPTIMIZE/NODEBUG",
         bn_opts          => "SIXTY_FOUR_BIT RC4_INT RC4_CHUNK_LL DES_PTR BF_PTR",
     },
     "vms-alpha-p32" => {
-        inherit_from     => [ "vms-alpha" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=32",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p32}};
+                          @{vms_info(32)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",", at warnings).")" : ();
                 } ),
-        ex_libs          => sub { join(",", map { s|SHR([\./])|SHR32$1|g; $_ } @_) },
+        defines          =>
+                    add(sub {
+                            return vms_info(32)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : ();
+                            }),
+        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }),
     },
     "vms-alpha-p64" => {
-        inherit_from     => [ "vms-alpha" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=64=ARGV",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p64}};
+                          @{vms_info(64)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",", at warnings).")" : ();
                 } ),
-        ex_libs          => sub { join(",", map { s|SHR([\./])|SHR64$1|g; $_ } @_) },
+        defines          =>
+                    add(sub {
+                            return vms_info(64)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : ();
+                            }),
+        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }),
     },
     "vms-ia64" => {
         inherit_from     => [ "vms-generic" ],
         cflags           => add(sub { my @warnings =
-                                          @{vms_info()->{disable_warns}};
+                                          @{vms_info(0)->{disable_warns}};
                                       @warnings
                                           ? "/WARNINGS=DISABLE=(".join(",", at warnings).")" : (); }),
+        defines          =>
+                    add(sub {
+                            return vms_info(0)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(0)->{def_zlib}."\"\"\"" : ();
+                            }),
+        ex_libs          => add(sub { return vms_info(0)->{zlib} || (); }),
         #as               => "I4S",
         #debug_aflags     => "/NOOPTIMIZE/DEBUG",
         #release_aflags   => "/OPTIMIZE/NODEBUG",
         bn_opts          => "SIXTY_FOUR_BIT RC4_INT RC4_CHUNK_LL DES_PTR BF_PTR",
     },
     "vms-ia64-p32" => {
-        inherit_from     => [ "vms-ia64" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=32",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p32}};
+                          @{vms_info(32)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",", at warnings).")" : ();
                 } ),
-        ex_libs          => sub { join(",", map { s|SHR([\./])|SHR32$1|g; $_ } @_) },
+        defines          =>
+                    add(sub {
+                            return vms_info(32)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(32)->{def_zlib}."\"\"\"" : ();
+                            }),
+        ex_libs          => add(sub { return vms_info(32)->{zlib} || (); }),
     },
     "vms-ia64-p64" => {
-        inherit_from     => [ "vms-ia64" ],
+        inherit_from     => [ "vms-generic" ],
         cflags           =>
             add("/POINTER_SIZE=64=ARGV",
                 sub { my @warnings =
-                          @{vms_info()->{disable_warns_p64}};
+                          @{vms_info(64)->{disable_warns}};
                       @warnings
                           ? "/WARNINGS=DISABLE=(".join(",", at warnings).")" : ();
                 } ),
-        ex_libs          => sub { join(",", map { s|SHR([\./])|SHR64$1|g; $_ } @_) },
+        defines          =>
+                    add(sub {
+                            return vms_info(64)->{def_zlib}
+                                ? "LIBZ=\"\"\"".vms_info(64)->{def_zlib}."\"\"\"" : ();
+                            }),
+        ex_libs          => add(sub { return vms_info(64)->{zlib} || (); }),
     },
 
 );
diff --git a/Configurations/descrip.mms.tmpl b/Configurations/descrip.mms.tmpl
index c916ddc..85e1cd9 100644
--- a/Configurations/descrip.mms.tmpl
+++ b/Configurations/descrip.mms.tmpl
@@ -468,13 +468,20 @@ EOF
       my $incs_on = "\@ !";
       my $incs_off = "\@ !";
       my $incs = "";
-      if (@{$args{incs}}) {
+      my @incs = ();
+      push @incs, @{$args{incs}} if @{$args{incs}};
+      unless ($disabled{zlib}) {
+          # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
+          # incarnations.
+          push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
+      }
+      if (@incs) {
           $incs_on =
               "DEFINE tmp_includes "
               .join(",-\n\t\t\t", map {
                                       file_name_is_absolute($_)
                                       ? $_ : catdir($backward,$_)
-                                  } @{$args{incs}});
+                                  } @incs);
           $incs_off = "DEASSIGN tmp_includes";
           $incs = " /INCLUDE=(tmp_includes:)";
       }
diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
index af708f0..9054f6a 100644
--- a/Configurations/unix-Makefile.tmpl
+++ b/Configurations/unix-Makefile.tmpl
@@ -860,6 +860,11 @@ EOF
       my $srcs = join(" ",  @srcs);
       my $deps = join(" ", @srcs, @{$args{deps}});
       my $incs = join("", map { " -I".$_ } @{$args{incs}});
+      unless ($disabled{zlib}) {
+          if ($withargs{zlib_include}) {
+              $incs .= " -I".$withargs{zlib_include};
+          }
+      }
       my $ecflags = { lib => '$(LIB_CFLAGS)',
                       dso => '$(DSO_CFLAGS)',
                       bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
diff --git a/Configurations/windows-makefile.tmpl b/Configurations/windows-makefile.tmpl
index c67ff83..6a450b1 100644
--- a/Configurations/windows-makefile.tmpl
+++ b/Configurations/windows-makefile.tmpl
@@ -300,6 +300,11 @@ EOF
      my $srcs = join(" ",  @srcs);
      my $deps = join(" ", @srcs, @{$args{deps}});
      my $incs = join("", map { " /I ".$_ } @{$args{incs}});
+     unless ($disabled{zlib}) {
+         if ($withargs{zlib_include}) {
+             $incs .= " /I ".$withargs{zlib_include};
+         }
+     }
      my $ecflags = { lib => '$(LIB_CFLAGS)',
 		     dso => '$(DSO_CFLAGS)',
 		     bin => '$(BIN_CFLAGS)' } -> {$args{intent}};
diff --git a/Configure b/Configure
index 8e42ebf..4e0e342 100755
--- a/Configure
+++ b/Configure
@@ -672,7 +672,7 @@ foreach (@argvcopy)
 			}
 		elsif (/^--with-zlib-include=(.*)$/)
 			{
-			$withargs{zlib_include}="-I$1";
+			$withargs{zlib_include}=$1;
 			}
 		elsif (/^--with-fipslibdir=(.*)$/)
 			{
diff --git a/apps/enc.c b/apps/enc.c
index 7869987..7f25009 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -313,12 +313,15 @@ int enc_main(int argc, char **argv)
     if (verbose)
         BIO_printf(bio_err, "bufsize=%d\n", bsize);
 
-    if (base64) {
-        if (enc)
-            outformat = FORMAT_BASE64;
-        else
-            informat = FORMAT_BASE64;
-    }
+#ifdef ZLIB
+    if (!do_zlib)
+#endif
+        if (base64) {
+            if (enc)
+                outformat = FORMAT_BASE64;
+            else
+                informat = FORMAT_BASE64;
+        }
 
     strbuf = app_malloc(SIZE, "strbuf");
     buff = app_malloc(EVP_ENCODE_LENGTH(bsize), "evp buffer");
diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c
index 20376b6..6dd7684 100644
--- a/crypto/comp/c_zlib.c
+++ b/crypto/comp/c_zlib.c
@@ -256,12 +256,19 @@ COMP_METHOD *COMP_zlib(void)
     COMP_METHOD *meth = &zlib_method_nozlib;
 
 #ifdef ZLIB_SHARED
-    if (!zlib_loaded) {
-# if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
-        zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0);
-# else
-        zlib_dso = DSO_load(NULL, "z", NULL, 0);
+    /* LIBZ may be externally defined, and we should respect that value */
+# ifndef LIBZ
+#  if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
+#   define LIBZ "ZLIB1"
+#  elif defined(OPENSSL_SYS_VMS)
+#   define LIBZ "LIBZ"
+#  else
+#   define LIBZ "z"
+#  endif
 # endif
+
+    if (!zlib_loaded) {
+        zlib_dso = DSO_load(NULL, LIBZ, NULL, 0);
         if (zlib_dso != NULL) {
             p_compress = (compress_ft) DSO_bind_func(zlib_dso, "compress");
             p_inflateEnd


More information about the openssl-commits mailing list