### Basic CMake Project Setup Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/CMakeLists.txt Initializes CMake version and defines the project name and language. This is a standard starting point for any CMake project. ```cmake cmake_minimum_required(VERSION 2.6) project("mbed TLS" C) ``` -------------------------------- ### Install executables Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/programs/hash/CMakeLists.txt Installs the 'hello' and 'generic_sum' executables to the 'bin' directory with specified permissions. ```cmake install(TARGETS hello generic_sum DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install Dependencies with vcpkg Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Installs necessary libraries like OpenSSL, Asio, and Google Test using vcpkg for building the OpenVPN3 core. ```bash > git clone https://github.com/Microsoft/vcpkg.git > cd vcpkg > bootstrap-vcpkg.bat > vcpkg integrate install > vcpkg install openssl-windows:x64-windows asio:x64-windows tap-windows6:x64-windows lz4:x64-windows gtest:x64-windows ``` -------------------------------- ### Install Executables Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/programs/test/CMakeLists.txt Installs the 'selftest', 'benchmark', and 'udp_proxy' executables to the 'bin' directory with specified permissions. ```cmake install(TARGETS selftest benchmark udp_proxy DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Build and Run mbed TLS Example Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/yotta/data/example-authcrypt/README.md Commands to set the yotta target, build the mbedtls library and examples, and copy the executable to the development board. ```bash yotta target frdm-k64f-gcc ``` ```bash $ yotta build ``` -------------------------------- ### Build mbedTLS and examples Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/yotta/data/example-benchmark/README.md Builds the mbedTLS library and its associated examples. This process may take a significant amount of time, especially during the initial compilation. ```bash $ yotta build ``` -------------------------------- ### Install LZ4 Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/README.md Build and install the LZ4 library using make. This command may require root permissions. ```bash make make install # this command may require root permissions ``` -------------------------------- ### Install Binaries Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/programs/util/CMakeLists.txt Installs the 'strerror' and 'pem2der' executables to the 'bin' directory with specified file permissions. ```cmake install(TARGETS strerror pem2der DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install Linux Dependencies Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Installs necessary packages for building the OpenVPN 3 client on Ubuntu 20. Includes build tools and libraries like OpenSSL and mbedTLS. ```bash sudo apt install g++ make libmbedtls-dev libssl-dev liblz4-dev cmake ``` -------------------------------- ### Windows Build and Run Example Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/unittests/README.md Exemplary commands for building and running unit tests on Windows, including specifying dependency directory, mbed TLS, and platform. ```bash ➜ cmake -DDEP_DIR=C:\o3\deps -DUSE_MBEDTLS=true -DCMAKE_GENERATOR_PLATFORM=x64 C:\o3\openvpn3 ➜ cmake --build . --target coreUnitTests ➜ test\unittests\Debug\coreUnitTests.exe --gtest_output="xml:test_core.xml" --gtest_shuffle ``` -------------------------------- ### Install Mbed TLS with Yotta Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/README.md Installs the latest version of Mbed TLS from the yotta registry. Ensure yotta is installed first. ```bash yotta install mbedtls ``` -------------------------------- ### Install with Carthage Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/README.md Add this line to your Cartfile to install OpenVPNAdapter using Carthage. Follow Carthage's project page for detailed installation and usage instructions. ```bash github "ss-abramchuk/OpenVPNAdapter" ``` -------------------------------- ### Download and Install ovpn-dco Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Fetches, builds, and installs the ovpn-dco kernel module for optimized data channel offload. ```bash cd $O3 git clone https://github.com/OpenVPN/ovpn-dco.git cd ovpn-dco make && sudo make install sudo modprobe ovpn-dco ``` -------------------------------- ### Install AES Program Executables Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/programs/aes/CMakeLists.txt Installs the 'aescrypt2' and 'crypt_and_hash' executables to the 'bin' directory with specified permissions. ```cmake install(TARGETS aescrypt2 crypt_and_hash DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Build with MbedTLS client and OpenSSL server on Mac Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample with MbedTLS for the client and OpenSSL for the server. This configuration is for testing hybrid SSL setups. ```bash MTLS=1 OSSL=1 OPENSSL_SYS=1 build proto ``` -------------------------------- ### Timer 5 Source Listing Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/ASIO/asio/src/examples/cpp03/tutorial/timer_dox.txt Full source code for the Timer.5 tutorial example, demonstrating concurrent timers and thread synchronization using asio::strand. ```cpp #include #include #include class printer { public: printer(asio::io_context& io_context) : strand_(asio::make_strand(io_context)), timer1_(io_context, asio::chrono::seconds(1)), timer2_(io_context, asio::chrono::seconds(1)), count_(0) { timer1_.async_wait(asio::bind_executor(strand_, std::bind(&printer::print1, this))); timer2_.async_wait(asio::bind_executor(strand_, std::bind(&printer::print2, this))); } ~printer() { delete timer1_ptr; delete timer2_ptr; } private: void print1() { if (count_ < 10) { std::cout << "timer1 called " << count_ << std::endl; ++count_; timer1_.expires_at(timer1_.expiry() + asio::chrono::seconds(1)); timer1_.async_wait(asio::bind_executor(strand_, std::bind(&printer::print1, this))); } } void print2() { if (count_ < 10) { std::cout << "timer2 called " << count_ << std::endl; ++count_; timer2_.expires_at(timer2_.expiry() + asio::chrono::seconds(1)); timer2_.async_wait(asio::bind_executor(strand_, std::bind(&printer::print2, this))); } } asio::strand strand_; asio::steady_timer* timer1_ptr; asio::steady_timer* timer2_ptr; int count_; }; int main() { try { asio::io_context io_context; printer p(io_context); asio::thread_group threads; threads.create_thread(std::bind(&asio::io_context::run, &io_context)); threads.create_thread(std::bind(&asio::io_context::run, &io_context)); threads.join_all(); } catch (std::exception& e) { std::cerr << e.what() << std::endl; } return 0; } ``` -------------------------------- ### Install Executables Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/programs/pkey/CMakeLists.txt Installs the compiled executables to the 'bin' directory with specific file permissions. This ensures the programs are accessible after the build process. ```cmake install(TARGETS dh_client dh_genprime dh_server key_app mpi_demo rsa_genkey rsa_sign rsa_verify rsa_encrypt rsa_decrypt pk_encrypt pk_decrypt pk_sign pk_verify gen_key DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install LZ4 Targets and Files Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/contrib/cmake_unofficial/CMakeLists.txt Installs the built LZ4 targets (executables and libraries), headers, man pages, and pkg-config files when not in bundled mode. ```cmake if(NOT LZ4_BUNDLED_MODE) include(GNUInstallDirs) install(TARGETS ${LZ4_PROGRAMS_BUILT} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(TARGETS ${LZ4_LIBRARIES_BUILT} LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") install(FILES "${LZ4_LIB_SOURCE_DIR}/lz4.h" "${LZ4_LIB_SOURCE_DIR}/lz4frame.h" "${LZ4_LIB_SOURCE_DIR}/lz4hc.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") install(FILES "${LZ4_PROG_SOURCE_DIR}/lz4.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/liblz4.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") # install lz4cat and unlz4 symlinks on *nix if(UNIX) install(CODE " foreach(f lz4cat unlz4) set(dest \"$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/${ }\") message(STATUS \"Symlinking: ${\dest} -> lz4\") execute_process( COMMAND \"${CMAKE_COMMAND}\" -E create_symlink lz4 \"${\dest}\") endforeach() ") # create manpage aliases foreach(f lz4cat unlz4) file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" ".so man1/lz4.1\n") install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${f}.1" DESTINATION "${CMAKE_INSTALL_MANDIR}/man1") endforeach() endif(UNIX) endif(NOT LZ4_BUNDLED_MODE) ``` -------------------------------- ### Start OpenVPN Tunnel Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/README.md Initiates the OpenVPN tunnel connection. It retrieves configuration from provider options, applies settings, and handles credentials if required. Reachability tracking is also started to ensure proper connection. ```swift override func startTunnel( options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void ) { // There are many ways to provide OpenVPN settings to the tunnel provider. For instance, // you can use `options` argument of `startTunnel(options:completionHandler:)` method or get // settings from `protocolConfiguration.providerConfiguration` property of `NEPacketTunnelProvider` // class. Also you may provide just content of a ovpn file or use key:value pairs // that may be provided exclusively or in addition to file content. // In our case we need providerConfiguration dictionary to retrieve content // of the OpenVPN configuration file. Other options related to the tunnel // provider also can be stored there. guard let protocolConfiguration = protocolConfiguration as? NETunnelProviderProtocol, let providerConfiguration = protocolConfiguration.providerConfiguration else { fatalError() } guard let ovpnFileContent: Data = providerConfiguration["ovpn"] as? Data else { fatalError() } let configuration = OpenVPNConfiguration() configuration.fileContent = ovpnFileContent configuration.settings = [ // Additional parameters as key:value pairs may be provided here ] // Uncomment this line if you want to keep TUN interface active during pauses or reconnections // configuration.tunPersist = true // Apply OpenVPN configuration let evaluation: OpenVPNConfigurationEvaluation do { evaluation = try vpnAdapter.apply(configuration: configuration) } catch { completionHandler(error) return } // Provide credentials if needed if !evaluation.autologin { // If your VPN configuration requires user credentials you can provide them by // `protocolConfiguration.username` and `protocolConfiguration.passwordReference` // properties. It is recommended to use persistent keychain reference to a keychain // item containing the password. guard let username: String = protocolConfiguration.username else { fatalError() } // Retrieve a password from the keychain guard let password: String = ... else { fatalError() } let credentials = OpenVPNCredentials() credentials.username = username credentials.password = password do { try vpnAdapter.provide(credentials: credentials) } catch { completionHandler(error) return } } // Checking reachability. In some cases after switching from cellular to // WiFi the adapter still uses cellular data. Changing reachability forces // reconnection so the adapter will use actual connection. vpnReachability.startTracking { [weak self] status in guard status == .reachableViaWiFi else { return } self?.vpnAdapter.reconnect(interval: 5) } // Establish connection and wait for .connected event startHandler = completionHandler vpnAdapter.connect(using: packetFlow) } ``` -------------------------------- ### Configure pkg-config File Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/contrib/cmake_unofficial/CMakeLists.txt Sets up variables for the pkg-config file generation, including installation prefix, library directory, and include directory, then configures the liblz4.pc.in template. ```cmake set(PREFIX "${CMAKE_INSTALL_PREFIX}") if("${CMAKE_INSTALL_FULL_LIBDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") set(LIBDIR "$prefix/${CMAKE_INSTALL_LIBDIR}") else() set(LIBDIR "${CMAKE_INSTALL_FULL_LIBDIR}") endif() if("${CMAKE_INSTALL_FULL_INCLUDEDIR}" STREQUAL "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") set(INCLUDEDIR "$prefix/${CMAKE_INSTALL_INCLUDEDIR}") else() set(INCLUDEDIR "${CMAKE_INSTALL_FULL_INCLUDEDIR}") endif() # for liblz4.pc substitution set(VERSION ${LZ4_VERSION_STRING}) configure_file(${LZ4_LIB_SOURCE_DIR}/liblz4.pc.in liblz4.pc @ONLY) ``` -------------------------------- ### LZ4 CLI Usage Example Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/lib/dll/example/README.md Basic usage syntax for the LZ4 command-line interface. Use -h or -H for a full list of commands. ```bash Usage: lz4 [arg] [input] [output] ``` -------------------------------- ### Get Frame Information Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/doc/lz4frame_manual.html Extracts frame parameters like block size and dictionary ID. This function is optional and can be used at the beginning of a frame to decode header information or after decoding has started to retrieve parameters from the context. It updates the consumed bytes from the source buffer. ```c size_t LZ4F_getFrameInfo(LZ4F_dctx* dctx, LZ4F_frameInfo_t* frameInfoPtr, const void* srcBuffer, size_t* srcSizePtr); ``` -------------------------------- ### Prepare OpenVPN 3 Directory Structure on Linux Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Sets up the directory structure for downloading and building the OpenVPN 3 client and its dependencies. ```bash export O3=~/O3 && mkdir $O3 export DEP_DIR=$O3/deps && mkdir $DEP_DIR export DL=$O3/dl && mkdir $DL ``` -------------------------------- ### Install with Cocoapods Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/README.md Add these lines to your Podfile to install OpenVPNAdapter with Cocoapods. Ensure you run `pod install` after updating your Podfile. ```ruby target 'Your Target Name' do use_frameworks! pod 'OpenVPNAdapter', :git => 'https://github.com/ss-abramchuk/OpenVPNAdapter.git', :tag => '0.8.0' end ``` -------------------------------- ### Build with MbedTLS client and server on Mac Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample using MbedTLS for both client and server, without minicrypto ASM algorithms. Use this for a pure MbedTLS setup. ```bash MTLS=1 build proto ``` -------------------------------- ### Install mbedTLS Headers Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/include/CMakeLists.txt Conditionally installs mbedTLS header files to the project's include directory. This snippet uses CMake's file globbing and install commands. ```cmake option(INSTALL_MBEDTLS_HEADERS "Install mbed TLS headers." ON) if(INSTALL_MBEDTLS_HEADERS) file(GLOB headers "mbedtls/*.h") install(FILES ${headers} DESTINATION include/mbedtls PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) endif(INSTALL_MBEDTLS_HEADERS) ``` -------------------------------- ### Build with MbedTLS client/server and minicrypto on Mac Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample using MbedTLS for client and server, and includes the minicrypto library for accelerated algorithms. Use this for performance testing with hardware acceleration. ```bash MTLS=1 MINI=1 build proto ``` -------------------------------- ### Prepare macOS Directory Structure Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Creates the necessary directories for cloning and building the OpenVPN 3 client on macOS. ```bash mkdir -p ~/src/mac ``` -------------------------------- ### Build with MbedTLS client and OpenSSL server on Linux Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample with MbedTLS for the client and OpenSSL for the server on Linux. This is for testing hybrid SSL setups on Linux. ```bash MTLS=1 OSSL=1 build proto ``` -------------------------------- ### Build with OpenSSL client and server on Mac Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample using OpenSSL for both client and server. This is a standard build for OpenSSL-based communication. ```bash OSSL=1 OPENSSL_SYS=1 build proto ``` -------------------------------- ### Install Random Executables Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/programs/random/CMakeLists.txt Installs the built random number generator executables to the 'bin' directory with specified permissions. ```cmake install(TARGETS gen_random_havege gen_random_ctr_drbg gen_entropy DESTINATION "bin" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ``` -------------------------------- ### Install ovpn-dco Core Dependencies Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Installs additional system packages required for building the OpenVPN 3 client with ovpn-dco support. ```bash sudo apt install pkg-config libnl-genl-3-dev ``` -------------------------------- ### Listing Build Options Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/unittests/README.md Command to display all available build options for the project with short descriptions. ```bash ➜ cmake -LH . ``` -------------------------------- ### Build with AppleSSL client and OpenSSL server on Mac Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample with AppleSSL for the client and OpenSSL for the server. This is for testing Apple's native SSL with OpenSSL. ```bash SSL_BOTH=1 OPENSSL_SYS=1 build proto ``` -------------------------------- ### Install LZ4 for DOS Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/contrib/djgpp/README.MD Installs the built LZ4 components to a specified destination directory. Note that this command is less practical on a Unix-like system. ```makefile make -f contrib/djgpp/Makefile DESTDIR=/home/user/dos install ``` -------------------------------- ### Benchmark Output Example Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/yotta/data/example-benchmark/README.md This is an example of the output generated by the mbed TLS benchmark program. It displays performance metrics for various cryptographic algorithms. ```text {{timeout;150}} {{host_test_name;default}} {{description;mbed TLS benchmark program}} {{test_id;MBEDTLS_BENCHMARK}} {{start}} SHA-1 : 3644 KiB/s, 32 cycles/byte SHA-256 : 1957 KiB/s, 59 cycles/byte SHA-512 : 587 KiB/s, 200 cycles/byte AES-CBC-128 : 1359 KiB/s, 86 cycles/byte AES-CBC-192 : 1183 KiB/s, 99 cycles/byte AES-CBC-256 : 1048 KiB/s, 111 cycles/byte AES-GCM-128 : 421 KiB/s, 279 cycles/byte AES-GCM-192 : 403 KiB/s, 292 cycles/byte AES-GCM-256 : 385 KiB/s, 305 cycles/byte AES-CCM-128 : 542 KiB/s, 216 cycles/byte AES-CCM-192 : 484 KiB/s, 242 cycles/byte AES-CCM-256 : 437 KiB/s, 268 cycles/byte CTR_DRBG (NOPR) : 1002 KiB/s, 117 cycles/byte CTR_DRBG (PR) : 705 KiB/s, 166 cycles/byte HMAC_DRBG SHA-1 (NOPR) : 228 KiB/s, 517 cycles/byte HMAC_DRBG SHA-1 (PR) : 210 KiB/s, 561 cycles/byte HMAC_DRBG SHA-256 (NOPR) : 212 KiB/s, 557 cycles/byte HMAC_DRBG SHA-256 (PR) : 185 KiB/s, 637 cycles/byte RSA-2048 : 41 ms/ public RSA-2048 : 1349 ms/private RSA-4096 : 134 ms/ public RSA-4096 : 7149 ms/private ECDSA-secp384r1 : 640 ms/sign ECDSA-secp256r1 : 387 ms/sign ECDSA-secp384r1 : 1233 ms/verify ECDSA-secp256r1 : 751 ms/verify ECDHE-secp384r1 : 1191 ms/handshake ECDHE-secp256r1 : 730 ms/handshake ECDHE-Curve25519 : 611 ms/handshake ECDH-secp384r1 : 584 ms/handshake ECDH-secp256r1 : 365 ms/handshake ECDH-Curve25519 : 303 ms/handshake {{success}} {{end}} ``` -------------------------------- ### Build with reduced SSL renegotiations Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample with a modified `RENEG` value to simulate less data-channel activity and more SSL renegotiations. Use this to test renegotiation handling. ```bash GCC_EXTRA="-DRENEG=90" build proto ``` -------------------------------- ### Build with MbedTLS client/server using PGO on Linux Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample with MbedTLS on Linux, using Profile-Guided Optimization (PGO). This involves two build steps: generating profile data and then using it for optimization. ```bash PGEN=1 MTLS=1 NOSSL=1 build proto && ./proto && PUSE=1 MTLS=1 NOSSL=1 build proto ``` -------------------------------- ### View OpenVPN 3 Client Wrapper Options Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Displays the available command-line options for the OpenVPN 3 client wrapper. ```bash ./cli -h ``` -------------------------------- ### Using Custom mbedTLS Config with Make Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/configs/README.txt Example of how to use a custom mbedTLS configuration file with the make build system by defining MBEDTLS_CONFIG_FILE and adjusting include paths. ```bash CFLAGS="-I$PWD/configs -DMBEDTLS_CONFIG_FILE=''" make ``` -------------------------------- ### SHA-256 Hashing Example Output Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/yotta/data/example-hashing/README.md This is the expected output from the mbed TLS SHA-256 hashing example application when run on a development board. It shows the results of hashing a buffer using four different methods. ```text {{timeout;10}} {{host_test_name;default}} {{description;mbed TLS example on hashing}} {{test_id;MBEDTLS_EX_HASHING}} {{start}} Method 1: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 Method 2: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 Method 3: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 Method 4: 315f5bdb76d078c43b8ac0064e4a0164612b1fce77c869345bfc94c75894edd3 DONE {{success}} {{end}} ``` -------------------------------- ### Build mbedTLS Library Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/README.md Execute this command in the project root to build the library and sample programs. ```bash make ``` -------------------------------- ### Uninstall LZ4 for DOS Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/contrib/djgpp/README.MD Removes previously installed LZ4 components for DOS. ```makefile make -f contrib/djgpp/Makefile uninstall ``` -------------------------------- ### Building Unit Tests Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/unittests/README.md Commands to build the OpenVPN3 unit tests. Assumes dependencies are built and available. ```bash ➜ mkdir ../unit_test_build ➜ cd ../unit_test_build ➜ cmake ../openvpn3 ➜ cmake --build . --target coreUnitTests ``` -------------------------------- ### Override CFLAGS Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/README.md Override the default CFLAGS, for example, to add -Werror to the default -O2. ```bash make CFLAGS="-O2 -Werror" ``` -------------------------------- ### Build with OpenSSL client and server on Linux Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample using OpenSSL for both client and server on Linux. This is a standard OpenSSL build for Linux. ```bash OSSL=1 build proto ``` -------------------------------- ### Build OpenVPN3 CLI on Mac with MbedTLS, Minicrypto, and C++11 Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ovpncli/README.txt Builds the OpenVPN3 CLI on macOS using MbedTLS, Minicrypto, and C++11 for optimized move constructors. Includes options for stripping binaries, enabling snapshot builds, and LZ4 compression. ```bash GCC_EXTRA="-ferror-limit=4 -std=c++11" STRIP=1 MTLS=1 MINI=1 SNAP=1 LZ4=1 build cli ``` -------------------------------- ### Skip Test Build Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/README.md Use this command if Perl is not installed and you wish to skip building the tests. ```bash make no_test ``` -------------------------------- ### Override WARNING_CFLAGS Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/README.md Override the default WARNING_CFLAGS, for example, to remove default warning options if your compiler does not support them. ```bash make WARNING_CFLAGS="-Wall" ``` -------------------------------- ### List CMake Options Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/mbedTLS/README.md Display all available CMake configuration options for the project. ```bash cmake -LH ``` -------------------------------- ### Property Access with Dot Notation Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/CONTRIBUTING.md Dot notation is recommended for getting and setting properties for improved readability. ```objective-c // GOOD: view.backgroundColor = [UIColor orangeColor]; [UIApplication sharedApplication].delegate; ``` -------------------------------- ### Compiling with LZ4 DLL using gcc/MinGW Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/lib/dll/example/README.md Example command for compiling a C project with the LZ4 dynamic library using gcc/MinGW. Ensure include paths and the DLL are correctly specified. ```bash gcc $(CFLAGS) -Iinclude\ test-dll.c -o test-dll dll\liblz4.dll ``` -------------------------------- ### Avoid Bracket Notation for Properties Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/CONTRIBUTING.md This example demonstrates the AVOID pattern for property access using bracket notation. ```objective-c // AVOID: [view setBackgroundColor:[UIColor orangeColor]]; UIApplication.sharedApplication.delegate; ``` -------------------------------- ### OpenVPN3 Client API Configuration Initialization Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/README.rst Initializes a ClientAPI::Config object with configuration file content and other options before creating and evaluating the client. ```cpp ClientAPI::Config config; config.content = ; ... ``` -------------------------------- ### Avoid Naked Instance Variables Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/CONTRIBUTING.md This example shows the AVOID pattern for instance variables, contrasting with the recommended property usage. ```objective-c @interface NYTSection : NSObject { NSString *headline; } ``` -------------------------------- ### Build with MbedTLS client and server (4 threads) on Mac Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample with MbedTLS for client and server, utilizing 4 concurrent threads. This is useful for testing multi-threaded performance. ```bash "-DN_THREADS=4" MTLS=1 build proto ``` -------------------------------- ### XML Error Response for User Not Enrolled Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/doc/webauth.md Example XML error response indicating that the user is not enrolled through the WEB client. ```xml Access denied REST method failed ``` -------------------------------- ### Get LZ4 Library Version String Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/LZ4/doc/lz4_manual.html Retrieves the version string of the LZ4 library. Useful for checking DLL compatibility. ```c const char* LZ4_versionString (void); ``` -------------------------------- ### Build with MbedTLS client and server on Linux Source: https://github.com/ss-abramchuk/openvpnadapter/blob/master/Sources/OpenVPN3/test/ssl/README.txt Builds the proto.cpp sample using MbedTLS for both client and server on Linux, without ASM crypto algorithms. This is a standard MbedTLS build for Linux. ```bash MTLS=1 NOSSL=1 build proto ```