ef59e1
ITS#7595 don't try to use EC if OpenSSL lacks it
ef59e1
ef59e1
Cherry-picked upstream 721e46fe6695077d63a3df6ea2e397920a72308d
ef59e1
Author: Howard Chu <hyc@openldap.org>
ef59e1
Date: Sun Sep 8 06:32:23 2013 -0700
ef59e1
ef59e1
diff --git a/libraries/libldap/tls_o.c b/libraries/libldap/tls_o.c
ef59e1
index 1a81bc625..71c2b055c 100644
ef59e1
--- a/libraries/libldap/tls_o.c
ef59e1
+++ b/libraries/libldap/tls_o.c
ef59e1
@@ -321,8 +321,12 @@ tlso_ctx_init( struct ldapoptions *lo, struct ldaptls *lt, int is_server )
ef59e1
 		DH_free( dh );
ef59e1
 	}
ef59e1
 
ef59e1
-#ifdef SSL_OP_SINGLE_ECDH_USE
ef59e1
 	if ( is_server && lo->ldo_tls_ecname ) {
ef59e1
+#ifdef OPENSSL_NO_EC
ef59e1
+		Debug( LDAP_DEBUG_ANY,
ef59e1
+			"TLS: Elliptic Curves not supported.\n", 0,0,0 );
ef59e1
+		return -1;
ef59e1
+#else
ef59e1
 		EC_KEY *ecdh;
ef59e1
 
ef59e1
 		int nid = OBJ_sn2nid( lt->lt_ecname );
ef59e1
@@ -344,8 +348,8 @@ tlso_ctx_init( struct ldapoptions *lo, struct ldaptls *lt, int is_server )
ef59e1
 		SSL_CTX_set_tmp_ecdh( ctx, ecdh );
ef59e1
 		SSL_CTX_set_options( ctx, SSL_OP_SINGLE_ECDH_USE );
ef59e1
 		EC_KEY_free( ecdh );
ef59e1
-	}
ef59e1
 #endif
ef59e1
+	}
ef59e1
 
ef59e1
 	if ( tlso_opt_trace ) {
ef59e1
 		SSL_CTX_set_info_callback( ctx, tlso_info_cb );