Re: [Openvpn-devel] [PATCH] Fix delcarion of pubkeys in test_provider.c in MSVC builds

2022-08-25 Thread Selva Nair
On Thu, Aug 25, 2022 at 4:37 PM Gert Doering wrote: > Hi, > > On Wed, Aug 24, 2022 at 06:57:18PM +0200, Arne Schwabe wrote: > > Error: test_provider.c(74): error C2099: initializer is not a constant > > > > Fix this issue by making the const char* to const char[]. This is > probably > > of one

Re: [Openvpn-devel] [PATCH applied] Re: Allow a few levels of recursion in virtual_output_callback()

2022-08-22 Thread Selva Nair
In case this request was lost, here goes again. Can we have this cherry-picked into 2.5 before the next release? Selva On Thu, Aug 11, 2022 at 4:03 PM Selva Nair wrote: > Hi, > > On Tue, Aug 2, 2022 at 8:02 AM Gert Doering wrote: > >> Acked-by: Gert Doering >> >&

Re: [Openvpn-devel] [PATCH v102 3/7] dco-win: implement ovpn-dco support in P2P Windows code path

2022-08-21 Thread Selva Nair
Hi, Did a quick test on Windows 10 and appears to work as expected. Some minor things: (i) I had persist-tun which caused a fatal error that required opening the log file to find what's wrong and then fix the config file -- unfortunately the GUI status window cannot display such early errors.

Re: [Openvpn-devel] [PATCH applied] Re: Allow a few levels of recursion in virtual_output_callback()

2022-08-11 Thread Selva Nair
Hi, On Tue, Aug 2, 2022 at 8:02 AM Gert Doering wrote: > Acked-by: Gert Doering > > I cannot test this (beyond "compile", but that is trivial) but the > description in > > > https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24738.html > > makes sense, so allowing "a limited

Re: [Openvpn-devel] [PATCH] openvpnmsica: remove OpenVPNService state check code

2022-08-04 Thread Selva Nair
se changes to installer, we don't need this code > in openvpnmsica. > > Signed-off-by: Lev Stipakov > --- > src/openvpnmsica/openvpnmsica.c | 115 > 1 file changed, 115 deletions(-) > With PR261 in openvpn-build merged, this is now ready. A

[Openvpn-devel] [PATCH 2/2] Allow a few levels of recursion in virtual_output_callback()

2022-07-27 Thread selva . nair
From: Selva Nair Without this, replies to commands from the management client are sometimes lost if the server is writing when a command comes in and leads to a recursive call to this function. For some reason I've not been able to trigger this on Linux, but it does sometimes happen on Windows

[Openvpn-devel] [PATCH 1/2] Do not skip ERROR:/SUCCESS: response from management interface

2022-07-27 Thread selva . nair
From: Selva Nair Generally we expect a response of SUCCESS: or ERROR: to every command sent to the management interface. But, while in the management-hold state, sending "signal foo" returns only the following reply (with foo = SIGHUP, SIGUSR1 etc.): >HOLD:Waiting for hold r

[Openvpn-devel] [PATCH v2] xkey_provider: fix building with --disable-management

2022-07-27 Thread selva . nair
From: Selva Nair v2: also fix building test_provider - ifdefs in test_provider.c - include integer.h for min_int as manage.h may not always pull it in Too many ifdefs, unfortunately.. Signed-off-by: Selva Nair --- src/openvpn/xkey_helper.c| 4 tests/unit_tests

[Openvpn-devel] [PATCH] xkey_provider: fix building with --disable-management

2022-07-26 Thread selva . nair
From: Selva Nair Signed-off-by: Selva Nair --- src/openvpn/xkey_helper.c | 4 1 file changed, 4 insertions(+) diff --git a/src/openvpn/xkey_helper.c b/src/openvpn/xkey_helper.c index 81dd71dc..27e87d79 100644 --- a/src/openvpn/xkey_helper.c +++ b/src/openvpn/xkey_helper.c @@ -85,6 +85,7

Re: [Openvpn-devel] OpenSSL 3.0 builds with --disable-management

2022-07-26 Thread Selva Nair
Hi, On Tue, Jul 26, 2022 at 2:59 AM Gert Doering wrote: > > I'm just relaying what buildbot found, not suggesting a particular fix > - not very familiar with these new code paths (do we need xkey at all > if management is disabled?). > xkey handles all external keys including pkcs11 and

[Openvpn-devel] Response from management i/f lost in some cases.

2022-07-25 Thread Selva Nair
Hi, Generally we expect a response of "SUCCESS: " or "ERROR: ..." to every command sent to the management interface (in mult-line cases, a terminating line with "END" too). I've noticed a couple of situations where this is either missing or gets lost. (i) While in the hold state, sending

