Remove a few bits of junk, mostly support for dso loading of zlib
which i suspect is fully dead.
Index: c_rle.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/comp/c_rle.c,v
retrieving revision 1.7
diff -u -p -r1.7 c_rle.c
--- c_rle.c 12 Jun 2014 15:49:28 -0000 1.7
+++ c_rle.c 31 Oct 2014 04:03:32 -0000
@@ -27,10 +27,8 @@ static int
rle_compress_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen,
unsigned char *in, unsigned int ilen)
{
- /* int i; */
if (ilen == 0 || olen < (ilen - 1)) {
- /* ZZZZZZZZZZZZZZZZZZZZZZ */
return (-1);
}
@@ -46,7 +44,6 @@ rle_expand_block(COMP_CTX *ctx, unsigned
int i;
if (olen < (ilen - 1)) {
- /* ZZZZZZZZZZZZZZZZZZZZZZ */
return (-1);
}
Index: c_zlib.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/comp/c_zlib.c,v
retrieving revision 1.16
diff -u -p -r1.16 c_zlib.c
--- c_zlib.c 12 Jun 2014 15:49:28 -0000 1.16
+++ c_zlib.c 31 Oct 2014 04:07:43 -0000
@@ -13,9 +13,7 @@ static COMP_METHOD zlib_method_nozlib =
.name = "(undef)"
};
-#ifndef ZLIB
-#undef ZLIB_SHARED
-#else
+#ifdef ZLIB
#include <zlib.h>
@@ -40,23 +38,6 @@ zlib_zfree(void* opaque, void* address)
free(address);
}
-#if 0
-static int zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
- unsigned int olen, unsigned char *in, unsigned int ilen);
-static int zlib_expand_block(COMP_CTX *ctx, unsigned char *out,
- unsigned int olen, unsigned char *in, unsigned int ilen);
-
-static int zz_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
- uLong sourceLen);
-
-static COMP_METHOD zlib_stateless_method = {
- .type = NID_zlib_compression,
- .name = LN_zlib_compression,
- .compress = zlib_compress_block,
- .expand = zlib_expand_block
-};
-#endif
-
static COMP_METHOD zlib_stateful_method = {
.type = NID_zlib_compression,
.name = LN_zlib_compression,
@@ -66,43 +47,6 @@ static COMP_METHOD zlib_stateful_method
.expand = zlib_stateful_expand_block
};
-#ifdef ZLIB_SHARED
-#include <openssl/dso.h>
-
-/* Function pointers */
-typedef int (*compress_ft)(Bytef *dest, uLongf *destLen, const Bytef *source,
- uLong sourceLen);
-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 (*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);
-typedef const char * (*zError__ft)(int err);
-static compress_ft p_compress = NULL;
-static inflateEnd_ft p_inflateEnd = NULL;
-static inflate_ft p_inflate = NULL;
-static inflateInit__ft p_inflateInit_ = NULL;
-static deflateEnd_ft p_deflateEnd = NULL;
-static deflate_ft p_deflate = NULL;
-static deflateInit__ft p_deflateInit_ = NULL;
-static zError__ft p_zError = NULL;
-
-static int zlib_loaded = 0; /* only attempt to init func pts once */
-static DSO *zlib_dso = NULL;
-
-#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_
-#define zError p_zError
-#endif /* ZLIB_SHARED */
-
struct zlib_state {
z_stream istream;
z_stream ostream;
@@ -225,102 +169,6 @@ zlib_stateful_expand_block(COMP_CTX *ctx
return olen - state->istream.avail_out;
}
-#if 0
-static int
-zlib_compress_block(COMP_CTX *ctx, unsigned char *out,
- unsigned int olen, unsigned char *in, unsigned int ilen)
-{
- unsigned long l;
- int i;
- int clear = 1;
-
- if (ilen > 128) {
- out[0] = 1;
- l = olen - 1;
- i = compress(&(out[1]), &l, in, (unsigned long)ilen);
- if (i != Z_OK)
- return (-1);
- if (ilen > l) {
- clear = 0;
- l++;
- }
- }
- if (clear) {
- out[0] = 0;
- memcpy(&(out[1]), in, ilen);
- l = ilen + 1;
- }
-
-#ifdef DEBUG_ZLIB
- fprintf(stderr, "compress(%4d)->%4d %s\n",
- ilen,(int)l, (clear)?"clear":"zlib");
-#endif
-
- return ((int)l);
-}
-
-static int
-zlib_expand_block(COMP_CTX *ctx, unsigned char *out, unsigned int olen,
- unsigned char *in, unsigned int ilen)
-{
- unsigned long l;
- int i;
-
- if (in[0]) {
- l = olen;
- i = zz_uncompress(out, &l, &(in[1]), (unsigned long)ilen - 1);
- if (i != Z_OK)
- return (-1);
- } else {
- memcpy(out, &(in[1]), ilen - 1);
- l = ilen - 1;
- }
-
-#ifdef DEBUG_ZLIB
- fprintf(stderr, "expand (%4d)->%4d %s\n",
- ilen,(int)l, in[0]?"zlib":"clear");
-#endif
-
- return ((int)l);
-}
-
-static int
-zz_uncompress(Bytef *dest, uLongf *destLen, const Bytef *source,
- uLong sourceLen)
-{
- z_stream stream;
- int err;
-
- stream.next_in = (Bytef*)source;
- stream.avail_in = (uInt)sourceLen;
- /* Check for source > 64K on 16-bit machine: */
- if ((uLong)stream.avail_in != sourceLen)
- return Z_BUF_ERROR;
-
- stream.next_out = dest;
- stream.avail_out = (uInt)*destLen;
- if ((uLong)stream.avail_out != *destLen)
- return Z_BUF_ERROR;
-
- stream.zalloc = (alloc_func)0;
- stream.zfree = (free_func)0;
-
- err = inflateInit_(&stream, ZLIB_VERSION, sizeof(z_stream));
- if (err != Z_OK)
- return err;
-
- err = inflate(&stream, Z_FINISH);
- if (err != Z_STREAM_END) {
- inflateEnd(&stream);
- return err;
- }
- *destLen = stream.total_out;
-
- err = inflateEnd(&stream);
- return err;
-}
-#endif
-
#endif
COMP_METHOD *
@@ -328,39 +176,7 @@ COMP_zlib(void)
{
COMP_METHOD *meth = &zlib_method_nozlib;
-#ifdef ZLIB_SHARED
- if (!zlib_loaded) {
- zlib_dso = DSO_load(NULL, "z", NULL, 0);
- if (zlib_dso != NULL) {
- p_compress = (compress_ft)DSO_bind_func(
- zlib_dso, "compress");
- p_inflateEnd = (inflateEnd_ft)DSO_bind_func(
- zlib_dso, "inflateEnd");
- p_inflate = (inflate_ft)DSO_bind_func(
- zlib_dso, "inflate");
- p_inflateInit_ = (inflateInit__ft)DSO_bind_func(
- zlib_dso, "inflateInit_");
- p_deflateEnd = (deflateEnd_ft)DSO_bind_func(
- zlib_dso, "deflateEnd");
- p_deflate = (deflate_ft)DSO_bind_func(
- zlib_dso, "deflate");
- p_deflateInit_ = (deflateInit__ft)DSO_bind_func(
- zlib_dso, "deflateInit_");
- p_zError = (zError__ft)DSO_bind_func(
- zlib_dso, "zError");
-
- if (p_compress && p_inflateEnd && p_inflate &&
- p_inflateInit_ && p_deflateEnd && p_deflate &&
- p_deflateInit_ && p_zError)
- zlib_loaded++;
- }
- }
-
-#endif
-#ifdef ZLIB_SHARED
- if (zlib_loaded)
-#endif
-#if defined(ZLIB) || defined(ZLIB_SHARED)
+#ifdef ZLIB
{
/* init zlib_stateful_ex_idx here so that in a multi-process
* application it's enough to intialize openssl before forking
@@ -388,10 +204,6 @@ err:
void
COMP_zlib_cleanup(void)
{
-#ifdef ZLIB_SHARED
- if (zlib_dso)
- DSO_free(zlib_dso);
-#endif
}
#ifdef ZLIB
@@ -443,13 +255,6 @@ bio_zlib_new(BIO *bi)
{
BIO_ZLIB_CTX *ctx;
-#ifdef ZLIB_SHARED
- (void)COMP_zlib();
- if (!zlib_loaded) {
- COMPerr(COMP_F_BIO_ZLIB_NEW, COMP_R_ZLIB_NOT_SUPPORTED);
- return 0;
- }
-#endif
ctx = malloc(sizeof(BIO_ZLIB_CTX));
if (!ctx) {
COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE);
Index: comp.h
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/comp/comp.h,v
retrieving revision 1.7
diff -u -p -r1.7 comp.h
--- comp.h 12 Jun 2014 15:49:28 -0000 1.7
+++ comp.h 31 Oct 2014 04:03:04 -0000
@@ -52,10 +52,6 @@ BIO_METHOD *BIO_f_zlib(void);
#endif
#endif
-/* BEGIN ERROR CODES */
-/* The following lines are auto generated by the script mkerr.pl. Any changes
- * made after this point may be overwritten when the script is next run.
- */
void ERR_load_COMP_strings(void);
/* Error codes for the COMP functions. */
Index: comp_err.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/comp/comp_err.c,v
retrieving revision 1.8
diff -u -p -r1.8 comp_err.c
--- comp_err.c 10 Jul 2014 22:45:56 -0000 1.8
+++ comp_err.c 31 Oct 2014 04:06:00 -0000
@@ -53,11 +53,6 @@
*
*/
-/* NOTE: this file was auto generated by the mkerr.pl script: any changes
- * made to it will be overwritten when the script next updates this file,
- * only reason strings will be preserved.
- */
-
#include <stdio.h>
#include <openssl/opensslconf.h>
Index: comp_lib.c
===================================================================
RCS file: /cvs/src/lib/libssl/src/crypto/comp/comp_lib.c,v
retrieving revision 1.7
diff -u -p -r1.7 comp_lib.c
--- comp_lib.c 12 Jun 2014 15:49:28 -0000 1.7
+++ comp_lib.c 31 Oct 2014 04:06:14 -0000
@@ -11,7 +11,6 @@ COMP_CTX_new(COMP_METHOD *meth)
COMP_CTX *ret;
if ((ret = calloc(1, sizeof(COMP_CTX))) == NULL) {
- /* ZZZZZZZZZZZZZZZZ */
return (NULL);
}
ret->meth = meth;
@@ -41,7 +40,6 @@ COMP_compress_block(COMP_CTX *ctx, unsig
int ret;
if (ctx->meth->compress == NULL) {
- /* ZZZZZZZZZZZZZZZZZ */
return (-1);
}
ret = ctx->meth->compress(ctx, out, olen, in, ilen);
@@ -59,7 +57,6 @@ COMP_expand_block(COMP_CTX *ctx, unsigne
int ret;
if (ctx->meth->expand == NULL) {
- /* ZZZZZZZZZZZZZZZZZ */
return (-1);
}
ret = ctx->meth->expand(ctx, out, olen, in, ilen);