Re: [Openvpn-devel] [PATCH v2 08/21] Decouple MSS fix calculation from frame calculation

2021-12-14 Thread Arne Schwabe
Am 14.12.21 um 18:10 schrieb Frank Lichtenheld: Arne Schwabe hat am 14.12.2021 16:09 geschrieben: This consolidates the MSS fix calculation into a single function instead having it distributed all over the code. It also calculates the real wire overhead without extra sizes for buffer etc

Re: [Openvpn-devel] [PATCH v2 08/21] Decouple MSS fix calculation from frame calculation

2021-12-14 Thread Frank Lichtenheld
> Arne Schwabe hat am 14.12.2021 16:09 geschrieben: > > > This consolidates the MSS fix calculation into a single function > instead having it distributed all over the code. It also calculates > the real wire overhead without extra sizes for buffer etc. > > Patch v2: improve comment > > Si

[Openvpn-devel] [PATCH v3 18/18] Add xkey_provider sources and includes to MSVC project

2021-12-14 Thread selva . nair
From: Selva Nair Signed-off-by: Selva Nair --- src/openvpn/openvpn.vcxproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/openvpn/openvpn.vcxproj b/src/openvpn/openvpn.vcxproj index 65ee6839..2f0cee60 100644 --- a/src/openvpn/openvpn.vcxproj +++ b/src/openvpn/openvpn.vcxproj @@ -316

[Openvpn-devel] [PATCH v3 14/18] pkcs11: Interface the xkey provider with pkcs11-helper

2021-12-14 Thread selva . nair
From: Selva Nair - Load the 'private key' handle through the provider and set it in SSL_CTX - Add a sign op function to interface provider with pkcs11-helper. Previously we used its "OpenSSL Session" which internally sets up callbacks in RSA and EC key methods. Not useful for the provider

[Openvpn-devel] [PATCH v3 15/18] Enable signing using CNG through xkey provider

2021-12-14 Thread selva . nair
From: Selva Nair - Add xkey_cng_sign() as sign_op for the provider and load the key using xkey_generic_load. - Enable/Disable old code when provider is available or not. - xkey_digest is made non-static for use in cryptoapi.c One function cng_padding_type() is moved down to reduce number of

[Openvpn-devel] [PATCH v3 12/18] Increase ERR_BUF_SIZE when management interface support is enabled

2021-12-14 Thread selva . nair
From: Selva Nair Sending largish messages to the management interface errors due to the limited size used for the "error" buffer in x_msg_va(). Although all intermediate steps allocate required space for the data to send, it gets truncated at the last step. This really requires a smarter fix. As

[Openvpn-devel] [PATCH v3 04/18] Implement import of custom external keys

2021-12-14 Thread selva . nair
From: Selva Nair Our key object retains info about the external key as an opaque handle to the backend. We also need the public key as an EVP_PKEY *. For native keys we use OpenSSL API to import data into the key. The 'handle' representing the private key in that case is the OpenSSL

[Openvpn-devel] [PATCH v3 02/18] Implement KEYMGMT in the xkey provider

2021-12-14 Thread selva . nair
From: Selva Nair A minimal set of functions for keymgmt are implemented. No support for external key import as yet, only native keys. Support for native keys is required as keys may get imported into us for some operations as well as for comparison with unexportable external keys that we hold. I

[Openvpn-devel] [PATCH v3 06/18] A helper function to import private key for management-external-key

2021-12-14 Thread selva . nair
From: Selva Nair - Leverage keymgmt_import through EVP_PKEY_new_fromdata() to import "management-external-key" - When required, use this to set SSL_CTX_use_PrivateKey The sign_op is not implemented yet. This will error out while signing with --management-external-key. The next commit fixes th

[Openvpn-devel] [PATCH v3 13/18] Add a generic key loading helper function for xkey provider

2021-12-14 Thread selva . nair
From: Selva Nair - Load keys by specifying the opaque privtae key handle, public key, sign-op and free-op required for loading keys from Windows store and pkcs11. - xkey_load_management_key is refactored to use the new function - Also make xkey_digest non-static Used in following commits t

