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

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