Skip to content

Commit fa5e371

Browse files
authored
1 parent 9511af7 commit fa5e371

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

ext-src/php_swoole.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,9 @@ PHP_MINFO_FUNCTION(swoole) {
856856
#else
857857
php_info_print_table_row(2, "openssl", "enabled");
858858
#endif
859+
#ifdef SW_SUPPORT_DTLS
860+
php_info_print_table_row(2, "dtls", "enabled");
861+
#endif
859862
#endif
860863
#ifdef SW_USE_HTTP2
861864
php_info_print_table_row(2, "http2", "enabled");

ext-src/swoole_runtime.cc

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@
2424
#include <initializer_list>
2525

2626
/* openssl */
27-
#ifndef OPENSSL_NO_TLS1_METHOD
28-
#define HAVE_TLS1 1
29-
#endif
30-
#ifndef OPENSSL_NO_TLS1_1_METHOD
31-
#define HAVE_TLS11 1
32-
#endif
33-
#ifndef OPENSSL_NO_TLS1_2_METHOD
34-
#define HAVE_TLS12 1
35-
#endif
36-
#if OPENSSL_VERSION_NUMBER >= 0x10101000 && !defined(OPENSSL_NO_TLS1_3)
37-
#define HAVE_TLS13 1
38-
#endif
3927
#ifndef OPENSSL_NO_ECDH
4028
#define HAVE_ECDH 1
4129
#endif
@@ -911,25 +899,25 @@ static int socket_set_option(php_stream *stream, int option, int value, void *pt
911899

912900
array_init(&tmp);
913901
switch (SSL_version(ssl)) {
914-
#ifdef HAVE_TLS13
902+
#ifdef TLS1_3_VERSION
915903
case TLS1_3_VERSION:
916904
proto_str = "TLSv1.3";
917905
break;
918906
#endif
919-
#ifdef HAVE_TLS12
907+
#ifdef TLS1_2_VERSION
920908
case TLS1_2_VERSION:
921909
proto_str = "TLSv1.2";
922910
break;
923911
#endif
924-
#ifdef HAVE_TLS11
912+
#ifdef TLS1_1_VERSION
925913
case TLS1_1_VERSION:
926914
proto_str = "TLSv1.1";
927915
break;
928916
#endif
929917
case TLS1_VERSION:
930918
proto_str = "TLSv1";
931919
break;
932-
#ifdef HAVE_SSL3
920+
#ifdef SSL3_VERSION
933921
case SSL3_VERSION:
934922
proto_str = "SSLv3";
935923
break;

include/swoole_ssl.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
#define SW_SUPPORT_DTLS
3939
#endif
4040

41+
#if defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x3000000fL
42+
#undef SW_SUPPORT_DTLS
43+
#endif
44+
4145
enum swSSL_create_flag {
4246
SW_SSL_SERVER = 1,
4347
SW_SSL_CLIENT = 2,

src/protocol/ssl.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ bool SSLContext::set_ciphers() {
528528
}
529529

530530
#ifndef OPENSSL_NO_RSA
531-
SSL_CTX_set_tmp_rsa_callback(ssl_context, swSSL_rsa_key_callback);
531+
SSL_CTX_set_tmp_rsa_callback(context, swSSL_rsa_key_callback);
532532
#endif
533533

534534
if (!dhparam.empty() && !set_dhparam()) {
@@ -698,8 +698,6 @@ static int swSSL_verify_callback(int ok, X509_STORE_CTX *x509_store) {
698698
return 1;
699699
}
700700

701-
702-
703701
#ifdef SW_SUPPORT_DTLS
704702

705703
#define COOKIE_SECRET_LENGTH (32)

0 commit comments

Comments
 (0)