Deprecate COMP_zlib_cleanup() and make it a no-op
authorMatt Caswell <matt@openssl.org>
Mon, 4 Apr 2016 16:19:06 +0000 (17:19 +0100)
committerMatt Caswell <matt@openssl.org>
Wed, 13 Apr 2016 07:52:33 +0000 (08:52 +0100)
COMP_zlib_cleanup() should not be called expicitly - we should leave
auto-deinit to clean this up instead.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
crypto/comp/c_zlib.c
crypto/init.c
include/internal/comp.h [new file with mode: 0644]
include/openssl/comp.h

index 68b9da78be88da5446341d1e17634c70cfa89c8f..e16fbbb4eff71b7982c4174a821df8fa69f12ad0 100644 (file)
@@ -56,7 +56,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <openssl/objects.h>
-#include <openssl/comp.h>
+#include "internal/comp.h"
 #include <openssl/err.h>
 #include "internal/cryptlib_int.h"
 #include "internal/bio.h"
@@ -282,7 +282,7 @@ COMP_METHOD *COMP_zlib(void)
                 zlib_loaded++;
 
             if (!OPENSSL_init_crypto(OPENSSL_INIT_ZLIB, NULL)) {
-                COMP_zlib_cleanup();
+                comp_zlib_cleanup_internal();
                 return meth;
             }
             if (zlib_loaded)
@@ -297,7 +297,7 @@ COMP_METHOD *COMP_zlib(void)
     return (meth);
 }
 
-void COMP_zlib_cleanup(void)
+void comp_zlib_cleanup_internal(void)
 {
 #ifdef ZLIB_SHARED
     if (zlib_dso != NULL)
index 4d28e31ace40284c9b3c639c6f0bc8a9ffec3162..fe1ecd876c795f40e41b155988a740ea5aa305b7 100644 (file)
@@ -64,7 +64,7 @@
 #include <internal/conf.h>
 #include <internal/async.h>
 #include <internal/engine.h>
-#include <openssl/comp.h>
+#include <internal/comp.h>
 #include <internal/err.h>
 #include <stdlib.h>
 #include <assert.h>
@@ -427,9 +427,9 @@ void OPENSSL_cleanup(void)
     if (zlib_inited) {
 #ifdef OPENSSL_INIT_DEBUG
         fprintf(stderr, "OPENSSL_INIT: OPENSSL_cleanup: "
-                        "COMP_zlib_cleanup()\n");
+                        "comp_zlib_cleanup_internal()\n");
 #endif
-        COMP_zlib_cleanup();
+        comp_zlib_cleanup_internal();
     }
 #endif
 
diff --git a/include/internal/comp.h b/include/internal/comp.h
new file mode 100644 (file)
index 0000000..8232574
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+ * Licensed under the OpenSSL licenses, (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * https://www.openssl.org/source/license.html
+ * or in the file LICENSE in the source distribution.
+ */
+
+#include <openssl/comp.h>
+
+void comp_zlib_cleanup_internal(void);
index 9fa71efd5587f28e48c6f160898aaf7b23d8af4c..bfdadce1a146fdccdc5a4b44ee74bff6c32b3a56 100644 (file)
@@ -79,7 +79,10 @@ int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
                       unsigned char *in, int ilen);
 
 COMP_METHOD *COMP_zlib(void);
-void COMP_zlib_cleanup(void);
+
+#if OPENSSL_API_COMPAT < 0x10100000L
+#define COMP_zlib_cleanup()
+#endif
 
 # ifdef HEADER_BIO_H
 #  ifdef ZLIB