Blame openssl-1.1.0-disable-ssl3.patch

Paolo Bonzini 7ae6f1
diff --git a/CryptoPkg/Library/OpensslLib/openssl/ssl/ssl_lib.c b/CryptoPkg/Library/OpensslLib/openssl/ssl/ssl_lib.c
Paolo Bonzini 7ae6f1
index 8a190d2..6b4c5ae 100644
Paolo Bonzini 7ae6f1
--- a/CryptoPkg/Library/OpensslLib/openssl/ssl/ssl_lib.c
Paolo Bonzini 7ae6f1
+++ b/CryptoPkg/Library/OpensslLib/openssl/ssl/ssl_lib.c
Paolo Bonzini 7ae6f1
@@ -2653,6 +2653,13 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
Paolo Bonzini 91c79a
      * or by using the SSL_CONF library.
Paolo Bonzini 91c79a
      */
Paolo Bonzini 91c79a
     ret->options |= SSL_OP_NO_COMPRESSION;
Paolo Bonzini 91c79a
+    /*
Paolo Bonzini 91c79a
+     * Disable SSLv3 by default.  Applications can
Paolo Bonzini 91c79a
+     * re-enable it by configuring
Paolo Bonzini 91c79a
+     * SSL_CTX_clear_options(ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
+     * or by using the SSL_CONF library.
Paolo Bonzini 91c79a
+     */
Paolo Bonzini 91c79a
+    ret->options |= SSL_OP_NO_SSLv3;
Paolo Bonzini 91c79a
 
Paolo Bonzini 91c79a
     ret->tlsext_status_type = -1;
Paolo Bonzini 91c79a
 
Paolo Bonzini 7ae6f1
diff --git a/CryptoPkg/Library/OpensslLib/openssl/test/ssl_test.c b/CryptoPkg/Library/OpensslLib/openssl/test/ssl_test.c
Paolo Bonzini 7ae6f1
index 2cbbddd..1a409d1 100644
Paolo Bonzini 7ae6f1
--- a/CryptoPkg/Library/OpensslLib/openssl/test/ssl_test.c
Paolo Bonzini 7ae6f1
+++ b/CryptoPkg/Library/OpensslLib/openssl/test/ssl_test.c
Paolo Bonzini 7ae6f1
@@ -277,6 +277,7 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
Paolo Bonzini 91c79a
             SSL_TEST_SERVERNAME_CB_NONE) {
Paolo Bonzini 91c79a
             server2_ctx = SSL_CTX_new(TLS_server_method());
Paolo Bonzini 91c79a
             TEST_check(server2_ctx != NULL);
Paolo Bonzini 91c79a
+            SSL_CTX_clear_options(server2_ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
         }
Paolo Bonzini 91c79a
         client_ctx = SSL_CTX_new(TLS_client_method());
Paolo Bonzini 7ae6f1
         TEST_check(SSL_CTX_set_max_proto_version(client_ctx, TLS_MAX_VERSION));
Paolo Bonzini 7ae6f1
@@ -290,11 +291,15 @@ static int execute_test(SSL_TEST_FIXTURE fixture)
Paolo Bonzini 7ae6f1
                                                      TLS_MAX_VERSION));
Paolo Bonzini 91c79a
             TEST_check(resume_server_ctx != NULL);
Paolo Bonzini 91c79a
             TEST_check(resume_client_ctx != NULL);
Paolo Bonzini 91c79a
+            SSL_CTX_clear_options(resume_server_ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
+            SSL_CTX_clear_options(resume_client_ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
         }
Paolo Bonzini 91c79a
     }
Paolo Bonzini 91c79a
 
Paolo Bonzini 91c79a
     TEST_check(server_ctx != NULL);
Paolo Bonzini 91c79a
     TEST_check(client_ctx != NULL);
Paolo Bonzini 91c79a
+    SSL_CTX_clear_options(server_ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
+    SSL_CTX_clear_options(client_ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
 
Paolo Bonzini 91c79a
     TEST_check(CONF_modules_load(conf, fixture.test_app, 0) > 0);
Paolo Bonzini 91c79a
 
Paolo Bonzini 7ae6f1
diff --git a/CryptoPkg/Library/OpensslLib/openssl/test/ssltest_old.c b/CryptoPkg/Library/OpensslLib/openssl/test/ssltest_old.c
Paolo Bonzini 7ae6f1
index e77c692..e586072 100644
Paolo Bonzini 7ae6f1
--- a/CryptoPkg/Library/OpensslLib/openssl/test/ssltest_old.c
Paolo Bonzini 7ae6f1
+++ b/CryptoPkg/Library/OpensslLib/openssl/test/ssltest_old.c
Paolo Bonzini 7ae6f1
@@ -1460,6 +1460,11 @@ int main(int argc, char *argv[])
Paolo Bonzini 91c79a
         ERR_print_errors(bio_err);
Paolo Bonzini 91c79a
         goto end;
Paolo Bonzini 91c79a
     }
Paolo Bonzini 91c79a
+
Paolo Bonzini 91c79a
+    SSL_CTX_clear_options(c_ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
+    SSL_CTX_clear_options(s_ctx, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
+    SSL_CTX_clear_options(s_ctx2, SSL_OP_NO_SSLv3);
Paolo Bonzini 91c79a
+
Paolo Bonzini 91c79a
     /*
Paolo Bonzini 91c79a
      * Since we will use low security ciphersuites and keys for testing set
Paolo Bonzini 91c79a
      * security level to zero by default. Tests can override this by adding
Paolo Bonzini 7ae6f1
-- 
Paolo Bonzini 7ae6f1
2.17.0
Paolo Bonzini 7ae6f1