Blame SOURCES/openssl-1.0.2a-env-zlib.patch

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