diff options
Diffstat (limited to 'src/lib/libcrypto/comp')
| -rw-r--r-- | src/lib/libcrypto/comp/Makefile | 113 | ||||
| -rw-r--r-- | src/lib/libcrypto/comp/Makefile.ssl | 114 | ||||
| -rw-r--r-- | src/lib/libcrypto/comp/c_zlib.c | 88 |
3 files changed, 299 insertions, 16 deletions
diff --git a/src/lib/libcrypto/comp/Makefile b/src/lib/libcrypto/comp/Makefile new file mode 100644 index 0000000000..df1babec5c --- /dev/null +++ b/src/lib/libcrypto/comp/Makefile | |||
| @@ -0,0 +1,113 @@ | |||
| 1 | # | ||
| 2 | # OpenSSL/crypto/comp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= comp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKEDEPPROG= makedepend | ||
| 14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 15 | MAKEFILE= Makefile | ||
| 16 | AR= ar r | ||
| 17 | |||
| 18 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 19 | |||
| 20 | GENERAL=Makefile | ||
| 21 | TEST= | ||
| 22 | APPS= | ||
| 23 | |||
| 24 | LIB=$(TOP)/libcrypto.a | ||
| 25 | LIBSRC= comp_lib.c comp_err.c \ | ||
| 26 | c_rle.c c_zlib.c | ||
| 27 | |||
| 28 | LIBOBJ= comp_lib.o comp_err.o \ | ||
| 29 | c_rle.o c_zlib.o | ||
| 30 | |||
| 31 | SRC= $(LIBSRC) | ||
| 32 | |||
| 33 | EXHEADER= comp.h | ||
| 34 | HEADER= $(EXHEADER) | ||
| 35 | |||
| 36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 37 | |||
| 38 | top: | ||
| 39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 40 | |||
| 41 | all: lib | ||
| 42 | |||
| 43 | lib: $(LIBOBJ) | ||
| 44 | $(AR) $(LIB) $(LIBOBJ) | ||
| 45 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 46 | @touch lib | ||
| 47 | |||
| 48 | files: | ||
| 49 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 50 | |||
| 51 | links: | ||
| 52 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 53 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 55 | |||
| 56 | install: | ||
| 57 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
| 58 | do \ | ||
| 59 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 60 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 61 | done; | ||
| 62 | |||
| 63 | tags: | ||
| 64 | ctags $(SRC) | ||
| 65 | |||
| 66 | tests: | ||
| 67 | |||
| 68 | lint: | ||
| 69 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 70 | |||
| 71 | depend: | ||
| 72 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 73 | |||
| 74 | dclean: | ||
| 75 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 76 | mv -f Makefile.new $(MAKEFILE) | ||
| 77 | |||
| 78 | clean: | ||
| 79 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 80 | |||
| 81 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 82 | |||
| 83 | c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 84 | c_rle.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 85 | c_rle.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 86 | c_rle.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 87 | c_rle.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 88 | c_rle.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 89 | c_rle.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h c_rle.c | ||
| 90 | c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 91 | c_zlib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 92 | c_zlib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 93 | c_zlib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 94 | c_zlib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 95 | c_zlib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 96 | c_zlib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 97 | c_zlib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 98 | c_zlib.o: c_zlib.c | ||
| 99 | comp_err.o: ../../include/openssl/bio.h ../../include/openssl/comp.h | ||
| 100 | comp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 101 | comp_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 102 | comp_err.o: ../../include/openssl/opensslconf.h | ||
| 103 | comp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 104 | comp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 105 | comp_err.o: comp_err.c | ||
| 106 | comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 107 | comp_lib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 108 | comp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 109 | comp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 110 | comp_lib.o: ../../include/openssl/opensslconf.h | ||
| 111 | comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 112 | comp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 113 | comp_lib.o: ../../include/openssl/symhacks.h comp_lib.c | ||
diff --git a/src/lib/libcrypto/comp/Makefile.ssl b/src/lib/libcrypto/comp/Makefile.ssl new file mode 100644 index 0000000000..f70ba1b285 --- /dev/null +++ b/src/lib/libcrypto/comp/Makefile.ssl | |||
| @@ -0,0 +1,114 @@ | |||
| 1 | # | ||
| 2 | # SSLeay/crypto/comp/Makefile | ||
| 3 | # | ||
| 4 | |||
| 5 | DIR= comp | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC= comp_lib.c comp_err.c \ | ||
| 27 | c_rle.c c_zlib.c | ||
| 28 | |||
| 29 | LIBOBJ= comp_lib.o comp_err.o \ | ||
| 30 | c_rle.o c_zlib.o | ||
| 31 | |||
| 32 | SRC= $(LIBSRC) | ||
| 33 | |||
| 34 | EXHEADER= comp.h | ||
| 35 | HEADER= $(EXHEADER) | ||
| 36 | |||
| 37 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 38 | |||
| 39 | top: | ||
| 40 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 41 | |||
| 42 | all: lib | ||
| 43 | |||
| 44 | lib: $(LIBOBJ) | ||
| 45 | $(AR) $(LIB) $(LIBOBJ) | ||
| 46 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 47 | @touch lib | ||
| 48 | |||
| 49 | files: | ||
| 50 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 51 | |||
| 52 | links: | ||
| 53 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
| 54 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
| 55 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
| 56 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
| 57 | |||
| 58 | install: | ||
| 59 | @for i in $(EXHEADER) ; \ | ||
| 60 | do \ | ||
| 61 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
| 62 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
| 63 | done; | ||
| 64 | |||
| 65 | tags: | ||
| 66 | ctags $(SRC) | ||
| 67 | |||
| 68 | tests: | ||
| 69 | |||
| 70 | lint: | ||
| 71 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 72 | |||
| 73 | depend: | ||
| 74 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(LIBSRC) | ||
| 75 | |||
| 76 | dclean: | ||
| 77 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 78 | mv -f Makefile.new $(MAKEFILE) | ||
| 79 | |||
| 80 | clean: | ||
| 81 | rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
| 82 | |||
| 83 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
| 84 | |||
| 85 | c_rle.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 86 | c_rle.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 87 | c_rle.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 88 | c_rle.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 89 | c_rle.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 90 | c_rle.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 91 | c_rle.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h c_rle.c | ||
| 92 | c_zlib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 93 | c_zlib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 94 | c_zlib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 95 | c_zlib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 96 | c_zlib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 97 | c_zlib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 98 | c_zlib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 99 | c_zlib.o: c_zlib.c | ||
| 100 | comp_err.o: ../../include/openssl/bio.h ../../include/openssl/comp.h | ||
| 101 | comp_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 102 | comp_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 103 | comp_err.o: ../../include/openssl/opensslconf.h | ||
| 104 | comp_err.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 105 | comp_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 106 | comp_err.o: comp_err.c | ||
| 107 | comp_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 108 | comp_lib.o: ../../include/openssl/bn.h ../../include/openssl/comp.h | ||
| 109 | comp_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 110 | comp_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
| 111 | comp_lib.o: ../../include/openssl/opensslconf.h | ||
| 112 | comp_lib.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 113 | comp_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 114 | comp_lib.o: ../../include/openssl/symhacks.h comp_lib.c | ||
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index 5fcb521ffb..1bd2850d15 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
| @@ -51,17 +51,30 @@ static COMP_METHOD zlib_method={ | |||
| 51 | */ | 51 | */ |
| 52 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | 52 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) |
| 53 | # include <windows.h> | 53 | # include <windows.h> |
| 54 | |||
| 55 | # define Z_CALLCONV _stdcall | ||
| 56 | # define ZLIB_SHARED | ||
| 57 | #else | ||
| 58 | # define Z_CALLCONV | ||
| 54 | #endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ | 59 | #endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ |
| 55 | 60 | ||
| 56 | #ifdef ZLIB_SHARED | 61 | #ifdef ZLIB_SHARED |
| 57 | #include <openssl/dso.h> | 62 | #include <openssl/dso.h> |
| 58 | 63 | ||
| 64 | /* Prototypes for built in stubs */ | ||
| 65 | static int stub_compress(Bytef *dest,uLongf *destLen, | ||
| 66 | const Bytef *source, uLong sourceLen); | ||
| 67 | static int stub_inflateEnd(z_streamp strm); | ||
| 68 | static int stub_inflate(z_streamp strm, int flush); | ||
| 69 | static int stub_inflateInit_(z_streamp strm, const char * version, | ||
| 70 | int stream_size); | ||
| 71 | |||
| 59 | /* Function pointers */ | 72 | /* Function pointers */ |
| 60 | typedef int (*compress_ft)(Bytef *dest,uLongf *destLen, | 73 | typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen, |
| 61 | const Bytef *source, uLong sourceLen); | 74 | const Bytef *source, uLong sourceLen); |
| 62 | typedef int (*inflateEnd_ft)(z_streamp strm); | 75 | typedef int (Z_CALLCONV *inflateEnd_ft)(z_streamp strm); |
| 63 | typedef int (*inflate_ft)(z_streamp strm, int flush); | 76 | typedef int (Z_CALLCONV *inflate_ft)(z_streamp strm, int flush); |
| 64 | typedef int (*inflateInit__ft)(z_streamp strm, | 77 | typedef int (Z_CALLCONV *inflateInit__ft)(z_streamp strm, |
| 65 | const char * version, int stream_size); | 78 | const char * version, int stream_size); |
| 66 | static compress_ft p_compress=NULL; | 79 | static compress_ft p_compress=NULL; |
| 67 | static inflateEnd_ft p_inflateEnd=NULL; | 80 | static inflateEnd_ft p_inflateEnd=NULL; |
| @@ -71,10 +84,10 @@ static inflateInit__ft p_inflateInit_=NULL; | |||
| 71 | static int zlib_loaded = 0; /* only attempt to init func pts once */ | 84 | static int zlib_loaded = 0; /* only attempt to init func pts once */ |
| 72 | static DSO *zlib_dso = NULL; | 85 | static DSO *zlib_dso = NULL; |
| 73 | 86 | ||
| 74 | #define compress p_compress | 87 | #define compress stub_compress |
| 75 | #define inflateEnd p_inflateEnd | 88 | #define inflateEnd stub_inflateEnd |
| 76 | #define inflate p_inflate | 89 | #define inflate stub_inflate |
| 77 | #define inflateInit_ p_inflateInit_ | 90 | #define inflateInit_ stub_inflateInit_ |
| 78 | #endif /* ZLIB_SHARED */ | 91 | #endif /* ZLIB_SHARED */ |
| 79 | 92 | ||
| 80 | static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, | 93 | static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, |
| @@ -178,6 +191,16 @@ COMP_METHOD *COMP_zlib(void) | |||
| 178 | { | 191 | { |
| 179 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | 192 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) |
| 180 | zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); | 193 | zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); |
| 194 | if (!zlib_dso) | ||
| 195 | { | ||
| 196 | zlib_dso = DSO_load(NULL, "ZLIB", NULL, 0); | ||
| 197 | if (zlib_dso) | ||
| 198 | { | ||
| 199 | /* Clear the errors from the first failed | ||
| 200 | DSO_load() */ | ||
| 201 | ERR_clear_error(); | ||
| 202 | } | ||
| 203 | } | ||
| 181 | #else | 204 | #else |
| 182 | zlib_dso = DSO_load(NULL, "z", NULL, 0); | 205 | zlib_dso = DSO_load(NULL, "z", NULL, 0); |
| 183 | #endif | 206 | #endif |
| @@ -195,21 +218,54 @@ COMP_METHOD *COMP_zlib(void) | |||
| 195 | p_inflateInit_ | 218 | p_inflateInit_ |
| 196 | = (inflateInit__ft) DSO_bind_func(zlib_dso, | 219 | = (inflateInit__ft) DSO_bind_func(zlib_dso, |
| 197 | "inflateInit_"); | 220 | "inflateInit_"); |
| 198 | 221 | zlib_loaded++; | |
| 199 | if (p_compress && p_inflateEnd && p_inflate | ||
| 200 | && p_inflateInit_) | ||
| 201 | zlib_loaded++; | ||
| 202 | } | 222 | } |
| 203 | } | 223 | } |
| 204 | 224 | ||
| 205 | #endif | 225 | #endif |
| 206 | #ifdef ZLIB_SHARED | ||
| 207 | if (zlib_loaded) | ||
| 208 | #endif | ||
| 209 | #if defined(ZLIB) || defined(ZLIB_SHARED) | 226 | #if defined(ZLIB) || defined(ZLIB_SHARED) |
| 210 | meth = &zlib_method; | 227 | meth = &zlib_method; |
| 211 | #endif | 228 | #endif |
| 212 | 229 | ||
| 213 | return(meth); | 230 | return(meth); |
| 214 | } | 231 | } |
| 215 | 232 | ||
| 233 | #ifdef ZLIB_SHARED | ||
| 234 | /* Stubs for each function to be dynamicly loaded */ | ||
| 235 | static int | ||
| 236 | stub_compress(Bytef *dest,uLongf *destLen,const Bytef *source, uLong sourceLen) | ||
| 237 | { | ||
| 238 | if (p_compress) | ||
| 239 | return(p_compress(dest,destLen,source,sourceLen)); | ||
| 240 | else | ||
| 241 | return(Z_MEM_ERROR); | ||
| 242 | } | ||
| 243 | |||
| 244 | static int | ||
| 245 | stub_inflateEnd(z_streamp strm) | ||
| 246 | { | ||
| 247 | if ( p_inflateEnd ) | ||
| 248 | return(p_inflateEnd(strm)); | ||
| 249 | else | ||
| 250 | return(Z_MEM_ERROR); | ||
| 251 | } | ||
| 252 | |||
| 253 | static int | ||
| 254 | stub_inflate(z_streamp strm, int flush) | ||
| 255 | { | ||
| 256 | if ( p_inflate ) | ||
| 257 | return(p_inflate(strm,flush)); | ||
| 258 | else | ||
| 259 | return(Z_MEM_ERROR); | ||
| 260 | } | ||
| 261 | |||
| 262 | static int | ||
| 263 | stub_inflateInit_(z_streamp strm, const char * version, int stream_size) | ||
| 264 | { | ||
| 265 | if ( p_inflateInit_ ) | ||
| 266 | return(p_inflateInit_(strm,version,stream_size)); | ||
| 267 | else | ||
| 268 | return(Z_MEM_ERROR); | ||
| 269 | } | ||
| 270 | |||
| 271 | #endif /* ZLIB_SHARED */ | ||
