提交 ad2695b1 编写于 作者: D Dr. Stephen Henson

Update from 0.9.8-stable.

上级 9cbf062a
...@@ -77,6 +77,16 @@ ...@@ -77,6 +77,16 @@
opaque EVP_CIPHER_CTX handling. opaque EVP_CIPHER_CTX handling.
[Steve Henson] [Steve Henson]
*) Fixes and enhancements to zlib compression code. We now only use
"zlib1.dll" and use the default __cdecl calling convention on Win32
to conform with the standards mentioned here:
http://www.zlib.net/DLL_FAQ.txt
Static zlib linking now works on Windows and the new --with-zlib-include
--with-zlib-lib options to Configure can be used to supply the location
of the headers and library. Gracefully handle case where zlib library
can't be loaded.
[Steve Henson]
*) Several fixes and enhancements to the OID generation code. The old code *) Several fixes and enhancements to the OID generation code. The old code
sometimes allowed invalid OIDs (1.X for X >= 40 for example), couldn't sometimes allowed invalid OIDs (1.X for X >= 40 for example), couldn't
handle numbers larger than ULONG_MAX, truncated printing and had a handle numbers larger than ULONG_MAX, truncated printing and had a
......
...@@ -748,6 +748,10 @@ PROCESS_ARGS: ...@@ -748,6 +748,10 @@ PROCESS_ARGS:
{ {
$withargs{"krb5-".$1}=$2; $withargs{"krb5-".$1}=$2;
} }
elsif (/^--with-zlib-(lib|include)=(.*)$/)
{
$withargs{"zlib-".$1}=$2;
}
else else
{ {
print STDERR $usage; print STDERR $usage;
...@@ -1304,6 +1308,8 @@ while (<IN>) ...@@ -1304,6 +1308,8 @@ while (<IN>)
s/^PERL=.*/PERL= $perl/; s/^PERL=.*/PERL= $perl/;
s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/; s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/; s/^LIBKRB5=.*/LIBKRB5=$withargs{"krb5-lib"}/;
s/^LIBZLIB=.*/LIBZLIB=$withargs{"zlib-lib"}/;
s/^ZLIB_INCLUDE=.*/ZLIB_INCLUDE=$withargs{"zlib-include"}/;
s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/; s/^SHLIB_TARGET=.*/SHLIB_TARGET=$shared_target/;
s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/; s/^SHLIB_MARK=.*/SHLIB_MARK=$shared_mark/;
s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared); s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
......
...@@ -100,6 +100,10 @@ RMD160_ASM_OBJ= ...@@ -100,6 +100,10 @@ RMD160_ASM_OBJ=
KRB5_INCLUDES= KRB5_INCLUDES=
LIBKRB5= LIBKRB5=
# Zlib stuff
ZLIB_INCLUDE=
LIBZLIB=
DIRS= crypto ssl engines apps test tools DIRS= crypto ssl engines apps test tools
SHLIBDIRS= crypto ssl SHLIBDIRS= crypto ssl
......
...@@ -67,46 +67,25 @@ static COMP_METHOD zlib_stateful_method={ ...@@ -67,46 +67,25 @@ static COMP_METHOD zlib_stateful_method={
* When OpenSSL is built on Windows, we do not want to require that * When OpenSSL is built on Windows, we do not want to require that
* the ZLIB.DLL be available in order for the OpenSSL DLLs to * the ZLIB.DLL be available in order for the OpenSSL DLLs to
* work. Therefore, all ZLIB routines are loaded at run time * work. Therefore, all ZLIB routines are loaded at run time
* and we do not link to a .LIB file. * and we do not link to a .LIB file when ZLIB_SHARED is set.
*/ */
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
# include <windows.h> # include <windows.h>
# define Z_CALLCONV _stdcall
# ifndef ZLIB_SHARED
# define ZLIB_SHARED
# endif
#else
# define Z_CALLCONV
#endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ #endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */
#ifdef ZLIB_SHARED #ifdef ZLIB_SHARED
#include <openssl/dso.h> #include <openssl/dso.h>
/* Prototypes for built in stubs */
#if 0
static int stub_compress(Bytef *dest,uLongf *destLen,
const Bytef *source, uLong sourceLen);
#endif
static int stub_inflateEnd(z_streamp strm);
static int stub_inflate(z_streamp strm, int flush);
static int stub_inflateInit_(z_streamp strm, const char * version,
int stream_size);
static int stub_deflateEnd(z_streamp strm);
static int stub_deflate(z_streamp strm, int flush);
static int stub_deflateInit_(z_streamp strm, int level,
const char * version, int stream_size);
/* Function pointers */ /* Function pointers */
typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen, typedef int (*compress_ft)(Bytef *dest,uLongf *destLen,
const Bytef *source, uLong sourceLen); const Bytef *source, uLong sourceLen);
typedef int (Z_CALLCONV *inflateEnd_ft)(z_streamp strm); typedef int (*inflateEnd_ft)(z_streamp strm);
typedef int (Z_CALLCONV *inflate_ft)(z_streamp strm, int flush); typedef int (*inflate_ft)(z_streamp strm, int flush);
typedef int (Z_CALLCONV *inflateInit__ft)(z_streamp strm, typedef int (*inflateInit__ft)(z_streamp strm,
const char * version, int stream_size); const char * version, int stream_size);
typedef int (Z_CALLCONV *deflateEnd_ft)(z_streamp strm); typedef int (*deflateEnd_ft)(z_streamp strm);
typedef int (Z_CALLCONV *deflate_ft)(z_streamp strm, int flush); typedef int (*deflate_ft)(z_streamp strm, int flush);
typedef int (Z_CALLCONV *deflateInit__ft)(z_streamp strm, int level, typedef int (*deflateInit__ft)(z_streamp strm, int level,
const char * version, int stream_size); const char * version, int stream_size);
static compress_ft p_compress=NULL; static compress_ft p_compress=NULL;
static inflateEnd_ft p_inflateEnd=NULL; static inflateEnd_ft p_inflateEnd=NULL;
...@@ -119,13 +98,13 @@ static deflateInit__ft p_deflateInit_=NULL; ...@@ -119,13 +98,13 @@ static deflateInit__ft p_deflateInit_=NULL;
static int zlib_loaded = 0; /* only attempt to init func pts once */ static int zlib_loaded = 0; /* only attempt to init func pts once */
static DSO *zlib_dso = NULL; static DSO *zlib_dso = NULL;
#define compress stub_compress #define compress p_compress
#define inflateEnd stub_inflateEnd #define inflateEnd p_inflateEnd
#define inflate stub_inflate #define inflate p_inflate
#define inflateInit_ stub_inflateInit_ #define inflateInit_ p_inflateInit_
#define deflateEnd stub_deflateEnd #define deflateEnd p_deflateEnd
#define deflate stub_deflate #define deflate p_deflate
#define deflateInit_ stub_deflateInit_ #define deflateInit_ p_deflateInit_
#endif /* ZLIB_SHARED */ #endif /* ZLIB_SHARED */
struct zlib_state struct zlib_state
...@@ -361,16 +340,6 @@ COMP_METHOD *COMP_zlib(void) ...@@ -361,16 +340,6 @@ COMP_METHOD *COMP_zlib(void)
{ {
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0);
if (!zlib_dso)
{
zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0);
if (zlib_dso)
{
/* Clear the errors from the first failed
DSO_load() */
ERR_clear_error();
}
}
#else #else
zlib_dso = DSO_load(NULL, "z", NULL, 0); zlib_dso = DSO_load(NULL, "z", NULL, 0);
#endif #endif
...@@ -416,72 +385,3 @@ COMP_METHOD *COMP_zlib(void) ...@@ -416,72 +385,3 @@ COMP_METHOD *COMP_zlib(void)
return(meth); return(meth);
} }
#ifdef ZLIB_SHARED
#if 0
/* Stubs for each function to be dynamicly loaded */
static int
stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen)
{
if (p_compress)
return(p_compress(dest,destLen,source,sourceLen));
else
return(Z_MEM_ERROR);
}
#endif
static int
stub_inflateEnd(z_streamp strm)
{
if ( p_inflateEnd )
return(p_inflateEnd(strm));
else
return(Z_MEM_ERROR);
}
static int
stub_inflate(z_streamp strm, int flush)
{
if ( p_inflate )
return(p_inflate(strm,flush));
else
return(Z_MEM_ERROR);
}
static int
stub_inflateInit_(z_streamp strm, const char * version, int stream_size)
{
if ( p_inflateInit_ )
return(p_inflateInit_(strm,version,stream_size));
else
return(Z_MEM_ERROR);
}
static int
stub_deflateEnd(z_streamp strm)
{
if ( p_deflateEnd )
return(p_deflateEnd(strm));
else
return(Z_MEM_ERROR);
}
static int
stub_deflate(z_streamp strm, int flush)
{
if ( p_deflate )
return(p_deflate(strm,flush));
else
return(Z_MEM_ERROR);
}
static int
stub_deflateInit_(z_streamp strm, int level,
const char * version, int stream_size)
{
if ( p_deflateInit_ )
return(p_deflateInit_(strm,level,version,stream_size));
else
return(Z_MEM_ERROR);
}
#endif /* ZLIB_SHARED */
...@@ -12,6 +12,8 @@ $banner="\t\@echo Building OpenSSL"; ...@@ -12,6 +12,8 @@ $banner="\t\@echo Building OpenSSL";
my $no_static_engine = 1; my $no_static_engine = 1;
my $engines = ""; my $engines = "";
local $zlib_opt = 0; # 0 = no zlib, 1 = static, 2 = dynamic
local $zlib_lib = "";
open(IN,"<Makefile") || die "unable to open Makefile!\n"; open(IN,"<Makefile") || die "unable to open Makefile!\n";
...@@ -223,6 +225,9 @@ $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh; ...@@ -223,6 +225,9 @@ $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh;
$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine; $cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
$cflags.=" -DOPENSSL_NO_HW" if $no_hw; $cflags.=" -DOPENSSL_NO_HW" if $no_hw;
$cflags.= " -DZLIB" if $zlib_opt;
$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
if ($no_static_engine) if ($no_static_engine)
{ {
$cflags .= " -DOPENSSL_NO_STATIC_ENGINE"; $cflags .= " -DOPENSSL_NO_STATIC_ENGINE";
...@@ -241,6 +246,7 @@ else ...@@ -241,6 +246,7 @@ else
$ex_libs="$l_flags$ex_libs" if ($l_flags ne ""); $ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL", %shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
"CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO"); "CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
...@@ -285,8 +291,14 @@ for (;;) ...@@ -285,8 +291,14 @@ for (;;)
if ($key eq "KRB5_INCLUDES") if ($key eq "KRB5_INCLUDES")
{ $cflags .= " $val";} { $cflags .= " $val";}
if ($key eq "ZLIB_INCLUDE")
{ $cflags .= " -I$val";}
if ($key eq "LIBZLIB")
{ $zlib_lib = "$val" if $val ne "";}
if ($key eq "LIBKRB5") if ($key eq "LIBKRB5")
{ $ex_libs .= " $val";} { $ex_libs .= " $val" if $val ne "";}
if ($key eq "TEST") if ($key eq "TEST")
{ $test.=&var_add($dir,$val, 0); } { $test.=&var_add($dir,$val, 0); }
...@@ -338,6 +350,7 @@ else ...@@ -338,6 +350,7 @@ else
\$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib \$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib
\$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib \$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib
EOF EOF
$ex_libs .= " $zlib_lib" if $zlib_opt == 1;
} }
$defs= <<"EOF"; $defs= <<"EOF";
...@@ -833,7 +846,7 @@ sub do_defs ...@@ -833,7 +846,7 @@ sub do_defs
$ret.=$t; $ret.=$t;
} }
# hack to add version info on MSVC # hack to add version info on MSVC
if ($shlib && ($platform eq "VC-WIN32") || ($platform eq "VC-NT")) if ($shlib && (($platform eq "VC-WIN32") || ($platform eq "VC-NT")))
{ {
if ($var eq "CRYPTOOBJ") if ($var eq "CRYPTOOBJ")
{ $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; } { $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
...@@ -1019,10 +1032,10 @@ sub read_options ...@@ -1019,10 +1032,10 @@ sub read_options
} }
} }
elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; } elsif (/^no-comp$/) { $xcflags = "-DOPENSSL_NO_COMP $xcflags"; }
elsif (/^enable-zlib$/) { $xcflags = "-DZLIB $xcflags"; } elsif (/^enable-zlib$/) { $zlib_opt = 1 if $zlib_opt == 0 }
elsif (/^enable-zlib-dynamic$/) elsif (/^enable-zlib-dynamic$/)
{ {
$xcflags = "-DZLIB_SHARED -DZLIB $xcflags"; $zlib_opt = 2;
} }
elsif (/^no-static-engine/) elsif (/^no-static-engine/)
{ {
......
...@@ -11,6 +11,8 @@ $cp='$(PERL) util/copy.pl'; ...@@ -11,6 +11,8 @@ $cp='$(PERL) util/copy.pl';
$mkdir='$(PERL) util/mkdir-p.pl'; $mkdir='$(PERL) util/mkdir-p.pl';
$rm='del'; $rm='del';
$zlib_lib="zlib1.lib";
# C compiler stuff # C compiler stuff
$cc='cl'; $cc='cl';
if ($FLAVOR =~ /WIN64/) if ($FLAVOR =~ /WIN64/)
...@@ -146,7 +148,6 @@ if ($FLAVOR =~ /NT/) ...@@ -146,7 +148,6 @@ if ($FLAVOR =~ /NT/)
$cflags.=" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE"; $cflags.=" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE";
$ex_libs="unicows.lib $ex_libs"; $ex_libs="unicows.lib $ex_libs";
} }
# static library stuff # static library stuff
$mklib='lib'; $mklib='lib';
$ranlib=''; $ranlib='';
...@@ -278,6 +279,7 @@ sub do_lib_rule ...@@ -278,6 +279,7 @@ sub do_lib_rule
$ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib'; $ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
$ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/); $ex.=' bufferoverflowu.lib' if ($FLAVOR =~ /WIN64/);
} }
$ex.=" $zlib_lib" if $zlib_opt == 1 && $target =~ /O_CRYPTO/;
$ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n"; $ret.="\t\$(LINK) \$(MLFLAGS) $efile$target $name @<<\n \$(SHLIB_EX_OBJ) $objs $ex\n<<\n";
} }
$ret.="\n"; $ret.="\n";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册