1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-10-06 10:30:40 +03:00
Commit Graph

418 Commits

Author SHA1 Message Date
Davide Beatrici
562ffe8945 Mayaqua/Pack: Fix PackGetStrSize() and PackGetStrSizeEx()'s return data type
The bug caused ProtoOptionsGet and ProtoOptionsSet not to work anymore after c90617e0e86dedf78e0e3c8a71263a80eec29caa.

The functions were introduced in aa65327e73, but the issue went unnoticed because bool was the same as UINT.
2021-03-01 03:01:34 +01:00
Davide Beatrici
914bfe7d44 Use bool from stdbool.h, get rid of BOOL
BOOL was just an alias for bool, this commit replaces all instances of it for consistency.

For some reason bool was defined as a 4-byte integer instead of a 1-byte one, presumably to match WinAPI's definition: https://docs.microsoft.com/en-us/windows/win32/winprog/windows-data-types
Nothing should break now that bool is 1-byte, as no protocol code appears to be relying on the size of the data type.
PACK, for example, explicitly stores boolean values as 4-byte integers.

This commit can be seen as a follow-up to 61ccaed4f6.
2021-03-01 03:01:34 +01:00
Davide Beatrici
8a37f5ce11 Mayaqua/Network.c: Fix several warnings related to Windows data type mismatches
Also, reported unused variables are removed.
2021-03-01 02:48:38 +01:00
Davide Beatrici
e7bf97583d Mayaqua/Microsoft: Fix several warnings related to Windows data type mismatches
Also, reported unused variables are removed.
2021-03-01 02:30:45 +01:00
Davide Beatrici
dbd4dd5ae7 Link to Windows libraries in CMake project, remove related #pragma directives
In addition to making the code cleaner, this also prevents potential issues due to #pragma directives being in headers.
2021-02-28 20:35:25 +01:00
Davide Beatrici
cf2585c079 Hamcore: Remove unused functions 2021-02-26 07:06:29 +01:00
Davide Beatrici
1301dc93c6 New hamcorebuilder implementation, independent from Cedar and Mayaqua
This new implementation can be easily compiled and executed without the need for other components to be present.

It relies on standard C functions, aside from stat() which is part of POSIX but available on Windows as well.

There's only one third-party dependency, which is tinydir: a single-file header-only library for traversing directories.
2021-02-26 07:06:26 +01:00
Davide Beatrici
ea2c8f9861
Merge PR #1273: fix null pointer dereference found by ErrorSanitizer 2021-02-21 14:10:08 +01:00
Ilya Shipitsin
e5e86abc0e fix null pointer dereference found by ErrorSanitizer
(gdb) bt
0  0x00007f43857a5e14 in __GI___pthread_mutex_init (mutex=0x0, mutexattr=0x0) at pthread_mutex_init.c:89
1  0x00007f4385eaaf1b in UnixNewLock () at SoftEtherVPN/src/Mayaqua/Unix.c:1845
2  0x00007f4385e92331 in NewLockMain () at SoftEtherVPN/src/Mayaqua/Object.c:89
3  0x00007f4385e92359 in NewLock () at SoftEtherVPN/src/Mayaqua/Object.c:101
4  0x00007f4385e92765 in NewCounter () at SoftEtherVPN/src/Mayaqua/Object.c:171
5  0x00007f4385e92e76 in NewRef () at SoftEtherVPN/src/Mayaqua/Object.c:339
6  0x00007f4385e76939 in NewSkEx (no_compact=0) at SoftEtherVPN/src/Mayaqua/Memory.c:863
7  0x00007f4385e68c95 in NormalizePathW (
    dst=0x7ffe65932940 L"\xd6ff2ffb\xfbf14ce5\xad8669ca\x41998a9c\x5107d62d\x8d2ab3f2\x37ceaad2\xffc947ec\xad8ed8d8\x33e9f2f7\xc05723a9\x843263e3\x5516beb3\x12571e2a\xd81405f3\xf92194fe\xd807aa98\x12835b01\x243185be\x550c7dc3\xfd74170d\x12835b01\x553185be\x550c7dc3\x72be5d74\x80deb1fe\x9bdc06a7\xc19bf1f4\x72be5d74\x80deb1fe\x9bdc06a7\xc19bf174\x894d4018\xc54302b8\x145dc92\x143b3917\x62aa4fb8\x915764b1\xd5e11bef\x9d5fbc5\xb956c25b\x59f111f1\x923f82a4\xab1c5ed5\x3956c25b\x59f111f1\x923f82a4\xab1c5ed5\xbaeb40", size=2048, src=<optimized out>)
    at SoftEtherVPN/src/Mayaqua/FileIO.c:1960