[Openvpn-devel] [PATCH v3 03/18] Implement SIGNATURE operations in xkey provider

2021-12-14 Thread selva . nair
From: Selva Nair - Basic frame work for announcing support for signature operations - DigestSign and Sign functions for native keys are also implemented. Though strictly not needed, these functions for native keys sets up the framework for signature operations. They also help loading an

[Openvpn-devel] [PATCH v3 10/18] Respect algorithm support announced by management client

2021-12-14 Thread selva . nair
From: Selva Nair Support for padding algorithms in management-client is indicated in the optional argument to --management-external-key as "pkcs1", "pss" etc. We currently use it only for an early exit based on heuristics that a required algorithm may not be handled by the client. When signature

[Openvpn-devel] [PATCH v3 01/18] A built-in provider for using external key with OpenSSL 3.0

2021-12-14 Thread selva . nair
From: Selva Nair Hooking into callbacks in RSA_METHOD and EVP_PKEY_METHOD structures is deprecated in OpenSSL 3.0. For signing with external keys that are not exportable (tokens, stores, etc.) requires a custom provider interface so that key operations are done under its context. A single provid

[Openvpn-devel] [PATCH v3 11/18] Support sending DigestSign request to management client

2021-12-14 Thread selva . nair
From: Selva Nair To receive undigested message for signing, indicate support for handling message digesting in the client using an argument "digest" to --management-external-key. For example, to announce pkcs1 padding and digesting support use: --management-external-key pkcs1 pss digest In PK_

[Openvpn-devel] [PATCH v3 09/18] Allow management client to announce pss padding support

2021-12-14 Thread selva . nair
From: Selva Nair The --management-external-key option can currently indicate support for 'nopadding' or 'pkcs1' signatures in the client. Add 'pss' as an option to announce that PSS signing requests are accepted. To match, extend the algorithm string in PK_SIGN request to include the following f

[Openvpn-devel] [PATCH v3 00/18] External key provider for use with OpenSSL 3

2021-12-14 Thread selva . nair
From: Selva Nair The following series of patches implement a built-in provider for interfacing OpenSSL 3.0 when external keys are in use. Essentially, to intercept the sign operation, the SSL_CTX object has to be created with properties string set to prioritize our provider. In the provider we

[Openvpn-devel] [PATCH v3 05/18] Initialize the xkey provider and use it in SSL context

2021-12-14 Thread selva . nair
From: Selva Nair - Add function to check when external key is in use - Load xkey provider into a custom library context when required - Use the custom libctx in SSL CTX when external key is in use As no keys are yet loaded through the provider, no functionality gets delegated to it as yet. v2

[Openvpn-devel] [PATCH v3 08/18] Add a function to encode digests with PKCS1 DigestInfo wrapper

2021-12-14 Thread selva . nair
From: Selva Nair The EVP_PKEY interface as well as provider passes the raw digest to the sign() function. In case of RSA_PKCS1, our management interface expects an encoded hash, which has the DigestInfo header added as per PKCSv1.5 specs, unless the hash algorithm is legacy MD5_SHA1. Fix this by

[Openvpn-devel] [PATCH v3 16/18] Add a unit test for external key provider

2021-12-14 Thread selva . nair
From: Selva Nair Tests: - Check SIGNATURE and KEYMGMT methods can be fetched from the provider - Load sample RSA and EC keys as management-external-key and check that their sign callbacks are correctly exercised: with and without digest support mocked in the client capability flag. Signe

[Openvpn-devel] [PATCH v3 07/18] Enable signing via provider for management-external-key

2021-12-14 Thread selva . nair
From: Selva Nair - Add a function to set as sign_op during key import. The function passes the signature request to management interface, and returns the result to the provider. v2 changes: Method to do digest added to match the changes in the provider signature callback. TODO:

[Openvpn-devel] [PATCH v3 17/18] xkey-provider: Add a test for generic key load and signature