[Openvpn-devel] [PATCH] In x_check_status() read errno early

2022-07-22 Thread selva . nair
From: Selva Nair The correct errno can get overwritten by the call to format_extended_socket_error() which may set errno to EAGAIN losing the original error and cause to bypass the error reporting below. Fix by reading the errno of interest at the top of the function. Reported by: Gert Doering

Re: [Openvpn-devel] [PATCH v2] Fix M_ERRNO behavior on Windows

2022-07-22 Thread Selva Nair
On Fri, Jul 22, 2022 at 12:17 PM Gert Doering wrote: > Hi, > > On Tue, May 03, 2022 at 03:28:40AM +0300, Lev Stipakov wrote: > > From: Lev Stipakov > > > > We use M_ERRNO flag in logging to display error code > > and error message. This has been broken on Windows, > > where we use error code

Re: [Openvpn-devel] [PATCH] Fix crash in xkey-provider in msvc builds

2022-07-14 Thread Selva Nair
Hi, Any thoughts on this? Apart from the broken msvc builds that led to this, looks like the right thing to do, isn't it? Selva On Wed, Jul 6, 2022 at 11:52 PM wrote: > From: Selva Nair > > The function signature for xkey_load_generic_key had > function pointers defined as fu

[Openvpn-devel] [PATCH] Fix crash in xkey-provider in msvc builds

2022-07-06 Thread selva . nair
From: Selva Nair The function signature for xkey_load_generic_key had function pointers defined as function types that seems to work in gcc but not in msvc. Fix it by changing the function signatures to what was intended. Also revert part of commit 627d1a3d28638... as that work- around should

[Openvpn-devel] Bug in msvc build of master + OpenSSL 3.0.x

2022-07-06 Thread Selva Nair
Hi, As reported by Lev here: https://github.com/OpenVPN/openvpn-gui/pull/508#issuecomment-1174057372 I think its due to this in xkey-provider: typedef void (XKEY_PRIVKEY_FREE_fn)(void *handle); (and a similar one for SIGN_fn) EVP_PKEY * xkey_load_generic_key(OSSL_LIB_CTX *libctx, void *handle,

Re: [Openvpn-devel] [PATCH] Fix auth-token usage with management-def-auth

2022-07-04 Thread Selva Nair
Hi On Mon, Jul 4, 2022 at 5:50 AM Arne Schwabe wrote: > Am 04.07.22 um 04:58 schrieb selva.n...@gmail.com: > > From: Selva Nair > > > > When auth-token verify succeeds during a reauth, other auth > > methods (plugin, script, management) are skipped unless >

[Openvpn-devel] [PATCH] Fix auth-token usage with management-def-auth

2022-07-03 Thread selva . nair
From: Selva Nair When auth-token verify succeeds during a reauth, other auth methods (plugin, script, management) are skipped unless external-auth is in effect (skip_auth gets set to true). However, in this case, the status of management-def-auth (ks->mda_satus) stays at its default va

[Openvpn-devel] [PATCH] Remove management_write_peer_info_file and related code

2022-06-30 Thread selva . nair
From: Selva Nair Use of this has never been documented and the code was dead for a long while now. Signed-off-by: Selva Nair --- Alternative for [PATCH 2/3] Reactivate record_peer_info in manage.c src/openvpn/init.c| 1 - src/openvpn/manage.c | 49

[Openvpn-devel] [PATCH 3/3] Log address of management client on accept

2022-06-30 Thread selva . nair
From: Selva Nair Currently when we are listening on the management interface, the local address/port is logged as that of the connecting client. Fix it. Signed-off-by: Selva Nair --- src/openvpn/manage.c | 24 +--- 1 file changed, 21 insertions(+), 3 deletions(-) diff

[Openvpn-devel] [PATCH 2/3] Reactivate record_peer_info in manage.c

2022-06-30 Thread selva . nair
From: Selva Nair --management-client has an obscure and undocumented feature to take a file argument where the peer's address and port are recorded. This has become dead code over time. - reactivate the dead code - make it work with v6 addresses as well - do not exit on error in writing

[Openvpn-devel] [PATCH 1/3] Log the actual management interface port in use

2022-06-30 Thread selva . nair
From: Selva Nair When the port is specified as zero, log the actual port bound to, instead of 0. Signed-off-by: Selva Nair --- src/openvpn/manage.c | 18 -- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index

Re: [Openvpn-devel] [PATCH 19/25] dco-win: implement GetOverlappedResultEx for mingw32

2022-06-24 Thread Selva Nair
Hi, On Fri, Jun 24, 2022 at 5:10 AM Antonio Quartulli wrote: > GetOverlappedResultEx is not available on ming32 therefore we must > provide some compat layer before being able to use this function. > I suppose "mingw32" here refers to I mingw-w64 for 32 bit (i686) target. This symbol has been

