Blame SOURCES/openssl-fips-0.9.8e-cve-2009-2409.patch

5820f5
Skip signature validation on selfsigned certificates and
5820f5
drop MD2 algorithm from the list of algorithms added to
5820f5
EVP tables by default. (CVE-2009-2409)
5820f5
diff -up openssl-fips-0.9.8e/crypto/evp/c_alld.c.nomd2 openssl-fips-0.9.8e/crypto/evp/c_alld.c
5820f5
--- openssl-fips-0.9.8e/crypto/evp/c_alld.c.nomd2	2009-04-15 13:48:51.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/crypto/evp/c_alld.c	2010-01-14 09:24:00.000000000 +0100
5820f5
@@ -69,9 +69,6 @@ void OpenSSL_add_all_digests(void)
5820f5
 	if (!FIPS_mode())
5820f5
 		{
5820f5
 #endif
5820f5
-#ifndef OPENSSL_NO_MD2
5820f5
-	EVP_add_digest(EVP_md2());
5820f5
-#endif
5820f5
 #ifndef OPENSSL_NO_MD4
5820f5
 	EVP_add_digest(EVP_md4());
5820f5
 #endif
5820f5
diff -up openssl-fips-0.9.8e/crypto/x509/x509_vfy.c.nomd2 openssl-fips-0.9.8e/crypto/x509/x509_vfy.c
5820f5
--- openssl-fips-0.9.8e/crypto/x509/x509_vfy.c.nomd2	2009-04-15 13:48:51.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/crypto/x509/x509_vfy.c	2010-01-14 09:22:49.000000000 +0100
5820f5
@@ -1013,7 +1013,11 @@ static int internal_verify(X509_STORE_CT
5820f5
 	while (n >= 0)
5820f5
 		{
5820f5
 		ctx->error_depth=n;
5820f5
-		if (!xs->valid)
5820f5
+
5820f5
+		/* Skip signature check for self signed certificates. It
5820f5
+		 * doesn't add any security and just wastes time.
5820f5
+		 */
5820f5
+		if (!xs->valid && xs != xi)
5820f5
 			{
5820f5
 			if ((pkey=X509_get_pubkey(xi)) == NULL)
5820f5
 				{
5820f5
@@ -1023,13 +1027,6 @@ static int internal_verify(X509_STORE_CT
5820f5
 				if (!ok) goto end;
5820f5
 				}
5820f5
 			else if (X509_verify(xs,pkey) <= 0)
5820f5
-				/* XXX  For the final trusted self-signed cert,
5820f5
-				 * this is a waste of time.  That check should
5820f5
-				 * optional so that e.g. 'openssl x509' can be
5820f5
-				 * used to detect invalid self-signatures, but
5820f5
-				 * we don't verify again and again in SSL
5820f5
-				 * handshakes and the like once the cert has
5820f5
-				 * been declared trusted. */
5820f5
 				{
5820f5
 				ctx->error=X509_V_ERR_CERT_SIGNATURE_FAILURE;
5820f5
 				ctx->current_cert=xs;
5820f5
diff -up openssl-fips-0.9.8e/ssl/ssl_algs.c.nomd2 openssl-fips-0.9.8e/ssl/ssl_algs.c
5820f5
--- openssl-fips-0.9.8e/ssl/ssl_algs.c.nomd2	2009-04-15 14:09:42.000000000 +0200
5820f5
+++ openssl-fips-0.9.8e/ssl/ssl_algs.c	2010-01-14 09:23:10.000000000 +0100
5820f5
@@ -94,9 +94,6 @@ int SSL_library_init(void)
5820f5
 	EVP_add_cipher(EVP_seed_cbc());
5820f5
 #endif
5820f5
 
5820f5
-#ifndef OPENSSL_NO_MD2
5820f5
-	EVP_add_digest(EVP_md2());
5820f5
-#endif
5820f5
 #ifndef OPENSSL_NO_MD5
5820f5
 	EVP_add_digest(EVP_md5());
5820f5
 	EVP_add_digest_alias(SN_md5,"ssl2-md5");