a1fb602
diff -up openssl-1.0.2a/doc/ssl/SSL_COMP_add_compression_method.pod.env-zlib openssl-1.0.2a/doc/ssl/SSL_COMP_add_compression_method.pod
a1fb602
--- openssl-1.0.2a/doc/ssl/SSL_COMP_add_compression_method.pod.env-zlib	2015-04-09 18:17:20.509637597 +0200
a1fb602
+++ openssl-1.0.2a/doc/ssl/SSL_COMP_add_compression_method.pod	2015-04-09 18:17:14.767504953 +0200
169c3a0
@@ -47,6 +47,13 @@ Once the identities of the compression m
169c3a0
 been standardized, the compression API will most likely be changed. Using
169c3a0
 it in the current state is not recommended.
169c3a0
 
169c3a0
+It is also not recommended to use compression if data transfered contain
169c3a0
+untrusted parts that can be manipulated by an attacker as he could then
169c3a0
+get information about the encrypted data. See the CRIME attack. For
169c3a0
+that reason the default loading of the zlib compression method is
169c3a0
+disabled and enabled only if the environment variable B<OPENSSL_DEFAULT_ZLIB>
169c3a0
+is present during the library initialization.
169c3a0
+
169c3a0
 =head1 RETURN VALUES
169c3a0
 
169c3a0
 SSL_COMP_add_compression_method() may return the following values:
a1fb602
diff -up openssl-1.0.2a/ssl/ssl_ciph.c.env-zlib openssl-1.0.2a/ssl/ssl_ciph.c
a1fb602
--- openssl-1.0.2a/ssl/ssl_ciph.c.env-zlib	2015-04-09 18:17:20.510637620 +0200
a1fb602
+++ openssl-1.0.2a/ssl/ssl_ciph.c	2015-04-09 18:17:20.264631937 +0200
169c3a0
@@ -140,6 +140,8 @@
169c3a0
  * OTHERWISE.
169c3a0
  */
169c3a0
 
169c3a0
+/* for secure_getenv */
169c3a0
+#define _GNU_SOURCE
169c3a0
 #include <stdio.h>
169c3a0
 #include <openssl/objects.h>
169c3a0
 #ifndef OPENSSL_NO_COMP
a1fb602
@@ -450,7 +452,8 @@ static void load_builtin_compressions(vo
169c3a0
 
a1fb602
             MemCheck_off();
a1fb602
             ssl_comp_methods = sk_SSL_COMP_new(sk_comp_cmp);
a1fb602
-            if (ssl_comp_methods != NULL) {
a1fb602
+            if (ssl_comp_methods != NULL
a1fb602
+                && secure_getenv("OPENSSL_DEFAULT_ZLIB") != NULL) {
a1fb602
                 comp = (SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
a1fb602
                 if (comp != NULL) {
a1fb602
                     comp->method = COMP_zlib();