Blame SOURCES/openssl-fips-0.9.8e-env-zlib.patch

5820f5
diff -up openssl-fips-0.9.8e/doc/ssl/SSL_COMP_add_compression_method.pod.env-zlib openssl-fips-0.9.8e/doc/ssl/SSL_COMP_add_compression_method.pod
5820f5
--- openssl-fips-0.9.8e/doc/ssl/SSL_COMP_add_compression_method.pod.env-zlib	2003-11-29 11:33:25.000000000 +0100
5820f5
+++ openssl-fips-0.9.8e/doc/ssl/SSL_COMP_add_compression_method.pod	2013-07-17 12:30:39.390891366 +0200
5820f5
@@ -47,6 +47,13 @@ Once the identities of the compression m
5820f5
 been standardized, the compression API will most likely be changed. Using
5820f5
 it in the current state is not recommended.
5820f5
 
5820f5
+It is also not recommended to use compression if data transfered contain
5820f5
+untrusted parts that can be manipulated by an attacker as he could then
5820f5
+get information about the encrypted data. See the CRIME attack. For
5820f5
+that reason the default loading of the zlib compression method is
5820f5
+disabled and enabled only if the environment variable B<OPENSSL_DEFAULT_ZLIB>
5820f5
+is present during the library initialization.
5820f5
+
5820f5
 =head1 RETURN VALUES
5820f5
 
5820f5
 SSL_COMP_add_compression_method() may return the following values:
5820f5
diff -up openssl-fips-0.9.8e/README.env-zlib openssl-fips-0.9.8e/README
5820f5
--- openssl-fips-0.9.8e/README.env-zlib	2007-03-22 01:37:41.000000000 +0100
5820f5
+++ openssl-fips-0.9.8e/README	2013-07-17 12:30:39.390891366 +0200
5820f5
@@ -8,8 +8,22 @@
5820f5
  WARNING
5820f5
  -------
5820f5
 
5820f5
- This version of OpenSSL is an initial port of the FIPS 140-2 code to OpenSSL
5820f5
- 0.9.8. See the file README.FIPS for brief usage details.
5820f5
+ This version of OpenSSL is based on upstream openssl-fips-1.2.0 code
5820f5
+ which is also undergoing FIPS validation.
5820f5
+ 
5820f5
+ However this version contains a few differences from the upstream code
5820f5
+ some of which are:
5820f5
+   * The module respects the kernel FIPS flag /proc/sys/crypto/fips and
5820f5
+     tries to initialize the FIPS mode if it is set to 1 aborting if the
5820f5
+     FIPS mode could not be initialized. It is also possible to force the
5820f5
+     OpenSSL library to FIPS mode especially for debugging purposes by
5820f5
+     setting the environment variable OPENSSL_FORCE_FIPS_MODE.
5820f5
+   * If the environment variable OPENSSL_DEFAULT_ZLIB is set the module
5820f5
+     will automatically load the built in compression method ZLIB
5820f5
+     when initialized. Applications can still explicitely ask for ZLIB
5820f5
+     compression method with API calls. Otherwise the compression is not
5820f5
+     loaded and used due to protocol vulnerability as described in the
5820f5
+     CRIME attack.
5820f5
 
5820f5
  DESCRIPTION
5820f5
  -----------
5820f5
diff -up openssl-fips-0.9.8e/ssl/ssl_ciph.c.env-zlib openssl-fips-0.9.8e/ssl/ssl_ciph.c
5820f5
--- openssl-fips-0.9.8e/ssl/ssl_ciph.c.env-zlib	2007-08-13 20:35:04.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/ssl/ssl_ciph.c	2013-07-17 12:31:22.855061684 +0200
5820f5
@@ -113,6 +113,8 @@
5820f5
  * ECC cipher suite support in OpenSSL originally developed by 
5820f5
  * SUN MICROSYSTEMS, INC., and contributed to the OpenSSL project.
5820f5
  */
5820f5
+/* for secure_getenv */
5820f5
+#define _GNU_SOURCE
5820f5
 #include <stdio.h>
5820f5
 #include <openssl/objects.h>
5820f5
 #include <openssl/comp.h>
5820f5
@@ -284,7 +286,7 @@ static void load_builtin_compressions(vo
5820f5
 
5820f5
 			MemCheck_off();
5820f5
 			ssl_comp_methods=sk_SSL_COMP_new(sk_comp_cmp);
5820f5
-			if (ssl_comp_methods != NULL)
5820f5
+			if (ssl_comp_methods != NULL && secure_getenv("OPENSSL_DEFAULT_ZLIB") != NULL)
5820f5
 				{
5820f5
 				comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
5820f5
 				if (comp != NULL)