2021-12-14 Thread selva . nair
From: Selva Nair Signed-off-by: Selva Nair --- configure.ac | 2 - tests/unit_tests/openvpn/Makefile.am | 4 - tests/unit_tests/openvpn/test_provider.c | 112 +-- 3 files changed, 105 insertions(+), 13 deletions(-) diff --git a/configure.

[Openvpn-devel] [PATCH v2 14/21] Add mtu paramter to --fragment and change fragment calculation

2021-12-14 Thread Arne Schwabe
Instead relying on the link_mtu_dynamic field and its calculation in the frame struct, add a new field max_fragment_size and add a calculation of it similar to mssfix. Also whenever mssfix value is calculated, we also want to calculate the values for fragment as both options need to be calculated

[Openvpn-devel] [PATCH v2 07/21] Add helper functions to calculate header/payload sizes

2021-12-14 Thread Arne Schwabe
These functions are intended to lay the groundwork to later replace the distributed frame calculations and centralise the calculation in one place. Patch v2: clarify that the socks comments is assuming IPv4 Signed-off-by: Arne Schwabe --- src/openvpn/crypto.c | 55

[Openvpn-devel] [PATCH v2 13/21] Implement optional mtu parameter for mssfix

2021-12-14 Thread Arne Schwabe
The current mssfix parameter is a bit as it needs manual calculation of the allowable packet size and also the resulting MSS value does not take into account if IPv4 or IPv6 is used on the outer tunnel. The mtu parameter fixes both of these problem by dynamically including the real overhead. The s

[Openvpn-devel] [PATCH v2 15/21] Update fragment and mssfix related warnings

2021-12-14 Thread Arne Schwabe
The warning that fragment/mssfix needs also tun-mtu set to 1500 makes little sense. Remove it completely. Instead warn if there are incosistencies between --fragment and mssfix. Patch v2: clarify the mssfix and fragment mtu warning message Signed-off-by: Arne Schwabe --- src/openvpn/init.c | 15

[Openvpn-devel] [PATCH v2 08/21] Decouple MSS fix calculation from frame calculation

2021-12-14 Thread Arne Schwabe
This consolidates the MSS fix calculation into a single function instead having it distributed all over the code. It also calculates the real wire overhead without extra sizes for buffer etc. Patch v2: improve comment Signed-off-by: Arne Schwabe --- src/openvpn/forward.c | 5 ++--- src/openvpn

[Openvpn-devel] OpenVPN 3 Linux client - v17 beta released

2021-12-14 Thread David Sommerseth
Hi, The OpenVPN 3 Linux v17 (beta) is now available. This release consists mostly of several enhancements of various sizes. * Behaviour change: Only AEAD ciphers available for data channel by default As part of the OpenSSL 3 support, non-AEAD ciphers are no longer enabled by default on for

[Openvpn-devel] [PATCH applied] Re: Remove post_open_mtu code

2021-12-14 Thread Gert Doering
Acked-by: Gert Doering I follow the reasoning - since we set the MTU now, we do not need to adjust the frame afterwards. Logging the MTU might be useful (Windows is weird, maybe it does not always "stick"...), so let's keep this in for the time being. Spurious comment change in ssl.c removed f

[Openvpn-devel] [PATCH applied] Re: Document frame related function and variables a bit more

2021-12-14 Thread Gert Doering
Not tested in any way, as this is just comments, and Frank has reviewed them. I hope we'll see --tun-mtu-extra die later in this series... :-) Your patch has been applied to the master branch. commit 66c05aeabc7218e58266bd2bb39ddbd040030328 Author: Arne Schwabe Date: Tue Dec 7 18:01:55 2021 +0

[Openvpn-devel] [PATCH applied] Re: Fix triggering assertion of ks->authenticated after tls_deauthenticate

2021-12-14 Thread Gert Doering
Acked-by: Gert Doering I have not tested the actuall ASSERT() crash, but went through the change asking myself "so, what will happen instead, now?" - handle_data_channel_packet() will now ignore all keys that are no longer KS_AUTH_TRUE, so if there is no other key, it will end up in "TLS er