8  0x00007f4385e69188 in ConbinePathW (
    dst=0x7ffe65932940 L"\xd6ff2ffb\xfbf14ce5\xad8669ca\x41998a9c\x5107d62d\x8d2ab3f2\x37ceaad2\xffc947ec\xad8ed8d8\x33e9f2f7\xc05723a9\x843263e3\x5516beb3\x12571e2a\xd81405f3\xf92194fe\xd807aa98\x12835b01\x243185be\x550c7dc3\xfd74170d\x12835b01\x553185be\x550c7dc3\x72be5d74\x80deb1fe\x9bdc06a7\xc19bf1f4\x72be5d74\x80deb1fe\x9bdc06a7\xc19bf174\x894d4018\xc54302b8\x145dc92\x143b3917\x62aa4fb8\x915764b1\xd5e11bef\x9d5fbc5\xb956c25b\x59f111f1\x923f82a4\xab1c5ed5\x3956c25b\x59f111f1\x923f82a4\xab1c5ed5\xbaeb40", size=2048,
    dirname=0xbace10 L"/root/.local/bin", filename=0x7ffe65932100 L"SoftEtherVPN/build/vpntest") at SoftEtherVPN/src/Mayaqua/FileIO.c:1686
9  0x00007f4385e6af48 in UnixGetExeNameW (name=0x7f4385ede820 <exe_file_name_w> L"/tmp/a.out", size=2048, arg=0xbb5050 L"./vpntest") at SoftEtherVPN/src/Mayaqua/FileIO.c:1401
10 0x00007f4385e6b04b in InitGetExeName (arg=<optimized out>) at SoftEtherVPN/src/Mayaqua/FileIO.c:1367
11 0x00007f4385e7470a in InitMayaqua (memcheck=memcheck@entry=0, debug=debug@entry=1, argc=argc@entry=3, argv=argv@entry=0x7ffe659340e8)
    at SoftEtherVPN/src/Mayaqua/Mayaqua.c:456
12 0x0000000000401282 in main (argc=3, argv=0x7ffe659340e8) at SoftEtherVPN/src/vpntest/vpntest.c:259
2021-02-21 16:13:36 +05:00
Ilya Shipitsin
586c27d43b
Merge pull request #1269 from chipitsine/openssl_version_agnostic
use SSL_SECOP_VERSION macro instead of OPENSSL_VERSION
2021-02-20 20:56:26 +05:00
Ilya Shipitsin
ebd1d281dd use SSL_SECOP_VERSION macro instead of OPENSSL_VERSION
OPENSSL_VERSION is fragile in LibreSSL, BoringSSL.
security level manipulation is openssl specific defined in
b362ccab5c
2021-02-20 17:48:26 +05:00
Davide Beatrici
d53f80bfa6 Remove BuildUtil and all MSBuild projects, except the ones not in CMake yet
Since 35200a29ea we build complete installers using CMake, meaning that there's no need for BuildUtil anymore.

MSBuild projects that are not migrated to CMake yet are kept for reference.

This commit also updates BUILD_WINDOWS.md so that it mentions Visual Studio 2019 instead of 2017.
2021-02-19 21:17:01 +01:00
Daiyuu Nobori
a207260e38 Found the bad remove for lock files. 2020-11-30 18:15:37 +09:00
Takuho NAKANO
c029b34b80 Run SSL_CTX_set_ssl_version earlier
SSL_CTX_set_ssl_version may change security level.
2020-10-31 20:19:32 +01:00
Takuho NAKANO
7fdacec2a6 Manage OpenSSL security level
Add SslAcceptSettings option Override_Security_Level and Override_Security_Level_Value
to allow user to choose.
2020-10-31 20:19:23 +01:00
Takuho NAKANO
190672bd84 Set RSA bits considering OpenSSL security Level 2020-10-31 20:11:11 +01:00
Takuho NAKANO
5ca62bdd8a Refact: manage SSL_OP_NO_SSLv3 in NewSSLCtx 2020-10-31 20:11:11 +01:00
Takuho NAKANO
d0b3cde485 Refact: move SSL_CTX_set_ssl_version to NewSSLCtx 2020-10-31 20:11:11 +01:00
Ilya Shipitsin
a2d15615f3
Merge pull request #1115 from takotakot/import_v4_change
Add Tls_Disable1_3 (Import v4 change)
2020-10-31 20:04:20 +03:00
mcallist
2e0c24f6c8 Add english translation to each language for openssl engine auth 2020-10-09 10:22:23 +02:00
mcallist
d1ad4196bb Change from unix only implementation to all os and skip ENGINE_load_dynamic if oss is 1.1.0 or later 2020-10-09 09:58:34 +02:00
mcallist
20b84f3928 Change openssl version checking to api compat 2020-10-09 04:58:25 +02:00
mcallist
dec532a8eb Increase required openssl version for openssl engines implementation 2020-10-09 03:32:53 +02:00
mcallist
ff3910eb86 Openssl engine certificate authentication
TODO cert get, call finish engine, call init engine in another step, handle authentication, internatiolazion (help is needed)
2020-10-09 02:56:51 +02:00
Davide Beatrici
61ccaed4f6 Mayaqua/MayaType.h: define our types to the ones from <stdint.h> on non-Windows 2020-08-15 09:18:27 +02:00
Davide Beatrici
09f24e46b3 Remove "WORD", use "USHORT" everywhere for consistency 2020-08-15 09:18:27 +02:00
Davide Beatrici
69cd39616b Remove "UINT32" and "DWORD", use "UINT" everywhere for consistency 2020-08-15 09:18:27 +02:00
Davide Beatrici
e18bb465c9 Remove "CHAR", use lowercase everywhere for consistency
As a bonus we fix 3 cast warnings.
2020-08-15 09:18:27 +02:00
Davide Beatrici
337a04b758 Remove "BOOL", "TRUE" and "FALSE", use lowercase everywhere for consistency 2020-08-15 09:18:27 +02:00
Davide Beatrici
1c56562cc7 Remove "UINT_PTR" and "LONG_PTR", use original type everywhere 2020-08-15 09:18:21 +02:00
Davide Beatrici
b4cd4ce360 Mayaqua/MayaType.h: remove unused integer types 2020-08-15 09:09:46 +02:00
Davide Beatrici
e8793a0098
Merge PR #1187: Find OpenSSL and zlib on Windows like we do on UNIX, use vcpkg on Azure Pipelines, remove Windows build on AppVeyor 2020-07-28 20:13:39 +02:00
Davide Beatrici
aa65327e73 Mayaqua/Pack: add PackGetStrSize(), for strings with non-constant length 2020-07-28 00:57:36 +02:00
Davide Beatrici
60410accce Remove Windows libraries and zlib submodule from the repository 2020-07-27 21:35:54 +02:00
Davide Beatrici
352ed759b2 CMake: find OpenSSL and zlib on Windows like we do on UNIX
This allows the project to be built with the support of vcpkg.
2020-07-27 21:32:50 +02:00
Davide Beatrici
78dad1d568 Mayaqua/Microsoft.h: rename "driver_installer.exe" to "vpndrvinst.exe"
vpndrvinst is the name of the target and thus the default output name, let's use it.

