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

Update from 0.9.8-stable.

上级 9cbf062a
......@@ -77,6 +77,16 @@
opaque EVP_CIPHER_CTX handling.
[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
sometimes allowed invalid OIDs (1.X for X >= 40 for example), couldn't
handle numbers larger than ULONG_MAX, truncated printing and had a
......
......@@ -748,6 +748,10 @@ PROCESS_ARGS:
{
$withargs{"krb5-".$1}=$2;
}
elsif (/^--with-zlib-(lib|include)=(.*)$/)
{
$withargs{"zlib-".$1}=$2;
}
else
{
print STDERR $usage;
......@@ -1304,6 +1308,8 @@ while (<IN>)
s/^PERL=.*/PERL= $perl/;
s/^KRB5_INCLUDES=.*/KRB5_INCLUDES=$withargs{"krb5-include"}/;
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_MARK=.*/SHLIB_MARK=$shared_mark/;
s/^SHARED_LIBS=.*/SHARED_LIBS=\$(SHARED_CRYPTO) \$(SHARED_SSL)/ if (!$no_shared);
......
......@@ -100,6 +100,10 @@ RMD160_ASM_OBJ=
KRB5_INCLUDES=
LIBKRB5=
# Zlib stuff
ZLIB_INCLUDE=
LIBZLIB=
DIRS= crypto ssl engines apps test tools
SHLIBDIRS= crypto ssl
......
......@@ -67,46 +67,25 @@ static COMP_METHOD zlib_stateful_method={
* 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
* 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)
# 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) */
#ifdef ZLIB_SHARED
#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 */
typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen,
typedef int (*compress_ft)(Bytef *dest,uLongf *destLen,
const Bytef *source, uLong sourceLen);
typedef int (Z_CALLCONV *inflateEnd_ft)(z_streamp strm);
typedef int (Z_CALLCONV *inflate_ft)(z_streamp strm, int flush);
typedef int (Z_CALLCONV *inflateInit__ft)(z_streamp strm,
typedef int (*inflateEnd_ft)(z_streamp strm);
typedef int (*inflate_ft)(z_streamp strm, int flush);
typedef int (*inflateInit__ft)(z_streamp strm,
const char * version, int stream_size);
typedef int (Z_CALLCONV *deflateEnd_ft)(z_streamp strm);
typedef int (Z_CALLCONV *deflate_ft)(z_streamp strm, int flush);
typedef int (Z_CALLCONV *deflateInit__ft)(z_streamp strm, int level,
typedef int (*deflateEnd_ft)(z_streamp strm);
typedef int (*deflate_ft)(z_streamp strm, int flush);
typedef int (*deflateInit__ft)(z_streamp strm, int level,
const char * version, int stream_size);
static compress_ft p_compress=NULL;
static inflateEnd_ft p_inflateEnd=NULL;
......@@ -119,13 +98,13 @@ static deflateInit__ft p_deflateInit_=NULL;
static int zlib_loaded = 0; /* only attempt to init func pts once */
static DSO *zlib_dso = NULL;
#define compress stub_compress
#define inflateEnd stub_inflateEnd
#define inflate stub_inflate
#define inflateInit_ stub_inflateInit_
#define deflateEnd stub_deflateEnd
#define deflate stub_deflate
#define deflateInit_ stub_deflateInit_
#define compress p_compress
#define inflateEnd p_inflateEnd
#define inflate p_inflate
#define inflateInit_ p_inflateInit_
#define deflateEnd p_deflateEnd
#define deflate p_deflate
#define deflateInit_ p_deflateInit_
#endif /* ZLIB_SHARED */
struct zlib_state
......@@ -361,16 +340,6 @@ COMP_METHOD *COMP_zlib(void)
{
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
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
zlib_dso = DSO_load(NULL, "z", NULL, 0);
#endif
......@@ -416,72 +385,3 @@ COMP_METHOD *COMP_zlib(void)
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";
my $no_static_engine = 1;
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";
......@@ -223,6 +225,9 @@ $cflags.=" -DOPENSSL_NO_ECDH" if $no_ecdh;
$cflags.=" -DOPENSSL_NO_ENGINE" if $no_engine;
$cflags.=" -DOPENSSL_NO_HW" if $no_hw;
$cflags.= " -DZLIB" if $zlib_opt;
$cflags.= " -DZLIB_SHARED" if $zlib_opt == 2;
if ($no_static_engine)
{
$cflags .= " -DOPENSSL_NO_STATIC_ENGINE";
......@@ -241,6 +246,7 @@ else
$ex_libs="$l_flags$ex_libs" if ($l_flags ne "");
%shlib_ex_cflags=("SSL" => " -DOPENSSL_BUILD_SHLIBSSL",
"CRYPTO" => " -DOPENSSL_BUILD_SHLIBCRYPTO");
......@@ -285,8 +291,14 @@ for (;;)
if ($key eq "KRB5_INCLUDES")
{ $cflags .= " $val";}
if ($key eq "ZLIB_INCLUDE")
{ $cflags .= " -I$val";}
if ($key eq "LIBZLIB")
{ $zlib_lib = "$val" if $val ne "";}
if ($key eq "LIBKRB5")
{ $ex_libs .= " $val";}
{ $ex_libs .= " $val" if $val ne "";}
if ($key eq "TEST")
{ $test.=&var_add($dir,$val, 0); }
......@@ -338,6 +350,7 @@ else
\$(CP) \$(O_SSL) \$(INSTALLTOP)${o}lib
\$(CP) \$(O_CRYPTO) \$(INSTALLTOP)${o}lib
EOF
$ex_libs .= " $zlib_lib" if $zlib_opt == 1;
}
$defs= <<"EOF";
......@@ -833,7 +846,7 @@ sub do_defs
$ret.=$t;
}
# 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")
{ $ret.="\$(OBJ_D)\\\$(CRYPTO).res "; }
......@@ -1019,10 +1032,10 @@ sub read_options
}
}
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$/)
{
$xcflags = "-DZLIB_SHARED -DZLIB $xcflags";
$zlib_opt = 2;
}
elsif (/^no-static-engine/)
{
......
......@@ -11,6 +11,8 @@ $cp='$(PERL) util/copy.pl';
$mkdir='$(PERL) util/mkdir-p.pl';
$rm='del';
$zlib_lib="zlib1.lib";
# C compiler stuff
$cc='cl';
if ($FLAVOR =~ /WIN64/)
......@@ -146,7 +148,6 @@ if ($FLAVOR =~ /NT/)
$cflags.=" -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE";
$ex_libs="unicows.lib $ex_libs";
}
# static library stuff
$mklib='lib';
$ranlib='';
......@@ -278,6 +279,7 @@ sub do_lib_rule
$ex.=' wsock32.lib gdi32.lib advapi32.lib user32.lib';
$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.="\n";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册