Re: [Openvpn-devel] [PATCH] Add ability to specify initialize flags for pkcs11 provider

2022-06-23 Thread Selva Nair
Hi, On Thu, Jun 23, 2022 at 8:43 AM David Sommerseth < open...@sf.lists.topphemmelig.net> wrote: > On 19/6/2022 19:28, Selva Nair wrote: > > Hi,0 > > > > On Thu, Sep 30, 2021 at 7:34 AM Petr Mikhalicin via Openvpn-devel > > > <mailto:openvpn-devel@lists.s

Re: [Openvpn-devel] [PATCH] Add ability to specify initialize flags for pkcs11 provider

2022-06-19 Thread Selva Nair
Hi, On Thu, Sep 30, 2021 at 7:34 AM Petr Mikhalicin via Openvpn-devel < openvpn-devel@lists.sourceforge.net> wrote: > New pkcs11-helper interface allows to setup pkcs11 provider via > properties: > https://github.com/alonbl/pkcs11-helper/commit/b78d21c7e26041746aa4ae3d08b95469e1714a85 > > Also

Re: [Openvpn-devel] [PATCH v3] Implement ED448 and ED25519 support in xkey_provider

2022-05-16 Thread Selva Nair
Hi, Thanks for the new version. Looks good (only compile tested). Acked-by: Selva Nair Selva On Mon, May 16, 2022 at 6:49 AM Arne Schwabe wrote: > > OpenSSL's implementation of ED448 and ED25519 has a few idiosyncrasies. > Instead of belonging to the elliptic curve type or to

Re: [Openvpn-devel] [PATCH v2] Implement ED448 and ED25519 support in xkey_provider

2022-05-14 Thread Selva Nair
Hi, Thanks for the v2. I'm ready to ack this but for one issue (NULL passed to OSSL_PARAM_construct_utf8_string). On Fri, May 13, 2022 at 9:05 AM Arne Schwabe wrote: > > OpenSSL's implementation of ED448 and ED25519 has a few idiosyncrasies. > Instead of belonging to the eliptic curve type or

Re: [Openvpn-devel] [PATCH release/2.5] Fix M_ERRNO behavior on Windows

2022-05-11 Thread Selva Nair
Acked-by: Selva Nair Same as the patch 2429 <https://patchwork.openvpn.net/patch/2429/> for master except for the minor change in x_check_status() to match 2.5. On Wed, May 4, 2022 at 5:13 AM Lev Stipakov wrote: > From: Lev Stipakov > > We use M_ERRNO flag in logging to dis

Re: [Openvpn-devel] [PATCH] Implement ED448 and ED25519 support in xkey_provider

2022-05-11 Thread Selva Nair
Hi, On Tue, May 10, 2022 at 7:32 AM Arne Schwabe wrote: > OpenSSL's implementation of ED448 and ED25519 has a few idiosyncrasies. > Instead of belonging to the eliptic curve type or to a common Edwards > curve type, ED448 and ED25519 have each their own type. > > Also, OpenSSL excepts

Re: [Openvpn-devel] [PATCH v2] Fix M_ERRNO behavior on Windows

