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