`vpndrvinst.exe" also sounds less fishy than "driver_installer.exe"...
2020-07-27 20:59:40 +02:00
Davide Beatrici
6a472d827a Mayaqua: remove all references to binaries with "_x64" and "_ia64" suffix
See the previous commit's message for details.
2020-07-27 20:59:40 +02:00
Davide Beatrici
755e09e5c1 Don't include OpenSSL headers in vpndrvinst.c
The inclusion of the headers is probably a very old leftover, from when OpenSSL was not encapsulated into Mayaqua yet.

In fact, there was a "HAM_C" (defined in vpndrvinst.c) definition check in Mayaqua/Encrypt.h preventing the redefinition of OpenSSL types.
2020-07-27 20:59:40 +02:00
Daiyuu Nobori
844dcdb0af Remove all references to strtok() and wcstok(), implement and use alternatives
strtok() and wcstok() are considered unsafe functions.

A segmentation fault caused by the use of strtok() was recently reported.

Co-authored-by: Takuho NAKANO <takotakot@users.noreply.github.com>
2020-07-20 17:57:58 +02:00
dnobori
144392c587 Add Tls_Disable1_3
Add Tls_Disable1_3 like Tls_Disable1_2 etc.
This change is part of v4.34-9744-beta e3370fb62c31eb10d0d221e628161863358d4cc3 .
2020-07-19 12:25:47 +09:00
Ilya Shipitsin
47d08b055e
Merge pull request #1114 from takotakot/disable_sslv3
Disable SSLv3
2020-06-18 11:21:59 +05:00
Takuho NAKANO
5ebdb394fc Disable sslv3 2020-06-09 13:59:57 +09:00
Tetsuo Sugiyama
d726719602
Fixed that NewDhcpOption did not handle DHCP options longer than 255 bytes correctly 2020-05-22 11:05:36 +09:00
Evengard
2cfe031398 Fixing most errors, the link on Windows is working and is stable 2020-05-12 18:10:06 +03:00
Evengard
f2fee4d32c Preliminary implementation of IPv6CP and IPv6 for PPP (untested) 2020-05-12 18:05:18 +03:00
Evengard
f627b64264 Auto formatting with AStyle 2020-05-12 17:59:25 +03:00
Evengard
1d6a4d3ec8 Preliminary IPC IPv6 implementation (untested) 2020-05-12 17:59:24 +03:00
Davide Beatrici
0570f7d31c Mayaqua/Network: add StopUdpListener()
This allows to stop a UDP listener without deleting it.

It's especially useful when no datagrams should be received anymore, but there are other threads accessing the listener.
2020-05-11 07:50:55 +02:00
Evengard
8fb456f6a6 Fixing a memory leak in SslCertVerifyCallback because of a duplicated callback 2020-05-03 05:36:01 +03:00
Evengard
132926ee09 Fixing alignment of struct on GCC, changing the method to server one 2020-05-03 05:17:23 +03:00
Evengard
9180e065a0 Some weirdness fixes 2020-05-02 20:29:31 +03:00
Evengard
39becfe4ab Some hacks to make Android VPN Client Pro working 2020-05-02 20:25:01 +03:00
Evengard
723f38e72f Fixing Linux... 2020-05-02 19:52:47 +03:00
Evengard
a2b7cb0148 Added possibility to load CA certificates from chain_certs folder to allow verifying the client certificates against it. 2020-05-02 19:52:46 +03:00
Evengard
24bd2b3198 Fixing up some errors 2020-05-02 19:52:46 +03:00
Ilya Shipitsin
c6f186bd73
Merge pull request #1084 from ffontaine/master
Only enable getifaddrs support when available
2020-04-03 17:45:19 +05:00
Ilya Shipitsin
84bd9abb30
Merge pull request #1072 from Evengard/ppp-ipv6
Rewriting the PPP stack
2020-04-02 20:29:51 +05:00
Fabrice Fontaine
dcecd4c0d5 Only enable getifaddrs support when available
On uClibc, the ifaddrs.h support is optional. While the default
Buildroot uClibc configuration has it enabled, some external
toolchains may not. Therefore this patch detects that and adjusts
softether usage of ifaddrs accordingly.

Based on an initial patch from Bernd Kuhls.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
[Retrieved from:
https://git.buildroot.net/buildroot/tree/package/softether/0009-uclibc-ai-addrconfig.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-03-21 17:57:37 +01:00
Koichiro IWAO
f34d3c80b1
allow to SKIP_CPU_FEATURES explicitly, not only autodetect
Formerly, SKIP_CPU_FEATURES is automatically detected by system
processor. However, "^(armv7l|aarch64|s390x)$" does not cover all
processors that cpu_features should be skipped.

"armv6", "armv7", "mips", "mips64" on FreeBSD are examples [1]
that cpu_features is not correctly skipped.

This change intends to build SoftEther without any modifications on
CMakeLists.txt on such processors.

    cmake . -DSKIP_CPU_FEATURES=1

[1] https://www.freebsd.org/platforms/
2020-03-16 18:50:55 +09:00
Evengard
fa9e9d15a5 Removing unrelated changes as per review 2020-02-06 10:52:34 +03:00
Evengard
a6970e3e61 Merge branch 'master' into ppp-ipv6 2020-02-05 00:23:03 +03:00
Koichiro IWAO
b1aae5080d
put chain_certs in dbdir 2019-12-04 23:59:13 +09:00
Koichiro IWAO
c64674479d
separte log directory and database(config) directory
@ was an alias for exedir. To separate log directory and
database(config) directory, @ is now an alias for logdir and $ is an
alias for dbdir.
2019-12-04 23:59:09 +09:00
Koichiro IWAO
01abdedc45
put PID files under PidDir 2019-12-04 23:59:07 +09:00
Koichiro IWAO
18c9b74ff0
implement Get{Db,Log,Pid}{,W} function
DbDir  : directory to store files such as vpn_server.config and backups etc
LogDir : directory to write logs (sub directories is created in this dir)
PidDir : directory to put PID files such as .ctl-* .pid-* .VPN-*
2019-12-04 23:59:01 +09:00
Davide Beatrici
6b08a451da Mayaqua: implement R-UDP version 2, powered by ChaCha20-Poly1305 2019-11-23 04:38:20 +01:00
dnobori
9aaa9a7f15 Cedar: implement detailed protocol info 2019-11-23 04:23:56 +01:00
dnobori
ab57ef3f54 Mayaqua: add Windows Server 2019 to the supported operating systems list 2019-11-23 04:23:56 +01:00
Davide Beatrici
b8f58a2f94 Move generic proxy stuff from Cedar to Mayaqua
This commit moves the generic (not related to our protocol) proxy stuff from Cedar to Mayaqua, in dedicated files.

The functions are refactored so that they all have the same arguments and follow the same logic.

Dedicated error codes are added, in order to indicate clearly why the function(s) failed.
2019-10-30 01:39:04 +01:00
Davide Beatrici
51330fdb43 Mayaqua.h: include <stdarg.h> for "va_list" on Illumos 2019-10-21 21:44:38 +02:00
Davide Beatrici
2f90e9ecb8 Mayaqua: move HTTP functions from "Network" to "HTTP" 2019-10-20 04:15:12 +02:00
Davide Beatrici
c3d6ffc533 Move GetMimeTypeFromFileName() and related structure to Mayaqua
The structure (containing all mimetypes) occupies almost 700 lines, which are a lot.

This is just the beginning of the refactor plan.
2019-10-20 04:15:12 +02:00
Davide Beatrici
04ecbf843a Mayaqua.h: include <stdio.h> for "FILE" 2019-10-20 04:15:12 +02:00
Davide Beatrici
6b41b19327 Mayaqua.h: include <stddef.h>, for "wchar_t" 2019-10-20 04:15:12 +02:00
Davide Beatrici
2aeec323f9
Merge PR #1008: Adding RADIUS and L3 MAC address fixing function, with small bug-fixes 2019-10-19 19:37:21 +02:00
Daiyuu Nobori
f0357d4000 - Fixed the problem occurs when RPC messages between Cluster Members exceed 64Kbytes.
- Fixed the RADIUS PEAP client to use the standard TLS versioning.
- Implementation of a function to fix the MAC address of L3 VPN protocol by entering e.g. "MAC: 112233445566" in the "Notes" field of the user information.
- Implementation of a function to fix the virtual MAC address to be assigned to the L3 VPN client as a string attribute from RADIUS server when authentication.
2019-10-19 17:34:12 +09:00
Daiyuu Nobori
7413fec646 Updating built-in Win32 libraries
- OpenSSL 1.1.1 -> 1.1.1d
- zlib 1.2.3 -> 1.2.11
2019-10-19 16:59:13 +09:00
Davide Beatrici
d10f83417f
Merge PR #962: Fix several compile warnings on MS VC++ 2008. 2019-08-04 04:03:14 +02:00
Davide Beatrici
82b84a9436
Merge PR #961: Enable crash minidump for Win32 vpntest 2019-08-04 03:51:00 +02:00
Daiyuu Nobori
bf4667cfce Fix several compile warnings on MS VC++ 2008. 2019-08-04 10:35:16 +09:00
Daiyuu Nobori
c6068d23c7 Enables crash minidump for Win32 vpntest. Minidump files will be saved to the 'C:\Users\<username>\AppData\Local\Temp\vpn_debug' (for normal user) or 'src\bin\vpn_debug\' (for administrator user). 2019-08-04 10:26:41 +09:00
Davide Beatrici
9f19efb7af OpenVPN: use new protocol interface 2019-07-26 08:37:00 +02:00
Davide Beatrici
7d58e6bf60 Add interface for easy protocol implementation
This commit adds a protocol interface to the server, its purpose is to manage TCP connections and the various third-party protocols.

More specifically, ProtoHandleConnection() takes care of exchanging the packets between the local and remote endpoint; the protocol implementation only has to parse them and act accordingly.

The interface knows which protocol is the connection for by calling IsPacketForMe(), a function implemented for each protocol.
2019-07-26 08:36:54 +02:00
Rosen Penev
d57fc3524c
Fix LibreSSL support
My previous patch used a wrong if directive, which disabled removed
(de)initialization and threading for LibreSSL. This most likely causes
issues at runtime.
2019-07-22 11:35:19 -07:00
Rosen Penev
a9f707c813
Switch to OpenSSL THREADID API
The old threading API was deprecated in OpenSSL 1.0.
2019-07-22 11:28:12 -07:00
Rosen Penev
1bd39485cf
Mayaqua: Fix compilation without deprecated OpenSSL APIs
Initialization and deinitialization are deprecated.

Missing headers were added.

Explicit threading is also deprecated.
2019-07-11 12:42:26 -07:00
Rosen Penev
a4ed656001
Mayaqua: Replace GNU specific sys/poll.h header with POSIX poll.h
Fixes warning from the musl libc:

warning redirecting incorrect #include <sys/poll.h> to <poll.h>
2019-07-10 17:01:01 -07:00
Daiyuu Nobori
9c227f3480 Add the warning message if KB3033929 is not installed in Windows 7 / Server 2008 R2. 2019-06-30 01:20:52 +09:00
Daiyuu Nobori
98b08c2ad1 Implementation of the JSON-RPC API and the Web Admin interface. (dnobori's internal note: 7579 - 7682) 2019-05-28 12:51:51 +09:00
Daiyuu Nobori
98443715d9 Fixed the vulnerability that a malformed packet will cause the buffer overflow at the receive path. This vulnerability may occur abnormal process exit with the buffer security check mechanism built-in with SoftEther VPN binary. Although this buffer overflow can theoretically bypass the security check in theory, in the actual binary it is detected by the buffer security check inserted by the C compiler and the process is forcibly terminated. Therefore, as a result, it can be abused by a DoS attacker. Acknowledgments: The last problems is discovered and reported by Fabrizio Steiner. 2019-02-28 20:40:23 +09:00
vvd
372e8aa031 Fixed memory leak in OpenSSL deinitialization function 2019-02-27 21:41:20 +01:00
Rosen Penev
26261236ba
Fix compilation without OpenSSL ENGINE 2019-02-25 14:24:31 -08:00
Nick
23b8161ac2
Fixed wrong function name in Debug message 2019-02-15 20:41:16 -05:00
Ilya Shipitsin
45c13c5409 disable cpu features on arm64, amrhf, s390x
tested on launchpad
2019-02-03 18:05:34 +05:00
Davide Beatrici
09ee19e72b Mayaqua/Network.c: fix double free crash in GetCipherList()
SSL_free() also frees the associated context.

d6c3c1896c/ssl/ssl_lib.c (L1209)

From https://www.openssl.org/docs/man1.1.1/man3/SSL_free.html:

"SSL_free() also calls the free()ing procedures for indirectly affected items, if applicable: the buffering BIO, the read and write BIOs, cipher lists specially created for this ssl, the SSL_SESSION. Do not explicitly free these indirectly freed up items before or after calling SSL_free(), as trying to free things twice may lead to program failure."
2019-01-21 04:14:47 +01:00
Daiyuu Nobori
63c01ba736
Merge pull request #832 from dnobori/181202_switch_to_apache_license
Switching license from GPLv2 to Apache License 2.0.
2019-01-21 09:36:19 +09:00
Daiyuu Nobori
881f34ac56 Compacting headers, updating trivial texts to fit to the license change from GPLv2 to Apache License 2.0. 2019-01-14 12:25:53 +09:00
Ilya Shipitsin
3bb0e20add src/Mayaqua/FileIO: remove unused function
found by cppcheck

[src/Mayaqua/FileIO.c:2082]: (style) The function 'FileRename' is never used.
2019-01-06 23:44:23 +05:00
Davide Beatrici
d62421adcb Cedar: retrieve the list of available encryption algorithms from the server 2019-01-01 20:31:13 +01:00
Davide Beatrici
2a572aab21 Mayaqua: fix segmentation fault, add new FreeHttpHeaderSafe() function 2018-12-30 14:46:26 +01:00
Davide Beatrici
619a533b8f
Merge PR #843: Mayaqua: query OpenSSL for the list of available ciphers instead of relying on a static list 2018-12-28 20:24:13 +01:00
Davide Beatrici
e51c319648 Mayaqua: add "PTR_TO_PTR" macro intended to be used with FreeSafe() 2018-12-22 07:38:38 +01:00
Davide Beatrici
7f9d47b3aa Mayaqua: query OpenSSL for the list of available ciphers instead of relying on a static list 2018-12-21 09:54:51 +01:00
Davide Beatrici
bd01cbff9a Mayaqua: add new FreeSafe() function which calls Free() and set the pointer's value to NULL 2018-12-20 02:52:22 +01:00
Davide Beatrici
ada06e218e Mayaqua: revamp RecvHttpHeader() so that cleanup functions are not called twice 2018-12-19 20:00:18 +01:00
Daiyuu Nobori
9c0eee0aad Merge branch 'master' of github.com:SoftEtherVPN/SoftEtherVPN into 181202_switch_to_apache_license 2018-12-14 10:58:58 +09:00
Daiyuu Nobori
456efa7f87 Modification the header comments for some definitions in TunTap.h. 2018-12-02 16:00:45 +09:00
Daiyuu Nobori
337aaa0dfa Modification the header comments for some definitions in TunTap.h. 2018-12-02 15:58:23 +09:00
Daiyuu Nobori
c407f35322 SHA-0 Implementation replacement from GPLv3 to Apache License 2018-12-02 10:30:22 +09:00
Davide Beatrici
aefbd2e903 Add custom HTTP header feature for HTTP proxy
A custom HTTP header can be used to bypass certain restrictions imposed on the network or to avoid speed limitations applied by the QoS.
2018-11-29 20:32:21 +01:00
Ilya Shipitsin
9e250e62be src/Mayaqua/Mayaqua: remove unused functions
found by cppcheck

[src/Mayaqua/Mayaqua.c:753]: (style) Consecutive return, break, continue, goto or throw statements are unnecessary.
[src/Mayaqua/Mayaqua.c:484]: (style) The function 'IsUnicode' is never used.
[src/Mayaqua/Mayaqua.c:438]: (style) The function 'MayaquaDotNetMode' is never used.
[src/Mayaqua/Mayaqua.c:774]: (style) The function 'PrintOsInfo' is never used.
2018-11-30 00:01:11 +05:00
Davide Beatrici
04188f8606 CMake: change project name to "SoftEther VPN", create and use "TOP_DIRECTORY" variable 2018-11-27 05:00:30 +01:00
Ilya Shipitsin
d72329c007 src/Mayaqua/Cfg: remove unused functions, variables
found by cppcheck

[src/Mayaqua/Cfg.c:669]: (style) Variable 'invalid_file' is assigned a value that is never used.
[src/Mayaqua/Cfg.c:2111]: (style) Variable 'v' is assigned a value that is never used.
[src/Mayaqua/Cfg.c:1114]: (style) The function 'CfgFolderToBufText' is never used.
[src/Mayaqua/Cfg.c:539]: (style) The function 'CfgRead' is never used.
[src/Mayaqua/Cfg.c:418]: (style) The function 'CfgSave' is never used.
[src/Mayaqua/Cfg.c:1425]: (style) The function 'CfgStrToType' is never used.
[src/Mayaqua/Cfg.c:708]: (style) The function 'CfgTest' is never used.
[src/Mayaqua/Cfg.c:704]: (style) The function 'CfgTest2' is never used.
[src/Mayaqua/Cfg.c:247]: (style) The function 'NewCfgRwW' is never used.
2018-11-27 01:52:27 +05:00
Davide Beatrici
c48de5924a Mayaqua: ability to toggle memory tracking at runtime, various logic improvements 2018-11-18 04:18:51 +01:00
Davide Beatrici
e1bd84d7f3 CMake: set PDB output directory, don't set default build type 2018-11-18 04:18:42 +01:00
Davide Beatrici
f154cf1cec Mayaqua/Encrypt.h: fix missing AEAD macro for OpenBSD 2018-11-08 19:24:42 +01:00
Davide Beatrici
ba930668ba
Merge PR #796: Cedar/Proto_OpenVPN: add support for GCM ciphers 2018-11-04 01:01:10 +01:00
Ilya Shipitsin
6440521f81 src/Mayaqua/Network.c: remove reccuring check
found by PVS analyzer

src/Mayaqua/Network.c	18715	err	V571 Recurring check. The 'if (u->GetNatTIpThread == NULL)' condition was already verified in line 18712.
2018-11-04 01:04:58 +05:00
Ilya Shipitsin
87702f0f7d src/Mayaqua/OS: remove unused functions
found by cppcheck

[src/Mayaqua/OS.c:493]: (style) The function 'OSDec32' is never used.
[src/Mayaqua/OS.c:373]: (style) The function 'OSDeleteDir' is never used.
[src/Mayaqua/OS.c:393]: (style) The function 'OSFileCreate' is never used.
[src/Mayaqua/OS.c:353]: (style) The function 'OSFileDelete' is never used.
[src/Mayaqua/OS.c:383]: (style) The function 'OSFileOpen' is never used.
[src/Mayaqua/OS.c:331]: (style) The function 'OSFileRename' is never used.
[src/Mayaqua/OS.c:487]: (style) The function 'OSInc32' is never used.
[src/Mayaqua/OS.c:363]: (style) The function 'OSMakeDir' is never used.
[src/Mayaqua/OS.c:541]: (style) The function 'OSResetEvent' is never used.
2018-11-04 00:41:12 +05:00
Davide Beatrici
aae9ec0492 Mayaqua/Encrypt: add CipherProcessAead() function to encrypt/decrypt with AEAD ciphers 2018-11-03 15:14:56 +01:00
Ilya Shipitsin
8da2464831
Merge pull request #781 from chipitsine/BN_free
Merge PR #781: src/Mayaqua/Encrypt.c: fix memory leak occasionally found by valgrind
2018-10-29 14:22:45 +05:00
Ilya Shipitsin
5e75a1fb99 src/Mayaqua/Encrypt.c: fix memory leak occasionally found by valgrind 2018-10-29 10:52:56 +05:00
Daiyuu Nobori
4e4db36c11 Fix a single memory leak in loading the string table. 2018-10-29 14:48:15 +09:00
Davide Beatrici
c1f522c10e CMake: add support for Windows (Visual C++ 2017 toolset) 2018-10-24 21:25:57 +02:00
Davide Beatrici
3429e1bf31 CMake: build Cedar and Mayaqua as shared libraries, create "common" package 2018-10-20 13:12:49 +02:00
Ilya Shipitsin
68f1260f2c src/Mayaqua/MayaType.h: fix extra bracket
reported by @paskal
2018-10-14 20:40:28 +05:00
Davide Beatrici
e496f33455 Memory.c: fix pointer cast in TrackChangeObjSize() call
This commit fixes the "TrackDeleteObj: 0x12345678 is not Object!!" (where 0x12345678 is the actual address) errors with memcheck enabled.

It also fixes the following related warnings:

warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  TrackChangeObjSize((DWORD)addr, size, (DWORD)new_addr);
                     ^
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  TrackChangeObjSize((DWORD)addr, size, (DWORD)new_addr);
                                        ^
2018-10-14 07:51:53 +02:00
Davide Beatrici
ec7a9d7281 MayaType.h: fix pointer casting warnings
warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define POINTER_TO_KEY(p)  ((sizeof(void *) == sizeof(UINT)) ? (UINT)(p) : HashPtrToUINT(p))
                                                                ^

warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
 #define UINT64_TO_POINTER(i) ((sizeof(void *) == sizeof(UINT64)) ? (void *)(i) : (void *)((UINT)(i)))
                                                                                  ^

warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
 #define POINTER_TO_UINT64(p) (((sizeof(void *) == sizeof(UINT64)) ? (UINT64)(p) : (UINT64)((UINT)(p))))
                                                                                            ^
2018-10-14 07:24:18 +02:00
Ilya Shipitsin
ec09309aa8 gitlab-ci: enable ubuntu 12.04 builds 2018-10-12 01:03:12 +05:00
Daiyuu Nobori
8df347c093 Added OpenSSL 1.1.1 .lib files for Visual Studio 2008. 2018-10-09 20:30:03 +09:00
Daiyuu Nobori
baff1b349c Win32 OpenSSL Header File: Ver 1.0.2j -> Ver 1.1.1 2018-10-09 19:29:11 +09:00
Davide Beatrici
03d78693a3
Merge PR #735: Debug flag and test mode improvements 2018-10-08 21:00:44 +02:00
Davide Beatrici
8ddd336c38
Merge PR #736: vpntest project for programmers: runs VPN Server / VPN Client / VPN Bridge in test mode with full debug console output and memory leak checks 2018-10-08 06:33:47 +02:00
Daiyuu Nobori
8abcf3d0a9 Debug flag and test mode improvements
1. ifdef DEBUG -> defined(_DEBUG) || defined(DEBUG)
In VC++ compilers, the macro is "_DEBUG", not "DEBUG".

2. If set memcheck = true, the program will be vitally slow since it will log all malloc() / realloc() / free() calls to find the cause of memory leak.
For normal debug we set memcheck = false.
Please set memcheck = true if you want to test the cause of memory leaks.
2018-10-08 04:50:46 +02:00
Daiyuu Nobori
ee208dd6f0 Finally, the implementation of test code is completed! Ha ha ha 2018-10-08 11:50:11 +09:00
Davide Beatrici
9fa9f6cdc1 Mayaqua/Network.c: improve RecvFrom() and RecvFrom6()
This commit improves the RecvFrom() and RecvFrom6() functions by:
- Using the right data type for the struct size variable passed to recvfrom().
- Improving the arguments validation mechanism.
- Printing unhandled errors.
2018-10-08 03:21:10 +02:00
Davide Beatrici
afe994f252 Mayaqua/OS: improve UnixGetOsInfo() so that it retrieves info on recent Linux/BSD systems 2018-10-07 01:38:02 +02:00
Davide Beatrici
335e0503c9 Mayaqua/Str: add TrimQuotes() function to remove quotes from a string 2018-10-06 22:42:29 +02:00
Davide Beatrici
9970d6f657 Mayaqua/Memory: move and adapt entry list functions from Cedar/Proto_OpenVPN 2018-10-06 22:41:35 +02:00
Davide Beatrici
e02237f397 Add string for "IF_TYPE_PROP_VIRTUAL" network interface type 2018-10-03 09:10:27 +02:00
Davide Beatrici
00f66616d2
Merge PR #721: Encrypt.c: fix MdProcess()'s HMAC implementation 2018-10-01 19:08:38 +02:00
Davide Beatrici
34f443c0c7
Merge PR #718: src/Cedar/BridgeUnix.c: resolve null pointer dereference 2018-09-29 23:30:28 +02:00
Ilya Shipitsin
564ca6087f src/Mayaqua/Object.c: remove redundant conditionals
found by PVS analyzer

src/Mayaqua/Object.c	318	warn	V547 Expression 'c->Ready == 0' is always false.
src/Mayaqua/Object.c	348	warn	V547 Expression 'c->Ready == 0' is always false.
src/Mayaqua/Object.c	383	warn	V547 Expression 'c->Ready == 0' is always false.
2018-09-29 00:39:01 +05:00
Daiyuu Nobori
ee9990317b Fix bugs reported by Coverity Scan. 2018-09-28 22:39:38 +09:00
Davide Beatrici
53c8abfd80 Encrypt.c: fix MdProcess()'s HMAC implementation 2018-09-27 20:28:48 +02:00
Davide Beatrici
50b42070e2 Encrypt: reorder digest functions 2018-09-22 06:47:03 +02:00
Davide Beatrici
3f5f716357 Revamp digest functions
- Hash() has been removed because it was ambiguous, Md5() and Sha0() are proper replacements.
- HMacMd5() and HMacSha1() now share a common implementation handled by the new Internal_HMac() function.
- NewMd() and MdProcess() now support plain hashing (without the key).
- NewMd(), SetMdKey() and MdProcess() now check the OpenSSL functions' return value and in case of failure a debug message is printed along with the error string, if available.
- SetMdKey()'s return value has been changed from void to bool, so that it's possible to know whether the function succeeded or not.
- MdProcess()' return value has been changed from void to UINT (unsigned int) and the function now returns the number of bytes written by HMAC_Final() or EVP_DigestFinal_ex().
2018-09-22 06:36:09 +02:00
Davide Beatrici
4e30a40ae1 Enable debug messages and memory check with debug configuration 2018-09-15 19:12:21 +02:00
Ilya Shipitsin
56681d41a0 src/Mayaqua/Kernel: remove unused variable, functions
found by cppcheck

[src/Mayaqua/Kernel.c:1199]: (style) Variable 'new_thread' is assigned a value that is never used.
[src/Mayaqua/Kernel.c:385]: (style) The function 'DelThreadFromThreadList' is never used.
[src/Mayaqua/Kernel.c:1726]: (style) The function 'GetCurrentLocale' is never used.
[src/Mayaqua/Kernel.c:562]: (style) The function 'GetHomeDir' is never used.
[src/Mayaqua/Kernel.c:1644]: (style) The function 'GetSpanStr' is never used.
[src/Mayaqua/Kernel.c:1695]: (style) The function 'GetSpanStrEx' is never used.
[src/Mayaqua/Kernel.c:950]: (style) The function 'GetTimeStr64' is never used.
[src/Mayaqua/Kernel.c:909]: (style) The function 'GetTimeStrEx64' is never used.
[src/Mayaqua/Kernel.c:1924]: (style) The function 'System64ToTime' is never used.
[src/Mayaqua/Kernel.c:1900]: (style) The function 'TimeToSystem64' is never used.
[src/Mayaqua/Kernel.c:470]: (style) The function 'WaitAllThreadsWillBeStopped' is never used.
[src/Mayaqua/Kernel.c:1478]: (style) The function 'GetTimeStr' is never used.
2018-09-01 10:25:09 +05:00
Ilya Shipitsin
a55a3b50e8 src/Mayaqua/Unix: remove unused code, improve readability of "ifdef"
refactoring was discussed in PR#672
2018-08-28 10:21:36 +05:00