2022-05-03 Thread Selva Nair
{ > struct gc_arena gc = gc_new(); > msg(D_MANAGEMENT, "MANAGEMENT: TCP %s error: %s", prefix, > diff --git a/src/openvpn/platform.c b/src/openvpn/platform.c > index 61afee83..ae1678db 100644 > --- a/src/open

Re: [Openvpn-devel] [PATCH] Fix M_ERRNO behavior on Windows

2022-04-22 Thread Selva Nair
Hi, Sorry for the long delay in getting back to this.. On Tue, Feb 22, 2022 at 9:13 AM Lev Stipakov wrote: > From: Lev Stipakov > > We use M_ERRNO flag in logging to display error code > and error message. This has been broken on Windows, > where we use error code from GetLastError() and >

Re: [Openvpn-devel] OpenVPN Client 2FA problem with Backslash

2022-03-11 Thread Selva Nair
Hi Jacob, On Fri, Mar 11, 2022 at 3:52 AM Jakob Curdes wrote: > Hello Selva, hello all, > > I have tested the executable in the circumstances described earlier. I > confirm the problem described (username/password auth succeeds, but second > auth with 2FA data fails as the backslash in the

Re: [Openvpn-devel] OpenVPN Client 2FA problem with Backslash

2022-03-10 Thread Selva Nair
Hi, On Thu, Mar 10, 2022 at 4:23 PM Gert Doering wrote: > Hi, > > On Thu, Mar 10, 2022 at 12:51:51PM -0500, Selva Nair wrote: > > I missed this follow up on the devel list. Please see my reply to > > openvpn-users. If @ doesnt work there is no easy fix short of patching >

Re: [Openvpn-devel] OpenVPN Client 2FA problem with Backslash

2022-03-10 Thread Selva Nair
Hi, On Thu, Mar 10, 2022 at 9:15 AM Jakob Curdes wrote: > Hello all, > > I think I have found a bug in the OpenVPN Windows client , can you help me > to determine if this is true and how to proceed? > > We are trying to implement 2FA for several existing Firebox SSL VPNs > (which essentially

Re: [Openvpn-devel] [PATCH master+release/2.5] error.c: use correct API to get error description on Windows

2022-02-21 Thread Selva Nair
Hi On Mon, Feb 21, 2022 at 4:24 AM Lev Stipakov wrote: > We had a long discussion with ordex about this patch and came to the > conclusion that error printing is currently broken on Windows and > needs a proper fixing. > > +1 > What we propose: > > - M_ERRNO prints only C runtime errors on

[Openvpn-devel] [PATCH] pkcs11_openssl.c: check EVP_get_digestbyname() != NULL

2022-01-26 Thread selva . nair
From: Selva Nair Reported-by: Arne Schwabe Signed-off-by: Selva Nair --- src/openvpn/pkcs11_openssl.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/openvpn/pkcs11_openssl.c b/src/openvpn/pkcs11_openssl.c index a82b4b32..c4f88816 100644 --- a/src/openvpn

Re: [Openvpn-devel] [PATCH 3/3] Support PSS signing using pkcs11-helper >= 1.28

2022-01-26 Thread Selva Nair
On Wed, Jan 26, 2022 at 6:50 AM Arne Schwabe wrote: > Am 25.01.22 um 03:51 schrieb selva.n...@gmail.com: > > From: Selva Nair > > > > - Call pkcs11h_certificate_signAny_ex() when available > >so that the signature mechanism parameters can be pased. > >

Re: [Openvpn-devel] [PATCH v3] Allow PKCS#11 uri to be used as --cert and --key file names

2022-01-25 Thread Selva Nair
On Sun, Aug 15, 2021 at 6:26 PM wrote: > From: Selva Nair > > v2 changes > - do not allow so-path embedded in cert and key uri > - add --pkcs11-engine option to optionally specify the > engine and provider module to use > v3: rebase to master > >

Re: [Openvpn-devel] [PATCH] Do not error when md_kt_size() is called with mdname="none"

2022-01-25 Thread Selva Nair
Hi, On Tue, Jan 25, 2022 at 11:35 AM Antonio Quartulli wrote: > Hi, > > On 25/01/2022 17:30, Arne Schwabe wrote: > > Am 25.01.22 um 17:27 schrieb Antonio Quartulli: > >> Hi, > >> > >> On 21/01/2022 19:57, selva.n...@gmail.com wrote: > >>> diff --git a/src/openvpn/crypto_openssl.c >

[Openvpn-devel] [PATCH 1/3] xkey: Use a custom error level for debug messages

2022-01-24 Thread selva . nair
From: Selva Nair D_XKEY = loglev(6, 69, M_DEBUG) is defined and used for all low level debug messages from xkey_provider.c and xkey_helper.c As suggested by Arne Schwabe Signed-off-by: Selva Nair --- src/openvpn/errlevel.h | 1 + src/openvpn/xkey_helper.c | 8 +-- src/openvpn

[Openvpn-devel] [PATCH 2/3] Fix max saltlen calculation in cryptoapi.c

2022-01-24 Thread selva . nair
From: Selva Nair (nbits - 1)/8 should have been rounded up. Fix and move it to an inlined function for reuse in pkcs11_openssl.c (used in the next commit). Note: The error is not triggered in normal use as OpenSSL always seems to use saltlen="digest" for signing. Signed-off-by:

[Openvpn-devel] [PATCH 3/3] Support PSS signing using pkcs11-helper >= 1.28

2022-01-24 Thread selva . nair
From: Selva Nair - Call pkcs11h_certificate_signAny_ex() when available so that the signature mechanism parameters can be pased. (Required for RSA-PSS signature). Signed-off-by: Selva Nair --- src/openvpn/pkcs11_openssl.c | 123 +-- 1 file changed, 118

Re: [Openvpn-devel] [PATCH 1/2] xkey: fix msvc build

2022-01-24 Thread Selva Nair
= { > }; > > const OSSL_ALGORITHM signatures[] = { > -{"RSA:rsaEncryption", props, signature_functions, "OpenVPN xkey RSA > Signature"}, > -{"ECDSA", props, signature_functions, "OpenVPN xkey ECDSA Signature"}, > +{"RSA:rsaEncryption", XKEY_PROV_PROPS, signature_functions, "OpenVPN > xkey RSA Signature"}, > +{"ECDSA", XKEY_PROV_PROPS, signature_functions, "OpenVPN xkey ECDSA > Signature"}, > {NULL, NULL, NULL, NULL} > }; Acked-by: Selva Nair ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Re: [Openvpn-devel] [PATCH] msvc: switch to openssl3

2022-01-24 Thread Selva Nair
Hi On Mon, Jan 24, 2022 at 1:56 PM Lev Stipakov wrote: > Hi, > > > A whole patch in the commit message is not very helpful and makes it > hard to read. Why not include this patch + the original, and apply the > patch during build? > > > > Or just add a pointer to the original file in the

Re: [Openvpn-devel] [PATCH] msvc: switch to openssl3

2022-01-24 Thread Selva Nair
Hi On Mon, Jan 24, 2022 at 4:47 AM Lev Stipakov wrote: > From: Lev Stipakov > > - add openssl3 port from > https://github.com/microsoft/vcpkg/pull/20428/files > with small changes: > > --- portfile.cmake.orig 2022-01-24 11:04:44.914467900 +0200 > +++ portfile.cmake 2022-01-24

Re: [Openvpn-devel] [PATCH v3] crypto: Fix OPENSSL_FIPS enabled builds

2022-01-21 Thread Selva Nair
Hi On Fri, Jan 21, 2022 at 12:10 PM Gert Doering wrote: > Hi, > > On Wed, Jan 19, 2022 at 07:21:26PM +0100, David Sommerseth wrote: > > index 5626e2b6..eb0b1254 100644 > > --- a/src/openvpn/crypto.c > > +++ b/src/openvpn/crypto.c > > @@ -34,6 +34,7 @@ > > #include "error.h" > > #include

[Openvpn-devel] [PATCH] Do not error when md_kt_size() is called with mdname="none"

2022-01-21 Thread selva . nair
From: Selva Nair An easy way to trigger this error is to run an otherwise working setup (at say verb = 4) with increased verbosity of verb >= 7 and using a GCM cipher (e.g., AES-256-GCM). It will cause a fatal exit while printing the cipher and hmac in key2_print(). Signed-off-by: Selva N

Re: [Openvpn-devel] [PATCH v3] tun: remove tun_finalize()

2022-01-20 Thread Selva Nair
rc/openvpn/tun.h b/src/openvpn/tun.h > index d4657537..a6661be0 100644 > --- a/src/openvpn/tun.h > +++ b/src/openvpn/tun.h > @@ -437,8 +437,6 @@ int tun_read_queue(struct tuntap *tt, int maxsize); > > int tun_write_queue(struct tuntap *tt, struct buffer *buf); > > -int tun_finalize(HANDLE h, struct overlapped_io *io, struct buffer *buf); > - > static inline bool > tuntap_stop(int status) > { > @@ -466,36 +464,8 @@ tuntap_abort(int status) > return false; > } > > -static inline int > -tun_write_win32(struct tuntap *tt, struct buffer *buf) > -{ > -int err = 0; > -int status = 0; > -if (overlapped_io_active(>writes)) > -{ > -status = tun_finalize(tt->hand, >writes, NULL); > -if (status < 0) > -{ > -err = GetLastError(); > -} > -} > -tun_write_queue(tt, buf); > -if (status < 0) > -{ > -SetLastError(err); > -return status; > -} > -else > -{ > -return BLEN(buf); > -} > -} > - > -static inline int > -read_tun_buffered(struct tuntap *tt, struct buffer *buf) > -{ > -return tun_finalize(tt->hand, >reads, buf); > -} > +int > +tun_write_win32(struct tuntap *tt, struct buffer *buf); > Antonio wanted this to be in one line though we are not terribly consistent about this. > static inline ULONG > wintun_ring_packet_align(ULONG size) > In spite of those nits meant to annoy the author, I think this looks good. Acked-by: Selva Nair ___ Openvpn-devel mailing list Openvpn-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Re: [Openvpn-devel] [PATCH applied] Re: Enable signing via provider for management-external-key

2022-01-20 Thread Selva Nair
Hi, On Thu, Jan 20, 2022 at 10:18 AM Gert Doering wrote: > Compile and client tested on 1.1.1 and 3.0.1. > > Glancing at the code related to management_external_key() does > not make me very happy... too many build time variants. "Happiness" is never a word that comes to mind while reading

[Openvpn-devel] [PATCH] Fix a potential memory leak in tls_ctx_use_management_external_key

2022-01-20 Thread selva . nair
From: Selva Nair As pointed out by Gert Doering Signed-off-by: Selva Nair --- To be applied after 06/18 of xkey patchset src/openvpn/ssl_openssl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openvpn/ssl_openssl.c b/src/openvpn/ssl_openssl.c index b48845eb..3f8c3091 100644

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

2022-01-20 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

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

2022-01-20 Thread Selva Nair
Hi On Thu, Jan 20, 2022 at 9:51 AM Gert Doering wrote: > Hi, > > On Tue, Dec 14, 2021 at 11:59:27AM -0500, selva.n...@gmail.com wrote: > > From: Selva Nair > > > > Signed-off-by: Selva Nair > > Is it OK if I squash 16+17 together? I dislike the "hist

Re: [Openvpn-devel] [PATCH v2] crypto: Fix OPENSSL_FIPS enabled builds

2022-01-19 Thread Selva Nair
Hi, Sorry for chiming in late: On Wed, Jan 19, 2022 at 10:20 AM David Sommerseth < open...@sf.lists.topphemmelig.net> wrote: > From: David Sommerseth > > On Fedora and RHEL/CentOS, the standard OpenSSL library has the FIPS > module enabled by default. On these platforms, the OPENSSL_FIPS

Re: [Openvpn-devel] [PATCH v2] tun: remove tun_finalize()

2022-01-15 Thread Selva Nair
Hi, On Sat, Jan 15, 2022 at 3:25 AM Antonio Quartulli wrote: > > Hi Selva, > > we were hoping to hear your opinion on this :-) > > We spent quite some time figuring out if we have to use both the non-WSA > and the WSA variant of the API in our code, and it seems we have to. > > (not because

Re: [Openvpn-devel] [PATCH v2] fix Changes.rst errors in 2.5.3 and 2.5.5 announcement

2021-12-27 Thread Selva Nair
Acked-By: Selva Nair On Mon, Dec 27, 2021 at 3:17 PM Gert Doering wrote: > > - 2.5.3 had a typo in the CVE ID (CVE-2121-3606 should be -2021-) > - 2.5.5 had windows paths with backslashes, which need to be doubled > > (CVE ID typo also reported by "@attritionorg" in G

Re: [Openvpn-devel] [PATCH] fix Changes.rst errors in 2.5.3 and 2.5.5 announcement

2021-12-27 Thread Selva Nair
Hi On Mon, Dec 27, 2021 at 6:16 AM Gert Doering wrote: > > - 2.5.3 had a typo in the CVE ID (CVE-2121-3606 should be -2021-) > - 2.5.5 had windows paths with backslashes, which need to be doubled > > (CVE ID typo also reported by "@attritionorg" in Github PR 165) > > Signed-off-by: Gert Doering

[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

[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 th

[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

[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 s

[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

[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 co

[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

[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

[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 cl

[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

[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

[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

[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

[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

[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

[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

[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

Re: [Openvpn-devel] [PATCH v3 7/9] Remove cipher_kt_t and change type to const char* in API

2021-12-10 Thread Selva Nair
Hi, On Fri, Dec 10, 2021 at 8:09 AM Arne Schwabe wrote: > > Make the external crypto consumer oblivious to the internal cipher > type that both mbed TLS and OpenSSL use. This change is mainly done > so the cipher type that is used can be stay a const type but instead > of an SSL library type, we

Re: [Openvpn-devel] [PATCH v3 7/9] Remove cipher_kt_t and change type to const char* in API

2021-12-10 Thread Selva Nair
On Fri, Dec 10, 2021 at 10:09 AM Gert Doering wrote: > > Hi, > > On Fri, Dec 10, 2021 at 02:06:51PM +0100, Arne Schwabe wrote: > > Patch v3: fix errors with mbed TLS without having md_kt to const char * > > patch > > also applied, fix logic inversion in tls_crypt_tk > > Thanks, this is

Re: [Openvpn-devel] [PATCH v2 7/9] Remove cipher_kt_t and change type to const char* in API

2021-12-09 Thread Selva Nair
Hi On Tue, Dec 7, 2021 at 1:07 PM Arne Schwabe wrote: > > Make the external crypto consumer oblivious to the internal cipher > type that both mbed TLS and OpenSSL use. This change is mainly done > so the cipher type that is used can be stay a const type but instead > of an SSL library type, we

Re: [Openvpn-devel] [PATCH applied] Re: Load OpenSSL config on Windows from trusted location

2021-11-24 Thread Selva Nair
Hi, On Wed, Nov 24, 2021 at 9:28 AM Lev Stipakov wrote: > Do we need this fix in openvpn-gui? It only (?) uses openssl to change > private key password, could this functionality be affected by config? > I do not know.. We do not call any functions that would lead to a config loading, so

Re: [Openvpn-devel] [PATCH applied] Re: Load OpenSSL config on Windows from trusted location

2021-11-24 Thread Selva Nair
Hi On Wed, Nov 24, 2021 at 5:06 AM Gert Doering wrote: > Your patch has been applied to the master and release/2.5 branch > (I consider this a bugfix since the "do not load config!" CVE patch > unintendedly broke functionality for people) > What would be a good location in the man page where

Re: [Openvpn-devel] [PATCH v4] Load OpenSSL config on Windows from trusted location

2021-11-23 Thread Selva Nair
+{ > +WCHAR val[MAX_PATH] = {0}; > +openvpn_swprintf(val, _countof(val), L"%ls\\ssl\\%ls", > install_path, ossl_env[i].value); > +_wputenv_s(ossl_env[i].name, val); > +} > +} > +} > + > #endif /* ifdef _WIN32

Re: [Openvpn-devel] [PATCH v3] Load OpenSSL config on Windows from trusted location

2021-11-23 Thread Selva Nair
Hi, On Tue, Nov 23, 2021 at 1:37 PM Lev Stipakov wrote: > I don't have a setup to properly test it, like actually loading the > config - I only checked that the openvpn.exe attempted to access > openssl.cnf at the correct location. > > If someone wants to test - binary artifacts could be found

Re: [Openvpn-devel] [PATCH v3] Load OpenSSL config on Windows from trusted location

2021-11-23 Thread Selva Nair
On Tue, Nov 23, 2021 at 1:46 PM Gert Doering wrote: > Hi, > > On Fri, Nov 19, 2021 at 02:53:06AM +0200, Lev Stipakov wrote: > > +if ((install_path[wcslen(install_path) - 1]) == L'\\') > > +{ > > +install_path[wcslen(install_path) - 1] = L'\0'; > > +} > > + > > +WCHAR

Re: [Openvpn-devel] [PATCH v2] Load OpenSSL config on Windows from trusted location

2021-11-23 Thread Selva Nair
Hi, +1 for setting these env vars. I will test this but some quick comments On Tue, Nov 23, 2021 at 10:08 AM Lev Stipakov wrote: > From: Lev Stipakov > > Commit 7e33127d5 ("contrib/vcpkg-ports: remove openssl port") > disabled OpenSSL config loading to prevent loading config > from untrusted

Re: [Openvpn-devel] OpenSSL build on Windows: OPENSSLDIR and MODULESDIR

2021-11-22 Thread Selva Nair
On Mon, Nov 22, 2021 at 4:37 PM Gert Doering wrote: > Hi, > > On Mon, Nov 22, 2021 at 04:33:36PM -0500, Selva Nair wrote: > > I think setting env vars would give us extra protection as we can detect > > the actual location of Program Files or executable's path at run time.

Re: [Openvpn-devel] OpenSSL build on Windows: OPENSSLDIR and MODULESDIR

2021-11-22 Thread Selva Nair
Hi, On Mon, Nov 22, 2021 at 3:27 PM Lev Stipakov wrote: > Hi, > > I added > > _putenv("OPENSSL_CONF=c:\\Temp\\lol.conf"); > > to openvpn_main() and see > > 22:01:38,9512311 openvpn.exe 27668 CreateFile C:\Temp\lol.conf > NAME NOT FOUND > > in procmon. So would it be enough to set

Re: [Openvpn-devel] OpenSSL build on Windows: OPENSSLDIR and MODULESDIR

2021-11-22 Thread Selva Nair
Hi, On Mon, Nov 22, 2021 at 12:20 PM Lev Stipakov wrote: > I added a commit to vcpkg/openssl PR > (https://github.com/microsoft/vcpkg/pull/21540) which gives an option > to customize ENGINESDIR. Unfortunately openssl doesn't make it easy - > ENGINESDIR is built based on --prefix, which is set

Re: [Openvpn-devel] OpenSSL build on Windows: OPENSSLDIR and MODULESDIR

2021-11-19 Thread Selva Nair
Hi, On Fri, Nov 19, 2021 at 3:04 PM wrote: > Ok, my idea was to fix only config loading dir. Apparently this is not > enough, so I’ll look into ENGINESDIR too. What we need is a proper build that can be safely distributed. Whatever that takes. My understanding is that if we have to get with

Re: [Openvpn-devel] OpenSSL build on Windows: OPENSSLDIR and MODULESDIR

2021-11-19 Thread Selva Nair
Hi On Fri, Nov 19, 2021 at 11:16 AM Lev Stipakov wrote: > Hi, > > Here is what output of openssl.exe built with abovementioned patch on > my machine: > > > c:\Users\lev\Projects\vcpkg\packages\openssl_x64-windows-ovpn\tools\openssl>openssl.exe > version -a > OpenSSL 1.1.1l 24 Aug 2021 > built

Re: [Openvpn-devel] OpenSSL build on Windows: OPENSSLDIR and MODULESDIR

2021-11-19 Thread Selva Nair
Hi, On Fri, Nov 19, 2021 at 6:43 AM Lev Stipakov wrote: > Hi, > > I've submitted PR to vcpkg's openssl port: > https://github.com/microsoft/vcpkg/pull/21540 > > With that PR merged, we could specify proper location of config like > this (extracted from custom triplet): > >

Re: [Openvpn-devel] [PATCH] Use network address for emulated DHCP server as a default

2021-11-12 Thread Selva Nair
> > How about we apply my original patch (0 for /28 and -1 for the rest) > to 2.5 and this one to master? I do not see the logic behind that. If there are any platforms where 0 (network address) is not acceptable, it's unlikely to work for /30 as well. /31 is special, /30 is not. And, based on

Re: [Openvpn-devel] [PATCH v5] [OSSL 3.0] Allow loading of non default providers

2021-11-11 Thread Selva Nair
On Thu, Nov 11, 2021 at 4:09 PM Gert Doering wrote: > > Hi, > > On Thu, Nov 11, 2021 at 08:20:51PM +0100, Arne Schwabe wrote: > > diff --git a/src/openvpn/options.c b/src/openvpn/options.c > > index b5d65d293..b1f9473dc 100644 > > --- a/src/openvpn/options.c > > +++ b/src/openvpn/options.c > > @@

Re: [Openvpn-devel] Summary of the community meeting (10th November 2021)

2021-11-11 Thread Selva Nair
Quoting from meeting log: > (15:50:52) cron2: and the ERR_BUF_SIZE (21/21) is missing as well... This is not really a missing piece in the OpenSSl 3.0/deprecation patch set as the buffer size increase is not a necessity yet. The need for a larger buffer arises when we start sending undigested

Re: [Openvpn-devel] [PATCH v5] [OSSL 3.0] Allow loading of non default providers

2021-11-11 Thread Selva Nair
quot;; > } > } > +else if (streq(p[0], "providers") && p[1]) > +{ > +for (size_t j = 1; j < MAX_PARMS && p[j] != NULL;j++) > +{ > +options->providers.names[j] = p[j]; > +} > +} >

Re: [Openvpn-devel] [PATCH v4] [OSSL 3.0] Allow loading of non default providers

2021-11-11 Thread Selva Nair
Hi, Looks good except for some documentation errors and some nits On Thu, Nov 11, 2021 at 8:01 AM Arne Schwabe wrote: > This allows OpenVPN to load non-default providers. This is mainly > useful for loading the legacy provider with --provider legacy default > > Patch v4: use spaces to seperate

Re: [Openvpn-devel] [PATCH] Use network address for emulated DHCP server as a default

2021-11-11 Thread Selva Nair
Hi On Thu, Nov 11, 2021 at 4:41 AM Lev Stipakov wrote: > From: Lev Stipakov > > This is the rebase of original Selva Nair's patch > which hasn't been merged: > > https://sourceforge.net/p/openvpn/mailman/message/34674818/ Yes, something I wanted 5 years ago > > and documentation change

Re: [Openvpn-devel] [PATCH] tun: improve DHCP server address calculation for small subnets

2021-11-10 Thread Selva Nair
Hi, On Wed, Nov 10, 2021 at 6:01 AM Lev Stipakov wrote: > From: Lev Stipakov > > When /30 subnet is pushed (like in the case of OpenVPN Cloud), > DHCP server address is calculated to be the same as local address, > which causes collision and therefore connection is not established. > > To fix

Re: [Openvpn-devel] OpenSSL build on Windows: OPENSSLDIR and MODULESDIR

2021-11-10 Thread Selva Nair
Hi, On Sun, Nov 7, 2021 at 9:14 AM Lev Stipakov wrote: > Hi, > > We agreed during the hackathon that we are going to ship a 2.6 Windows > client with OpenSSL 3.0. Apart from merging relevant patches, there > are few (small) blocks: > > - vcpkg hasn't yet added OpenSSL 3.0 to official repo, but

Re: [Openvpn-devel] [PATCH v4] Refactor early initialisation and uninitialisation into methods

2021-11-05 Thread Selva Nair
Hi On Fri, Nov 5, 2021 at 12:14 PM Arne Schwabe wrote: > This put the early initialisation and uninitialisation that needs to > happen between option parsing and post processing into small methods. > > Signed-off-by: Arne Schwabe > --- > src/openvpn/openvpn.c | 23 ++- > 1

Re: [Openvpn-devel] [PATCH 0/9] A built-in OpenSSL3.0 provider for external-keys

2021-11-01 Thread Selva Nair
rs, Selva On Tue, Oct 5, 2021 at 12:39 PM Selva Nair wrote: > Hi > > Here is an update on this patch set to keep all in the loop. > > Arne discovered that my patch broke ECDH key exchange in some cases. This > turns out to be due to the way providers are handled in OpenSSL esp

<    1   2   3   4   5   6   7   8   9   10   >