0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 12:12:15 +02:00
Commit Graph

1679 Commits

Author SHA1 Message Date
James Yonan
76e65cf4c9 CryptoAlgs: added AEAD_NONCE_TAIL_SIZE constant (set to 8
bytes) to represent the size in bytes of AEAD "nonce tail"
normally taken from the HMAC key material.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
27387181a8 compress: added method_to_string() method, i.e. the
inverse of parse_method().

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
7b47f998ad compress: since parse_method() performs a linear search
on method, reorder so that more frequently used methods
appear at the top of the list.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
James Yonan
b428f742d1 library: added integer is_pow2() and log2() methods based on
efficient __builtin_ffs and __builtin_clz intrinsics.

Signed-off-by: James Yonan <james@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
4926011513 Android: adapt toolchain scripts to new SDK and move to API 26
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
ad4e995fae mbedTLS: use mbedtls API to initialize cert object
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
908c611139 transport: use socket_protect to communicate socket handle on UWP
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
92a62169d4 build win: read certain params from env
Required for Jenkins multibrach pipeline build.

OVPN3-99

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
8166ea8b3b common: define uwp platform macro
OVPN3-95

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
0186bf62c7 common: report platform name as "uwp"
OVPN3-94

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
3f291b0ddb netconf: disable getting hwaddr for UWP
OVPN3-93

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
6365d26b31 transport: external factory
Provide ExternalTransport::Factory interface to enable client instantiate transport factory.

OVPN3-92

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
2ffa0c9e36 transport: synchronous DNS lookup
Add config option to enable synchronous DNS lookup.

OVPN3-76

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
2c09c7c0b8 cliconnect.hpp: support for AsioWork always on
OVPN3-85

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
4f5a04db4e rand.hpp: allow external entropy source
OVPN3-84

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Lev Stipakov
b19c5da828 time.hpp: use GetTickCount64 on Vista and newer
OVPN3-87

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
712ccfc7dc android: export DEP_DIR via vars files only if not already defined
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
Antonio Quartulli
1b5a78439e asio: make sure to switch to DEP_DIR before building
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-12-22 17:59:38 +08:00
David Nimon
4302651dd8 changes to support android building 2017-12-22 17:59:38 +08:00
Samuli Seppänen
6f56b2b5a1 Merge pull request #21 from OpenVPN/make_test_proto_deterministic
travis-ci: make testing binary deterministic
2017-09-27 21:18:36 +03:00
Antonio Quartulli
3a5ef2be76 travis-ci: make testing binary deterministic
Travis-ci is used only for static analysis, therefore
when building the testing protocol we should avoid
non-deterministic behaviour which could lead to failures.

Tell the testing binary to work with lossless links.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:49:02 +08:00
Antonio Quartulli
b76882ddc9 mbedtls: fix typ0 in exception message
The md setup function has been substituted with a new one,
but the exception message was not updated.

Update it now to report the correct function name.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
40065a66e2 avoid "uninitialized variable warning"
the compiler is not smart enough to understand that under
the expected conditions http(s)_port will always be initialized.

Initialize variables upon declaration to avoid warning.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
f33e7c2968 [OVPN3-5] tls-crypt: add tls-crypt support in proto.hpp test unit
By default tls-crypt is now enabled instead of tls-auth.
It can be easily changed by editing the define at the top
of test/ssl/proto.hpp

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
74c5f4f38f [OVPN3-5] tls-crypt: introduce tls-crypt support
backported from OpenVPN 2.4.x

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
389353c243 proto.cpp: uninit process at the end of the execution
Not really important, but worth fixing to avoid polluting
any memchecker output with unreleased (leaked) resources.

Release process resources before exiting the main function.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
56a831f92a [OVPN3-5] crypto/ssl: add support for AES-256-CTR
Add support for AES-256-CTR (used by tls-crypt) in the crypto
layer and make sure that each SSL library plugin is aware of it.

Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Antonio Quartulli
7cbf539222 [OVPN3-5] build script: allow user to specify its own mbedTLS folder and LDFLAGS
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2017-09-27 16:16:18 +08:00
Lev Stipakov
8ae2a3f7cf Integrate Google Test framework
Implemented sample test for LogInfo class.

