Browse Source

Only use SSL_OP_NO_COMPRESSION if it is defined

It looks like this SSL_set_options() value was added in 0.9.9 and it does
not exist in stable releases of OpenSSL. Fix build by using #ifdef on this
variable before use.
Jouni Malinen 17 years ago
parent
commit
fca25ef4b4
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/crypto/tls_openssl.c

+ 7 - 3
src/crypto/tls_openssl.c

@@ -877,6 +877,7 @@ struct tls_connection * tls_connection_init(void *ssl_ctx)
 {
 {
 	SSL_CTX *ssl = ssl_ctx;
 	SSL_CTX *ssl = ssl_ctx;
 	struct tls_connection *conn;
 	struct tls_connection *conn;
+	long options;
 
 
 	conn = os_zalloc(sizeof(*conn));
 	conn = os_zalloc(sizeof(*conn));
 	if (conn == NULL)
 	if (conn == NULL)
@@ -890,9 +891,12 @@ struct tls_connection * tls_connection_init(void *ssl_ctx)
 	}
 	}
 
 
 	SSL_set_app_data(conn->ssl, conn);
 	SSL_set_app_data(conn->ssl, conn);
-	SSL_set_options(conn->ssl,
-			SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 |
-			SSL_OP_SINGLE_DH_USE | SSL_OP_NO_COMPRESSION);
+	options = SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 |
+		SSL_OP_SINGLE_DH_USE;
+#ifdef SSL_OP_NO_COMPRESSION
+	options |= SSL_OP_NO_COMPRESSION;
+#endif /* SSL_OP_NO_COMPRESSION */
+	SSL_set_options(conn->ssl, options);
 
 
 	conn->ssl_in = BIO_new(BIO_s_mem());
 	conn->ssl_in = BIO_new(BIO_s_mem());
 	if (!conn->ssl_in) {
 	if (!conn->ssl_in) {