This is essentially the same as Peter's patch, but with the checks
preemptively extended to the other handshake methods so we don't go
through this again when someone decides to kill TLSv1.0

Checking for SSLv23_*_method is probably excessive, but the configure
script and xio-openssl.c were already doing it so I went for it.
-- 
Jon
Doge Wrangler
X(7): A program for managing terminal windows. See also screen(1) and tmux(1).
diff -Nru socat-1.7.3.0.orig/sslcls.c socat-1.7.3.0/sslcls.c
--- socat-1.7.3.0.orig/sslcls.c	2015-01-24 05:15:22.000000000 -0500
+++ socat-1.7.3.0/sslcls.c	2015-11-29 14:14:13.252000000 -0500
@@ -55,6 +55,7 @@
 }
 #endif
 
+#if HAVE_SSLv3_client_method
 const SSL_METHOD *sycSSLv3_client_method(void) {
    const SSL_METHOD *result;
    Debug("SSLv3_client_method()");
@@ -62,7 +63,9 @@
    Debug1("SSLv3_client_method() -> %p", result);
    return result;
 }
+#endif
 
+#if HAVE_SSLv3_server_method
 const SSL_METHOD *sycSSLv3_server_method(void) {
    const SSL_METHOD *result;
    Debug("SSLv3_server_method()");
@@ -70,7 +73,9 @@
    Debug1("SSLv3_server_method() -> %p", result);
    return result;
 }
+#endif
 
+#if HAVE_SSLv23_client_method
 const SSL_METHOD *sycSSLv23_client_method(void) {
    const SSL_METHOD *result;
    Debug("SSLv23_client_method()");
@@ -78,7 +83,9 @@
    Debug1("SSLv23_client_method() -> %p", result);
    return result;
 }
+#endif
 
+#if HAVE_SSLv23_server_method
 const SSL_METHOD *sycSSLv23_server_method(void) {
    const SSL_METHOD *result;
    Debug("SSLv23_server_method()");
@@ -86,7 +93,9 @@
    Debug1("SSLv23_server_method() -> %p", result);
    return result;
 }
+#endif
 
+#if HAVE_TLSv1_client_method
 const SSL_METHOD *sycTLSv1_client_method(void) {
    const SSL_METHOD *result;
    Debug("TLSv1_client_method()");
@@ -94,7 +103,9 @@
    Debug1("TLSv1_client_method() -> %p", result);
    return result;
 }
+#endif
 
+#if HAVE_TLSv1_server_method
 const SSL_METHOD *sycTLSv1_server_method(void) {
    const SSL_METHOD *result;
    Debug("TLSv1_server_method()");
@@ -102,6 +113,7 @@
    Debug1("TLSv1_server_method() -> %p", result);
    return result;
 }
+#endif
 
 #if HAVE_TLSv1_1_client_method
 const SSL_METHOD *sycTLSv1_1_client_method(void) {
@@ -143,6 +155,7 @@
 }
 #endif
 
+#if HAVE_DTLSv1_client_method
 const SSL_METHOD *sycDTLSv1_client_method(void) {
    const SSL_METHOD *result;
    Debug("DTLSv1_client_method()");
@@ -150,7 +163,9 @@
    Debug1("DTLSv1_client_method() -> %p", result);
    return result;
 }
+#endif
 
+#if HAVE_DTLSv1_server_method
 const SSL_METHOD *sycDTLSv1_server_method(void) {
    const SSL_METHOD *result;
    Debug("DTLSv1_server_method()");
@@ -158,6 +173,7 @@
    Debug1("DTLSv1_server_method() -> %p", result);
    return result;
 }
+#endif
 
 SSL_CTX *sycSSL_CTX_new(const SSL_METHOD *method) {
    SSL_CTX *result;

Reply via email to