summaryrefslogtreecommitdiff
path: root/accel-pppd/ctrl
diff options
context:
space:
mode:
authorDenys Fedoryshchenko <denys.f@collabora.com>2025-12-12 14:51:30 +0200
committerGitHub <noreply@github.com>2025-12-12 14:51:30 +0200
commit5e7dfbe6e1c6c2a12c093303a65b8260e5165aaf (patch)
treedd63b0fdcb0b81c025a1cf58015e2e568d548314 /accel-pppd/ctrl
parent849b24855ae60fbb20887cfb7e650ea480c36f1f (diff)
parentb8c57bf4bd8276716a581ede91919db691f621c0 (diff)
downloadaccel-ppp-5e7dfbe6e1c6c2a12c093303a65b8260e5165aaf.tar.gz
accel-ppp-5e7dfbe6e1c6c2a12c093303a65b8260e5165aaf.zip
Merge pull request #275 from nuclearcat/backport-nr-pr-17
Backporting PR#17 from accel-ppp-ng
Diffstat (limited to 'accel-pppd/ctrl')
-rw-r--r--accel-pppd/ctrl/l2tp/l2tp.c3
-rw-r--r--accel-pppd/ctrl/l2tp/packet.c3
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.c2
-rw-r--r--accel-pppd/ctrl/pppoe/pppoe.h4
-rw-r--r--accel-pppd/ctrl/sstp/sstp.c27
5 files changed, 8 insertions, 31 deletions
diff --git a/accel-pppd/ctrl/l2tp/l2tp.c b/accel-pppd/ctrl/l2tp/l2tp.c
index ecf66f91..d6807377 100644
--- a/accel-pppd/ctrl/l2tp/l2tp.c
+++ b/accel-pppd/ctrl/l2tp/l2tp.c
@@ -16,6 +16,8 @@
#include <linux/if_ether.h>
#include <linux/if_pppox.h>
+#include <openssl/md5.h>
+
#include "triton.h"
#include "mempool.h"
#include "log.h"
@@ -24,7 +26,6 @@
#include "utils.h"
#include "iprange.h"
#include "cli.h"
-#include "crypto.h"
#include "connlimit.h"
diff --git a/accel-pppd/ctrl/l2tp/packet.c b/accel-pppd/ctrl/l2tp/packet.c
index e2756a7e..1e1488b5 100644
--- a/accel-pppd/ctrl/l2tp/packet.c
+++ b/accel-pppd/ctrl/l2tp/packet.c
@@ -8,7 +8,8 @@
#include <fcntl.h>
#include <arpa/inet.h>
-#include "crypto.h"
+#include <openssl/md5.h>
+
#include "triton.h"
#include "log.h"
#include "mempool.h"
diff --git a/accel-pppd/ctrl/pppoe/pppoe.c b/accel-pppd/ctrl/pppoe/pppoe.c
index 93412b95..dd70ad00 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.c
+++ b/accel-pppd/ctrl/pppoe/pppoe.c
@@ -15,8 +15,6 @@
#include <printf.h>
#endif
-#include "crypto.h"
-
#include "events.h"
#include "triton.h"
#include "log.h"
diff --git a/accel-pppd/ctrl/pppoe/pppoe.h b/accel-pppd/ctrl/pppoe/pppoe.h
index 7ba4ac63..2510c320 100644
--- a/accel-pppd/ctrl/pppoe/pppoe.h
+++ b/accel-pppd/ctrl/pppoe/pppoe.h
@@ -6,8 +6,10 @@
#include <linux/if.h>
#include <linux/if_pppox.h>
+#include <openssl/md5.h>
+#include <openssl/des.h>
+
#include "rbtree.h"
-#include "crypto.h"
/* PPPoE codes */
#define CODE_PADI 0x09
diff --git a/accel-pppd/ctrl/sstp/sstp.c b/accel-pppd/ctrl/sstp/sstp.c
index 3c831f64..4dab0c8e 100644
--- a/accel-pppd/ctrl/sstp/sstp.c
+++ b/accel-pppd/ctrl/sstp/sstp.c
@@ -19,7 +19,6 @@
#include <sys/stat.h>
#include "linux_ppp.h"
-#ifdef CRYPTO_OPENSSL
/*
* Suppress OpenSSL 3.0 deprecation warnings for DH API.
* See crypto.h for detailed explanation.
@@ -27,7 +26,6 @@
#define OPENSSL_API_COMPAT 0x10100000L
#include <openssl/ssl.h>
#include <openssl/err.h>
-#endif
#include "triton.h"
#include "events.h"
@@ -107,9 +105,7 @@ struct buffer_t {
struct sstp_stream_t {
union {
int fd;
-#ifdef CRYPTO_OPENSSL
SSL *ssl;
-#endif
};
ssize_t (*read)(struct sstp_stream_t *stream, void *buf, size_t count);
ssize_t (*recv)(struct sstp_stream_t *stream, void *buf, size_t count, int flags);
@@ -158,9 +154,7 @@ static struct sstp_serv_t {
struct sockaddr_t addr;
-#ifdef CRYPTO_OPENSSL
SSL_CTX *ssl_ctx;
-#endif
} serv;
static int conf_timeout = SSTP_NEGOTIOATION_TIMEOUT;
@@ -501,7 +495,6 @@ static struct sstp_stream_t *stream_init(int fd)
/* ssl stream */
-#ifdef CRYPTO_OPENSSL
static ssize_t ssl_stream_read(struct sstp_stream_t *stream, void *buf, size_t count)
{
int ret, err;
@@ -597,7 +590,6 @@ error:
ssl_stream_free(stream);
return NULL;
}
-#endif
/* proxy */
@@ -1543,12 +1535,10 @@ static int sstp_recv_msg_call_connected(struct sstp_conn_t *conn, struct sstp_ct
uint8_t hash;
unsigned int len;
struct npioctl np;
-#ifdef CRYPTO_OPENSSL
typeof(*msg) buf;
uint8_t md[EVP_MAX_MD_SIZE], *ptr;
const EVP_MD *evp;
unsigned int mdlen;
-#endif
if (conf_verbose)
log_ppp_info2("recv [SSTP SSTP_MSG_CALL_CONNECTED]\n");
@@ -1586,9 +1576,7 @@ static int sstp_recv_msg_call_connected(struct sstp_conn_t *conn, struct sstp_ct
log_ppp_error("sstp: invalid SHA256 Cert Hash\n");
return sstp_abort(conn, 0);
}
-#ifdef CRYPTO_OPENSSL
evp = EVP_sha256();
-#endif
} else if (hash & CERT_HASH_PROTOCOL_SHA1) {
len = SHA_DIGEST_LENGTH;
if (conf_hash_sha1.len == len &&
@@ -1596,9 +1584,7 @@ static int sstp_recv_msg_call_connected(struct sstp_conn_t *conn, struct sstp_ct
log_ppp_error("sstp: invalid SHA1 Cert Hash\n");
return sstp_abort(conn, 0);
}
-#ifdef CRYPTO_OPENSSL
evp = EVP_sha1();
-#endif
} else {
log_ppp_error("sstp: invalid Hash Protocol 0x%02x\n",
msg->attr.hash_protocol_bitmask);
@@ -1623,7 +1609,6 @@ static int sstp_recv_msg_call_connected(struct sstp_conn_t *conn, struct sstp_ct
return 0;
}
-#ifdef CRYPTO_OPENSSL
ptr = mempcpy(md, SSTP_CMK_SEED, SSTP_CMK_SEED_SIZE);
*ptr++ = len;
*ptr++ = 0;
@@ -1639,7 +1624,6 @@ static int sstp_recv_msg_call_connected(struct sstp_conn_t *conn, struct sstp_ct
log_ppp_error("sstp: invalid Compound MAC\n");
return sstp_abort(conn, 0);
}
-#endif
}
if (conn->timeout_timer.tpd)
@@ -2271,11 +2255,9 @@ static void sstp_start(struct sstp_conn_t *conn)
{
log_debug("sstp: starting\n");
-#ifdef CRYPTO_OPENSSL
if (serv.ssl_ctx)
conn->stream = ssl_stream_init(conn->hnd.fd, serv.ssl_ctx);
else
-#endif
conn->stream = stream_init(conn->hnd.fd);
if (!conn->stream) {
log_error("sstp: stream open error: %s\n", strerror(errno));
@@ -2455,17 +2437,14 @@ static void sstp_serv_close(struct triton_context_t *ctx)
triton_md_unregister_handler(&serv->hnd, 1);
triton_context_unregister(ctx);
-#ifdef CRYPTO_OPENSSL
if (serv->ssl_ctx)
SSL_CTX_free(serv->ssl_ctx);
serv->ssl_ctx = NULL;
-#endif
if (serv->addr.u.sa.sa_family == AF_UNIX && serv->addr.u.sun.sun_path[0])
unlink(serv->addr.u.sun.sun_path);
}
-#ifdef CRYPTO_OPENSSL
#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
static int ssl_servername(SSL *ssl, int *al, void *arg)
{
@@ -2754,7 +2733,6 @@ error:
if (in && !BIO_free(in))
abort();
}
-#endif
static void ev_mppe_keys(struct ev_mppe_keys_t *ev)
{
@@ -2839,12 +2817,9 @@ static void load_config(void)
opt = conf_get_opt("sstp", "accept");
conf_proxyproto = opt && strhas(opt, "proxy", ',');
-#ifdef CRYPTO_OPENSSL
ssl_load_config(&serv, conf_hostname);
opt = serv.ssl_ctx ? "enabled" : "disabled";
-#else
- opt = "not available";
-#endif
+
if (conf_verbose) {
log_info2("sstp: SSL/TLS support %s, PROXY support %s\n",
opt, conf_proxyproto ? "enabled" : "disabled");