components/libneon/patches/004-ne_openssl.c.patch
author Vladimir Marek <Vladimir.Marek@oracle.com>
Mon, 10 Apr 2017 11:54:32 -0700
branchs11u3-sru
changeset 7853 87236a3c36b4
parent 4290 6be89e713896
permissions -rw-r--r--
25694511 xattr can't be built on recent CBE
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4290
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
     1
# Disable SSLv2 and SSLv3.
4172
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     2
# Internal patch. Not a chance it will be accepted upstream.
4290
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
     3
--- src/ne_openssl.c	2015-05-13 12:22:57.460825869 -0700
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
     4
+++ src/ne_openssl.c	2015-05-13 12:31:36.644453270 -0700
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
     5
@@ -565,7 +565,7 @@
4172
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     6
         /* set client cert callback. */
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
     7
         SSL_CTX_set_client_cert_cb(ctx->ctx, provide_client_cert);
4290
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
     8
         /* enable workarounds for buggy SSL server implementations */
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
     9
-        SSL_CTX_set_options(ctx->ctx, SSL_OP_ALL);
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    10
+        SSL_CTX_set_options(ctx->ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3);
4172
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    11
         SSL_CTX_set_verify(ctx->ctx, SSL_VERIFY_PEER, verify_callback);
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    12
     } else if (mode == NE_SSL_CTX_SERVER) {
4290
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    13
         ctx->ctx = SSL_CTX_new(SSLv23_server_method());
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    14
@@ -573,7 +573,8 @@
4172
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    15
 #ifdef SSL_OP_NO_TICKET
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    16
         /* disable ticket support since it inhibits testing of session
4290
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    17
          * caching. */
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    18
-        SSL_CTX_set_options(ctx->ctx, SSL_OP_NO_TICKET);
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    19
+        SSL_CTX_set_options(ctx->ctx,
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    20
+                            SSL_OP_NO_TICKET|SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3);
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    21
 #endif
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    22
     } else {
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    23
 #ifdef OPENSSL_NO_SSL2
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    24
@@ -581,6 +582,7 @@
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    25
         return NULL;
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    26
 #else
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    27
         ctx->ctx = SSL_CTX_new(SSLv2_server_method());
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    28
+        SSL_CTX_set_options(ctx->ctx, SSL_OP_NO_SSLv2|SSL_OP_NO_SSLv3);
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    29
         SSL_CTX_set_session_cache_mode(ctx->ctx, SSL_SESS_CACHE_CLIENT);
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    30
 #endif
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    31
     }
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    32
@@ -590,18 +592,8 @@
4172
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    33
 void ne_ssl_context_set_flag(ne_ssl_context *ctx, int flag, int value)
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    34
 {
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    35
     long opts = SSL_CTX_get_options(ctx->ctx);
4290
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    36
-
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    37
-    switch (flag) {
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    38
-    case NE_SSL_CTX_SSLv2:
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    39
-        if (value) { 
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    40
-            /* Enable SSLv2 support; clear the "no SSLv2" flag. */
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    41
-            opts &= ~SSL_OP_NO_SSLv2;
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    42
-        } else {
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    43
-            /* Disable it: set the flag. */
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    44
             opts |= SSL_OP_NO_SSLv2;
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    45
-        }
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    46
-        break;
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    47
-    }
4172
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    48
+    opts |= SSL_OP_NO_SSLv3;
a6d468ddeb77 20722564 upgrade libneon to 0.30.1
Stefan Teleman <stefan.teleman@oracle.com>
parents:
diff changeset
    49
 
4290
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    50
     SSL_CTX_set_options(ctx->ctx, opts);
6be89e713896 21085454 libneon should allow TLSv1.0 TLSv1.1 and TLSv1.2
Stefan Teleman <stefan.teleman@oracle.com>
parents: 4172
diff changeset
    51
 }