blob: 2755fb68cbbbb4c9bb79924597339923a5c70529 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001--- a/daemon/dtls.c
2+++ b/daemon/dtls.c
3@@ -5,6 +5,8 @@
4 #include <glib.h>
5 #include <openssl/ssl.h>
6 #include <openssl/x509.h>
7+#include <openssl/bn.h>
8+#include <openssl/rsa.h>
9 #include <sys/types.h>
10 #include <sys/socket.h>
11 #include <openssl/err.h>
12@@ -239,10 +241,10 @@ static int cert_init(void) {
13
14 /* cert lifetime */
15
16- if (!X509_gmtime_adj(X509_get_notBefore(x509), -60*60*24))
17+ if (!X509_gmtime_adj(X509_getm_notBefore(x509), -60*60*24))
18 goto err;
19
20- if (!X509_gmtime_adj(X509_get_notAfter(x509), CERT_EXPIRY_TIME))
21+ if (!X509_gmtime_adj(X509_getm_notAfter(x509), CERT_EXPIRY_TIME))
22 goto err;
23
24 /* sign it */
25--- a/lib/ssllib.c
26+++ b/lib/ssllib.c
27@@ -35,10 +35,6 @@ static void make_OpenSSL_thread_safe(voi
28 CRYPTO_THREADID_set_callback(cb_openssl_threadid);
29 CRYPTO_set_locking_callback(cb_openssl_lock);
30 }
31-#else
32-static void make_OpenSSL_thread_safe(void) {
33- ;
34-}
35 #endif
36
37
38@@ -46,7 +42,9 @@ void rtpe_ssl_init(void) {
39 struct timespec ts;
40 clock_gettime(CLOCK_REALTIME, &ts);
41 srandom(ts.tv_sec ^ ts.tv_nsec);
42+#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
43 SSL_library_init();
44 SSL_load_error_strings();
45 make_OpenSSL_thread_safe();
46+#endif
47 }