mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
52 lines
1.3 KiB
Diff
52 lines
1.3 KiB
Diff
--- a/ssl.c
|
|
+++ b/ssl.c
|
|
@@ -28,6 +28,9 @@
|
|
#include <openssl/err.h>
|
|
#include <openssl/rand.h>
|
|
#include <openssl/bio.h>
|
|
+#ifndef OPENSSL_NO_EC
|
|
+#include <openssl/ec.h>
|
|
+#endif
|
|
#include <errno.h>
|
|
#include <limits.h>
|
|
|
|
@@ -66,8 +69,12 @@ ssl_init(struct vsf_session* p_sess)
|
|
SSL_CTX* p_ctx;
|
|
long options;
|
|
int verify_option = 0;
|
|
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
SSL_library_init();
|
|
p_ctx = SSL_CTX_new(SSLv23_server_method());
|
|
+#else
|
|
+ p_ctx = SSL_CTX_new(TLS_server_method());
|
|
+#endif
|
|
if (p_ctx == NULL)
|
|
{
|
|
die("SSL: could not allocate SSL context");
|
|
@@ -139,6 +146,7 @@ ssl_init(struct vsf_session* p_sess)
|
|
{
|
|
die("SSL: RNG is not seeded");
|
|
}
|
|
+#ifndef OPENSSL_NO_EC
|
|
{
|
|
EC_KEY* key = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
|
|
if (key == NULL)
|
|
@@ -148,6 +156,7 @@ ssl_init(struct vsf_session* p_sess)
|
|
SSL_CTX_set_tmp_ecdh(p_ctx, key);
|
|
EC_KEY_free(key);
|
|
}
|
|
+#endif
|
|
if (tunable_ssl_request_cert)
|
|
{
|
|
verify_option |= SSL_VERIFY_PEER;
|
|
@@ -685,7 +694,9 @@ ssl_cert_digest(SSL* p_ssl, struct vsf_session* p_sess, struct mystr* p_str)
|
|
static char*
|
|
get_ssl_error()
|
|
{
|
|
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
|
SSL_load_error_strings();
|
|
+#endif
|
|
return ERR_error_string(ERR_get_error(), NULL);
|
|
}
|
|
|