summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xConfigure2
-rw-r--r--apps/enc.c14
-rw-r--r--apps/list.c2
-rw-r--r--apps/progs.pl4
-rw-r--r--crypto/cms/cms_cd.c2
-rw-r--r--crypto/cms/cms_lib.c2
-rw-r--r--crypto/cms/cms_smime.c2
-rw-r--r--crypto/comp/c_zlib.c14
-rw-r--r--include/openssl/comp.h2
-rw-r--r--test/bio_comp_test.c4
-rw-r--r--util/libcrypto.num2
11 files changed, 26 insertions, 24 deletions
diff --git a/Configure b/Configure
index 3deeb030a2..d5233103fc 100755
--- a/Configure
+++ b/Configure
@@ -1845,7 +1845,7 @@ foreach my $what (sort keys %disabled) {
if (!grep { $what eq $_ } ( 'buildtest-c++', 'fips', 'threads', 'shared',
'module', 'pic', 'dynamic-engine', 'makedepend',
- 'zlib-dynamic', 'zlib', 'sse2', 'legacy' )) {
+ 'sse2', 'legacy' )) {
(my $WHAT = uc $what) =~ s|-|_|g;
my $skipdir = $what;
diff --git a/apps/enc.c b/apps/enc.c
index cbeaeaa8aa..3a55d72c7a 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -91,7 +91,7 @@ const OPTIONS enc_options[] = {
{"iter", OPT_ITER, 'p', "Specify the iteration count and force use of PBKDF2"},
{"pbkdf2", OPT_PBKDF2, '-', "Use password-based key derivation function 2"},
{"none", OPT_NONE, '-', "Don't encrypt"},
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
{"z", OPT_Z, '-', "Compress or decompress encrypted data using zlib"},
#endif
{"", OPT_CIPHER, '-', "Any supported cipher"},
@@ -130,7 +130,7 @@ int enc_main(int argc, char **argv)
int streamable = 1;
int wrap = 0;
struct doall_enc_ciphers dec;
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
int do_zlib = 0;
BIO *bzl = NULL;
#endif
@@ -142,7 +142,7 @@ int enc_main(int argc, char **argv)
/* first check the command name */
if (strcmp(argv[0], "base64") == 0)
base64 = 1;
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
else if (strcmp(argv[0], "zlib") == 0)
do_zlib = 1;
#endif
@@ -225,7 +225,7 @@ int enc_main(int argc, char **argv)
base64 = 1;
break;
case OPT_Z:
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
do_zlib = 1;
#endif
break;
@@ -332,7 +332,7 @@ int enc_main(int argc, char **argv)
if (verbose)
BIO_printf(bio_err, "bufsize=%d\n", bsize);
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
if (do_zlib)
base64 = 0;
#endif
@@ -417,7 +417,7 @@ int enc_main(int argc, char **argv)
wbio = out;
#ifndef OPENSSL_NO_COMP
-# ifdef ZLIB
+# ifndef OPENSSL_NO_ZLIB
if (do_zlib) {
if ((bzl = BIO_new(BIO_f_zlib())) == NULL)
goto end;
@@ -699,7 +699,7 @@ int enc_main(int argc, char **argv)
BIO_free(b64);
EVP_MD_free(dgst);
EVP_CIPHER_free(cipher);
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
BIO_free(bzl);
#endif
BIO_free(bbrot);
diff --git a/apps/list.c b/apps/list.c
index 76067f6b3b..5e7169025e 100644
--- a/apps/list.c
+++ b/apps/list.c
@@ -1421,7 +1421,7 @@ static void list_disabled(void)
#ifdef OPENSSL_NO_WHIRLPOOL
BIO_puts(bio_out, "WHIRLPOOL\n");
#endif
-#ifndef ZLIB
+#ifdef OPENSSL_NO_ZLIB
BIO_puts(bio_out, "ZLIB\n");
#endif
#ifdef OPENSSL_NO_BROTLI
diff --git a/apps/progs.pl b/apps/progs.pl
index 77404e78dc..f27ccfbba3 100644
--- a/apps/progs.pl
+++ b/apps/progs.pl
@@ -205,9 +205,7 @@ EOF
) {
my $str = " {FT_cipher, \"$cmd\", enc_main, enc_options, NULL},\n";
(my $algo = $cmd) =~ s/-.*//g;
- if ($cmd eq "zlib") {
- print "#ifdef ZLIB\n${str}#endif\n";
- } elsif (grep { $algo eq $_ } @disablables) {
+ if (grep { $algo eq $_ } @disablables) {
print "#ifndef OPENSSL_NO_" . uc($algo) . "\n${str}#endif\n";
} elsif (my $disabler = $cipher_disabler{$algo}) {
print "#ifndef OPENSSL_NO_" . uc($disabler) . "\n${str}#endif\n";
diff --git a/crypto/cms/cms_cd.c b/crypto/cms/cms_cd.c
index 5578292dbf..3000268480 100644
--- a/crypto/cms/cms_cd.c
+++ b/crypto/cms/cms_cd.c
@@ -17,7 +17,7 @@
#include <openssl/comp.h>
#include "cms_local.h"
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
/* CMS CompressedData Utilities */
diff --git a/crypto/cms/cms_lib.c b/crypto/cms/cms_lib.c
index d92772d41d..a9e659b23d 100644
--- a/crypto/cms/cms_lib.c
+++ b/crypto/cms/cms_lib.c
@@ -174,7 +174,7 @@ BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont)
case NID_pkcs7_digest:
cmsbio = ossl_cms_DigestedData_init_bio(cms);
break;
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
case NID_id_smime_ct_compressedData:
cmsbio = ossl_cms_CompressedData_init_bio(cms);
break;
diff --git a/crypto/cms/cms_smime.c b/crypto/cms/cms_smime.c
index fe0850b93e..c5b82cf956 100644
--- a/crypto/cms/cms_smime.c
+++ b/crypto/cms/cms_smime.c
@@ -930,7 +930,7 @@ err:
return ret;
}
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
unsigned int flags)
diff --git a/crypto/comp/c_zlib.c b/crypto/comp/c_zlib.c
index 4ab876b59f..426b8b0b74 100644
--- a/crypto/comp/c_zlib.c
+++ b/crypto/comp/c_zlib.c
@@ -29,7 +29,7 @@ static COMP_METHOD zlib_method_nozlib = {
NULL,
};
-#ifndef ZLIB
+#ifdef OPENSSL_NO_ZLIB
# undef ZLIB_SHARED
#else
@@ -247,7 +247,7 @@ COMP_METHOD *COMP_zlib(void)
{
COMP_METHOD *meth = &zlib_method_nozlib;
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
if (RUN_ONCE(&zlib_once, ossl_comp_zlib_init))
meth = &zlib_stateful_method;
#endif
@@ -264,7 +264,7 @@ void ossl_comp_zlib_cleanup(void)
#endif
}
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
/* Zlib based compression/decompression filter BIO */
@@ -304,12 +304,18 @@ static const BIO_METHOD bio_meth_zlib = {
bio_zlib_free,
bio_zlib_callback_ctrl
};
+#endif
const BIO_METHOD *BIO_f_zlib(void)
{
- return &bio_meth_zlib;
+#ifndef OPENSSL_NO_ZLIB
+ if (RUN_ONCE(&zlib_once, ossl_comp_zlib_init))
+ return &bio_meth_zlib;
+#endif
+ return NULL;
}
+#ifndef OPENSSL_NO_ZLIB
static int bio_zlib_new(BIO *bi)
{
BIO_ZLIB_CTX *ctx;
diff --git a/include/openssl/comp.h b/include/openssl/comp.h
index b1a9554cb8..885fdf6183 100644
--- a/include/openssl/comp.h
+++ b/include/openssl/comp.h
@@ -50,9 +50,7 @@ COMP_METHOD *COMP_zstd_oneshot(void);
#endif
# ifdef OPENSSL_BIO_H
-# ifdef ZLIB
const BIO_METHOD *BIO_f_zlib(void);
-# endif
const BIO_METHOD *BIO_f_brotli(void);
const BIO_METHOD *BIO_f_zstd(void);
# endif
diff --git a/test/bio_comp_test.c b/test/bio_comp_test.c
index 5e0888da7f..ab56e981f5 100644
--- a/test/bio_comp_test.c
+++ b/test/bio_comp_test.c
@@ -129,7 +129,7 @@ static int test_brotli(int n)
return do_bio_comp(BIO_f_brotli(), n);
}
#endif
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
static int test_zlib(int n)
{
return do_bio_comp(BIO_f_zlib(), n);
@@ -138,7 +138,7 @@ static int test_zlib(int n)
int setup_tests(void)
{
-#ifdef ZLIB
+#ifndef OPENSSL_NO_ZLIB
ADD_ALL_TESTS(test_zlib, NUM_SIZES * 4);
#endif
#ifndef OPENSSL_NO_BROTLI
diff --git a/util/libcrypto.num b/util/libcrypto.num
index ec594ea551..e6e9ecbe5f 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -2443,7 +2443,7 @@ ASN1_STRING_type_new 2494 3_0_0 EXIST::FUNCTION:
TS_STATUS_INFO_free 2495 3_0_0 EXIST::FUNCTION:TS
BN_mod_mul 2496 3_0_0 EXIST::FUNCTION:
CMS_add0_recipient_key 2497 3_0_0 EXIST::FUNCTION:CMS
-BIO_f_zlib 2498 3_0_0 EXIST::FUNCTION:COMP,ZLIB
+BIO_f_zlib 2498 3_0_0 EXIST::FUNCTION:COMP
AES_cfb128_encrypt 2499 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0
ENGINE_set_EC 2500 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0,ENGINE
d2i_ECPKParameters 2501 3_0_0 EXIST::FUNCTION:EC