]> git.ipfire.org Git - thirdparty/openvpn.git/commit
Introduce S_GENERATED_KEYS state and generate keys only when authenticated
authorArne Schwabe <arne@rfc2549.org>
Mon, 5 Jul 2021 13:34:14 +0000 (15:34 +0200)
committerGert Doering <gert@greenie.muc.de>
Wed, 14 Jul 2021 11:47:13 +0000 (13:47 +0200)
commit34b42549c980b19730a0beb03096d2dd915865c0
tree56358c4b0de870ed50128040784cadadd455d76a
parent51d85a9d287f44c373eaa514c6a52e1078c27c43
Introduce S_GENERATED_KEYS state and generate keys only when authenticated

Since generating data channel keys does not happen when we have reached
the S_ACTIVE/S_GOT_KEY state anymore like it used to be before NCP, the
state that data channel keys have been created deserves its own state in
the TLS session state machine.

The changes done by this commit are rather intrusive since they
move the key generation to a completely different place and also
rely on the state machine to decide if keys should be
generated rather than on the complicated conditions that were
implemented in the key_method_2_write/read methods.

A (intended) side effect of this change is that sessions that
are still in deferred state (ks->authenticated == KS_DEFERRED)
will not have data channel keys generated. This avoids corner
cases where a not fully authenticated sessions might leak data.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Patch v2: rebased

Patch v3: fix crash in non TLS mode

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210705133414.3102815-1-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg22617.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
src/openvpn/forward.h
src/openvpn/init.c
src/openvpn/ssl.c
src/openvpn/ssl.h
src/openvpn/ssl_common.h