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

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