diff options
| author | Denys Fedoryshchenko <denys.f@collabora.com> | 2025-12-12 14:51:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-12 14:51:30 +0200 |
| commit | 5e7dfbe6e1c6c2a12c093303a65b8260e5165aaf (patch) | |
| tree | dd63b0fdcb0b81c025a1cf58015e2e568d548314 /accel-pppd | |
| parent | 849b24855ae60fbb20887cfb7e650ea480c36f1f (diff) | |
| parent | b8c57bf4bd8276716a581ede91919db691f621c0 (diff) | |
| download | accel-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')
| -rw-r--r-- | accel-pppd/auth/auth_chap_md5.c | 2 | ||||
| -rw-r--r-- | accel-pppd/auth/auth_mschap_v1.c | 4 | ||||
| -rw-r--r-- | accel-pppd/auth/auth_mschap_v2.c | 4 | ||||
| -rw-r--r-- | accel-pppd/ctrl/l2tp/l2tp.c | 3 | ||||
| -rw-r--r-- | accel-pppd/ctrl/l2tp/packet.c | 3 | ||||
| -rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.c | 2 | ||||
| -rw-r--r-- | accel-pppd/ctrl/pppoe/pppoe.h | 4 | ||||
| -rw-r--r-- | accel-pppd/ctrl/sstp/sstp.c | 27 | ||||
| -rw-r--r-- | accel-pppd/extra/chap-secrets.c | 29 | ||||
| -rw-r--r-- | accel-pppd/main.c | 6 | ||||
| -rw-r--r-- | accel-pppd/ppp/ppp.c | 2 | ||||
| -rw-r--r-- | accel-pppd/radius/acct.c | 5 | ||||
| -rw-r--r-- | accel-pppd/radius/auth.c | 3 | ||||
| -rw-r--r-- | accel-pppd/radius/dm_coa.c | 2 | ||||
| -rw-r--r-- | accel-pppd/radius/serv.c | 4 |
15 files changed, 27 insertions, 73 deletions
diff --git a/accel-pppd/auth/auth_chap_md5.c b/accel-pppd/auth/auth_chap_md5.c index e0820dba..9cfecb7f 100644 --- a/accel-pppd/auth/auth_chap_md5.c +++ b/accel-pppd/auth/auth_chap_md5.c @@ -7,7 +7,7 @@ #include <stdio.h> #include <arpa/inet.h> -#include "crypto.h" +#include <openssl/md5.h> #include "log.h" #include "events.h" diff --git a/accel-pppd/auth/auth_mschap_v1.c b/accel-pppd/auth/auth_mschap_v1.c index bddaabf5..909bcc5c 100644 --- a/accel-pppd/auth/auth_mschap_v1.c +++ b/accel-pppd/auth/auth_mschap_v1.c @@ -8,7 +8,9 @@ #include <byteswap.h> #include <arpa/inet.h> -#include "crypto.h" +#include <openssl/md4.h> +#include <openssl/sha.h> +#include <openssl/des.h> #include "log.h" #include "ppp.h" diff --git a/accel-pppd/auth/auth_mschap_v2.c b/accel-pppd/auth/auth_mschap_v2.c index 3e944500..440a0995 100644 --- a/accel-pppd/auth/auth_mschap_v2.c +++ b/accel-pppd/auth/auth_mschap_v2.c @@ -8,7 +8,9 @@ #include <byteswap.h> #include <arpa/inet.h> -#include "crypto.h" +#include <openssl/md4.h> +#include <openssl/sha.h> +#include <openssl/des.h> #include "log.h" #include "ppp.h" 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"); diff --git a/accel-pppd/extra/chap-secrets.c b/accel-pppd/extra/chap-secrets.c index b486bb11..5fd0102c 100644 --- a/accel-pppd/extra/chap-secrets.c +++ b/accel-pppd/extra/chap-secrets.c @@ -6,9 +6,10 @@ #include <netinet/in.h> #include <arpa/inet.h> -#ifdef CRYPTO_OPENSSL -#include "crypto.h" -#endif +#include <openssl/md4.h> +#include <openssl/sha.h> +#include <openssl/des.h> +#include <openssl/evp.h> #include "pwdb.h" #include "ipdb.h" @@ -29,13 +30,11 @@ static int conf_netmask = 0; static void *pd_key; static struct ipdb_t ipdb; -#ifdef CRYPTO_OPENSSL struct hash_chain { struct list_head entry; const EVP_MD *md; }; -#endif struct cs_pd_t { @@ -46,9 +45,7 @@ struct cs_pd_t char *pool; }; -#ifdef CRYPTO_OPENSSL static LIST_HEAD(hash_chain); -#endif static char *skip_word(char *ptr) { @@ -126,19 +123,16 @@ static struct cs_pd_t *create_pd(struct ap_session *ses, const char *username) int n; struct cs_pd_t *pd; struct in_addr in; -#ifdef CRYPTO_OPENSSL char username_hash[EVP_MAX_MD_SIZE * 2 + 1]; uint8_t hash[EVP_MAX_MD_SIZE]; struct hash_chain *hc; EVP_MD_CTX *md_ctx = NULL; char c; int i; -#endif if (!conf_chap_secrets) return NULL; -#ifdef CRYPTO_OPENSSL if (conf_encrypted && !list_empty(&hash_chain)) { unsigned int size = 0; list_for_each_entry(hc, &hash_chain, entry) { @@ -156,7 +150,6 @@ static struct cs_pd_t *create_pd(struct ap_session *ses, const char *username) username = username_hash; } -#endif f = fopen(conf_chap_secrets, "r"); if (!f) { @@ -192,10 +185,8 @@ out: return NULL; found: -#ifdef CRYPTO_OPENSSL if (conf_encrypted && strlen(ptr[1]) != 32) goto out; -#endif pd = _malloc(sizeof(*pd)); if (!pd) { @@ -205,7 +196,6 @@ found: memset(pd, 0, sizeof(*pd)); pd->pd.key = &pd_key; -#ifdef CRYPTO_OPENSSL if (conf_encrypted) { pd->passwd = _malloc(16); if (!pd->passwd) { @@ -221,7 +211,6 @@ found: ptr[1][i*2 + 2] = c; } } else -#endif { pd->passwd = _strdup(ptr[1]); if (!pd->passwd) { @@ -335,10 +324,8 @@ static char* get_passwd(struct pwdb_t *pwdb, struct ap_session *ses, const char { struct cs_pd_t *pd = find_pd(ses); -#ifdef CRYPTO_OPENSSL if (conf_encrypted) return NULL; -#endif if (!pd) pd = create_pd(ses, username); @@ -349,7 +336,6 @@ static char* get_passwd(struct pwdb_t *pwdb, struct ap_session *ses, const char return _strdup(pd->passwd); } -#ifdef CRYPTO_OPENSSL static void des_encrypt(const uint8_t *input, const uint8_t *key, uint8_t *output) { int i, j, parity; @@ -684,7 +670,6 @@ static int check_passwd(struct pwdb_t *pwdb, struct ap_session *ses, pwdb_callba return r; } -#endif static struct ipdb_t ipdb = { .get_ipv4 = get_ip, @@ -692,12 +677,9 @@ static struct ipdb_t ipdb = { static struct pwdb_t pwdb = { .get_passwd = get_passwd, -#ifdef CRYPTO_OPENSSL .check = check_passwd, -#endif }; -#ifdef CRYPTO_OPENSSL static void clear_hash_chain(void) { struct hash_chain *hc; @@ -731,7 +713,6 @@ static void parse_hash_chain(const char *opt) ptr1 = ptr2 + 1; } } -#endif static void parse_gw_ip_address(const char *opt) { @@ -792,12 +773,10 @@ static void load_config(void) else conf_encrypted = 0; -#ifdef CRYPTO_OPENSSL clear_hash_chain(); opt = conf_get_opt("chap-secrets", "username-hash"); if (opt) parse_hash_chain(opt); -#endif } static void init(void) diff --git a/accel-pppd/main.c b/accel-pppd/main.c index bbc36d95..dcbbc0a4 100644 --- a/accel-pppd/main.c +++ b/accel-pppd/main.c @@ -16,9 +16,7 @@ #include <sys/wait.h> #include <sys/resource.h> -#ifdef CRYPTO_OPENSSL #include <openssl/ssl.h> -#endif #include "triton/triton.h" @@ -43,7 +41,6 @@ static int term; static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; static pthread_cond_t cond = PTHREAD_COND_INITIALIZER; -#ifdef CRYPTO_OPENSSL #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER) static pthread_mutex_t *ssl_lock_cs; @@ -85,7 +82,6 @@ static void openssl_init(void) ssl_lock_init(); #endif } -#endif static void change_limits(void) { @@ -393,9 +389,7 @@ int main(int _argc, char **_argv) change_limits(); -#ifdef CRYPTO_OPENSSL openssl_init(); -#endif triton_register_init(0, log_version); diff --git a/accel-pppd/ppp/ppp.c b/accel-pppd/ppp/ppp.c index 8a4cce7c..2e91c2e4 100644 --- a/accel-pppd/ppp/ppp.c +++ b/accel-pppd/ppp/ppp.c @@ -12,8 +12,6 @@ #include <sys/ioctl.h> #include "linux_ppp.h" -#include "crypto.h" - #include "triton.h" #include "ap_session.h" diff --git a/accel-pppd/radius/acct.c b/accel-pppd/radius/acct.c index 1cbd9296..803c9454 100644 --- a/accel-pppd/radius/acct.c +++ b/accel-pppd/radius/acct.c @@ -5,9 +5,10 @@ #include <unistd.h> #include <sys/ioctl.h> #include <netinet/in.h> -#include "linux_ppp.h" -#include "crypto.h" +#include <openssl/md5.h> + +#include "linux_ppp.h" #include "log.h" #include "backup.h" diff --git a/accel-pppd/radius/auth.c b/accel-pppd/radius/auth.c index 05058547..69f1b2ef 100644 --- a/accel-pppd/radius/auth.c +++ b/accel-pppd/radius/auth.c @@ -1,7 +1,8 @@ #include <stdlib.h> #include <string.h> -#include "crypto.h" +#include <openssl/md5.h> +#include <openssl/sha.h> #include "triton.h" #include "mempool.h" diff --git a/accel-pppd/radius/dm_coa.c b/accel-pppd/radius/dm_coa.c index 8eb45a60..5f4220d1 100644 --- a/accel-pppd/radius/dm_coa.c +++ b/accel-pppd/radius/dm_coa.c @@ -10,7 +10,7 @@ #include <netinet/in.h> #include <sys/socket.h> -#include "crypto.h" +#include <openssl/md5.h> #include "triton.h" #include "events.h" diff --git a/accel-pppd/radius/serv.c b/accel-pppd/radius/serv.c index 4af6a67a..9954afd5 100644 --- a/accel-pppd/radius/serv.c +++ b/accel-pppd/radius/serv.c @@ -11,14 +11,14 @@ #include <netinet/in.h> #include <arpa/inet.h> +#include <openssl/md5.h> + #include "log.h" #include "triton.h" #include "events.h" #include "cli.h" #include "utils.h" -#include "crypto.h" - #include "radius_p.h" #include "memdebug.h" |