OVPN3-27
2017-09-27 16:16:18 +08:00
Lev Stipakov
68ae101f42 Add swig build to jenkins pipeline
OVPN3-44

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
d496311ade ovpncli.hpp: inline LogInfo constructor for clarity
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
Lev Stipakov
96e0d89454 Revert "Merged in OVPN3-21-prepend-log-record-with-unique- (pull request #7)"
This reverts commit 62423c91cb, reversing
changes made to f26b08b6ef.
2017-09-27 16:16:18 +08:00
Lev Stipakov
7db95ccde6 Make build fail on compilation errors
Signed-off-by: Lev Stipakov <lev@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
860129a9b6 TunBuilderCapture: make (to|from)_json methods public
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
2486494bbe random: added helper class Rand2 containing a crypto and non-crypto RNG
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
04175c2b84 appversion.hpp: Stringize VERSION -> MY_VERSION
Default to "0.1.0" if VERSION is undefined.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
81cb887f67 build script: added DPROF=1 flag
When DPROF=1 and PROF is specified, build with
the debugging variant of the vars file.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
a3dd47fb4c timestr.hpp: moved milliseconds_since_epoch() to time/epoch.hpp
Also added nanoseconds_since_epoch() function

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
59b9492408 sslchoose.hpp: added SSL_LIB_NAME
In sslchoose.hpp, define SSL_LIB_NAME to be the name
(as a text string) of the selected SSL library.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
8fcb797174 ProtoContext::KeyContext::raw_recv() : fix state transition
In ProtoContext::KeyContext::raw_recv() when state == C_WAIT_RESET,
Antonio noticed that the send_reset() is likely superfluous.

proto.cpp test seems to confirm.

Comment it out for now.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
e49e993b3c ProtoContext: comment edit
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
1d941aa7bd VPNServerNetblock::Netblock refactor
In VPNServerNetblock::Netblock, break out IP::Range clients
and IP::Addr bcast into a separate derived class ClientNetblock,
which provides a more minimalisic Netblock for use cases that
don't need to manage client VPN IP address pools.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
7190495421 Server-side renamings to break up long class names using namespaces.
* renamed ManClientInstanceSend to ManClientInstance::Send
* renamed ManClientInstanceRecv to ManClientInstance::Recv
* renamed ManClientInstanceFactory to ManClientInstance::Factory
* renamed TransportClientInstanceSend to TransportClientInstance::Send
* renamed TransportClientInstanceRecv to TransportClientInstance::Recv
* renamed TransportClientInstanceFactory to TransportClientInstance::Factory
* renamed TunClientInstanceRecv to TunClientInstance::Recv
* renamed TunClientInstanceSend to TunClientInstance::Send
* renamed TunClientInstanceFactory to TunClientInstance::Factory

Other related refactorings/removals:

Changes to ManClientInstance::Send:

* Added pre_stop() method.
* Renamed set_acl_id() to set_acl_index().

Changes to ManClientInstance::Recv:

* In push_reply(), removed routes and initial_fwmark parameters.
* Removed set_fwmark() method.
* Added tun_native_handle() method to return the tun socket
  file descriptor and peer_id of a client instance.

Changes to ServerProto:

* Added C++11 override attribute to overridden virtual methods

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
3f74ec1466 Listen::List: minor changes
* Use C++11 range-based iterators.
* Use std::string rather than std::ostringstream
  for string formatting.
* Added to_string() method.
* Added local_addr() method.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
79c789b8c8 RandomAPI: comment edit
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
5b5af36775 Added SSLConst::SERVER_TO_SERVER flag
SSLConst::SERVER_TO_SERVER allows X509 certificates to be
used in a meshed toplology, where a server certificate can
be used for either the client or server side of an SSL
connection.

Currently only implemented for OpenSSL.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
fe00df455e OpenSSLContext::Config::set_rng: call assert_crypto()
This isn't strictly necessary because OpenSSL uses a
hardcoded RNG, but is added for consistency with other
SSL libraries.

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:18 +08:00
James Yonan
3ae0076274 In sslchoose.hpp, move OPENVPN_LOG_SSL macro to new file ssllog.hpp
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:17 +08:00
James Yonan
1502cf6946 URL::Parse: made is_valid_uri_char() standalone and moved to validate_uri.hpp
In validate_uri.hpp, added these new methods:

* HTTP::is_valid_uri_char()
* HTTP::validate_uri()

Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:17 +08:00
James Yonan
2dcb18993c Added HTTP::Status::SwitchingProtocols constant
Signed-off-by: James Yonan <james@openvpn.net>
2017-09-27 16:16:17 +08:00