diff options
author | djm <> | 2006-06-27 05:07:03 +0000 |
---|---|---|
committer | djm <> | 2006-06-27 05:07:03 +0000 |
commit | 7fe7e1ed6bcd0e342aed7c0f890962dda616aa0d (patch) | |
tree | 224c33f66b0b932c84dda315d9ba4236bf125b1c /src/lib/libcrypto/comp | |
parent | 3f764f48d2626a43b6eeef7652c28303269d1204 (diff) | |
download | openbsd-7fe7e1ed6bcd0e342aed7c0f890962dda616aa0d.tar.gz openbsd-7fe7e1ed6bcd0e342aed7c0f890962dda616aa0d.tar.bz2 openbsd-7fe7e1ed6bcd0e342aed7c0f890962dda616aa0d.zip |
resolve conflicts
Diffstat (limited to 'src/lib/libcrypto/comp')
-rw-r--r-- | src/lib/libcrypto/comp/c_zlib.c | 88 |
1 files changed, 16 insertions, 72 deletions
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index 1bd2850d15..5fcb521ffb 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
@@ -51,30 +51,17 @@ 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 | ||
59 | #endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ | 54 | #endif /* !(OPENSSL_SYS_WINDOWS || OPENSSL_SYS_WIN32) */ |
60 | 55 | ||
61 | #ifdef ZLIB_SHARED | 56 | #ifdef ZLIB_SHARED |
62 | #include <openssl/dso.h> | 57 | #include <openssl/dso.h> |
63 | 58 | ||
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 | |||
72 | /* Function pointers */ | 59 | /* Function pointers */ |
73 | typedef int (Z_CALLCONV *compress_ft)(Bytef *dest,uLongf *destLen, | 60 | typedef int (*compress_ft)(Bytef *dest,uLongf *destLen, |
74 | const Bytef *source, uLong sourceLen); | 61 | const Bytef *source, uLong sourceLen); |
75 | typedef int (Z_CALLCONV *inflateEnd_ft)(z_streamp strm); | 62 | typedef int (*inflateEnd_ft)(z_streamp strm); |
76 | typedef int (Z_CALLCONV *inflate_ft)(z_streamp strm, int flush); | 63 | typedef int (*inflate_ft)(z_streamp strm, int flush); |
77 | typedef int (Z_CALLCONV *inflateInit__ft)(z_streamp strm, | 64 | typedef int (*inflateInit__ft)(z_streamp strm, |
78 | const char * version, int stream_size); | 65 | const char * version, int stream_size); |
79 | static compress_ft p_compress=NULL; | 66 | static compress_ft p_compress=NULL; |
80 | static inflateEnd_ft p_inflateEnd=NULL; | 67 | static inflateEnd_ft p_inflateEnd=NULL; |
@@ -84,10 +71,10 @@ static inflateInit__ft p_inflateInit_=NULL; | |||
84 | static int zlib_loaded = 0; /* only attempt to init func pts once */ | 71 | static int zlib_loaded = 0; /* only attempt to init func pts once */ |
85 | static DSO *zlib_dso = NULL; | 72 | static DSO *zlib_dso = NULL; |
86 | 73 | ||
87 | #define compress stub_compress | 74 | #define compress p_compress |
88 | #define inflateEnd stub_inflateEnd | 75 | #define inflateEnd p_inflateEnd |
89 | #define inflate stub_inflate | 76 | #define inflate p_inflate |
90 | #define inflateInit_ stub_inflateInit_ | 77 | #define inflateInit_ p_inflateInit_ |
91 | #endif /* ZLIB_SHARED */ | 78 | #endif /* ZLIB_SHARED */ |
92 | 79 | ||
93 | static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, | 80 | static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out, |
@@ -191,16 +178,6 @@ COMP_METHOD *COMP_zlib(void) | |||
191 | { | 178 | { |
192 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) | 179 | #if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) |
193 | zlib_dso = DSO_load(NULL, "ZLIB1", NULL, 0); | 180 | 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 | } | ||
204 | #else | 181 | #else |
205 | zlib_dso = DSO_load(NULL, "z", NULL, 0); | 182 | zlib_dso = DSO_load(NULL, "z", NULL, 0); |
206 | #endif | 183 | #endif |
@@ -218,54 +195,21 @@ COMP_METHOD *COMP_zlib(void) | |||
218 | p_inflateInit_ | 195 | p_inflateInit_ |
219 | = (inflateInit__ft) DSO_bind_func(zlib_dso, | 196 | = (inflateInit__ft) DSO_bind_func(zlib_dso, |
220 | "inflateInit_"); | 197 | "inflateInit_"); |
221 | zlib_loaded++; | 198 | |
199 | if (p_compress && p_inflateEnd && p_inflate | ||
200 | && p_inflateInit_) | ||
201 | zlib_loaded++; | ||
222 | } | 202 | } |
223 | } | 203 | } |
224 | 204 | ||
225 | #endif | 205 | #endif |
206 | #ifdef ZLIB_SHARED | ||
207 | if (zlib_loaded) | ||
208 | #endif | ||
226 | #if defined(ZLIB) || defined(ZLIB_SHARED) | 209 | #if defined(ZLIB) || defined(ZLIB_SHARED) |
227 | meth = &zlib_method; | 210 | meth = &zlib_method; |
228 | #endif | 211 | #endif |
229 | 212 | ||
230 | return(meth); | 213 | return(meth); |
231 | } | 214 | } |
232 | 215 | ||
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 */ | ||