| 1 |
--- a/pjlib/src/pj/ssl_sock_ossl.c |
| 2 |
+++ b/pjlib/src/pj/ssl_sock_ossl.c |
| 3 |
@@ -1177,7 +1177,12 @@ static pj_status_t init_ossl_ctx(pj_ssl_sock_t *ssock) |
| 4 |
} |
| 5 |
|
| 6 |
if (!ssl_method) { |
| 7 |
- ssl_method = (SSL_METHOD*)TLS_method(); |
| 8 |
+#if (USING_LIBRESSL && LIBRESSL_VERSION_NUMBER < 0x2020100fL) \ |
| 9 |
+ || OPENSSL_VERSION_NUMBER < 0x10100000L |
| 10 |
+ ssl_method = (SSL_METHOD*)SSLv23_method(); |
| 11 |
+#else |
| 12 |
+ ssl_method = (SSL_METHOD*)TLS_method(); |
| 13 |
+#endif |
| 14 |
|
| 15 |
#ifdef SSL_OP_NO_SSLv2 |
| 16 |
/** Check if SSLv2 is enabled */ |
| 17 |
@@ -1921,7 +1926,10 @@ static pj_status_t set_cipher_list(pj_ssl_sock_t *ssock) |
| 18 |
enum { BUF_SIZE = 8192 }; |
| 19 |
pj_str_t cipher_list; |
| 20 |
unsigned i, j; |
| 21 |
- int ret, ret2 = 1; |
| 22 |
+ int ret; |
| 23 |
+#if !USING_BORINGSSL && OPENSSL_VERSION_NUMBER >= 0x1010100fL |
| 24 |
+ int ret2 = 1; |
| 25 |
+#endif |
| 26 |
|
| 27 |
if (ssock->param.ciphers_num == 0) { |
| 28 |
ret = SSL_CTX_set_cipher_list(ossock->ossl_ctx, PJ_SSL_SOCK_OSSL_CIPHERS); |
| 29 |
@@ -1976,10 +1984,12 @@ static pj_status_t set_cipher_list(pj_ssl_sock_t *ssock) |
| 30 |
* SSL_CTX_set_ciphersuites() is for TLSv1.3. |
| 31 |
*/ |
| 32 |
ret = SSL_CTX_set_cipher_list(ossock->ossl_ctx, buf); |
| 33 |
-#if !USING_BORINGSSL |
| 34 |
+#if !USING_BORINGSSL && OPENSSL_VERSION_NUMBER >= 0x1010100fL |
| 35 |
ret2 = SSL_CTX_set_ciphersuites(ossock->ossl_ctx, buf); |
| 36 |
-#endif |
| 37 |
if (ret < 1 && ret2 < 1) { |
| 38 |
+#else |
| 39 |
+ if (ret < 1) { |
| 40 |
+#endif |
| 41 |
PJ_LOG(4, (THIS_FILE, "Failed setting cipher list %s", |
| 42 |
cipher_list.ptr)); |
| 43 |
pj_pool_release(tmp_pool); |