From: "ralf_lici (Code Review)" Date: Mon, 19 Jan 2026 18:40:06 +0000 References: Reply-To: ralf@...2726..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="DLXaMhTxesc="; charset=UTF-8 Subject: [Openvpn-devel] [XS] Change in openvpn[master]: tls_multi_process: promote lame duck key to primary after reneg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --DLXaMhTxesc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: plaisthos. Hello plaisthos, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1478?usp=3Demail to review the following change. Change subject: tls_multi_process: promote lame duck key to primary after r= eneg ...................................................................... tls_multi_process: promote lame duck key to primary after reneg When a key is negotiated, the transition window logic imposes a delay before fully adopting the new key. The auth_deferred_expire field indicates the interval we must wait before considering the key fully usable (see tls_select_encryption_key). However, in an unfortunate scenario where the remote peer uses a reneg-sec interval lower than our handshake window or lower than half of our reneg-sec interval, we end up initializing every key with an auth_deferred_expire value that never expires. This leads to selecting the wrong key when invoking tls_select_encryption_key. To ensure we always have a fully valid key, whenever a renegotiation happens, promote the old key even if its auth_deferred_expire has not yet expired. Change-Id: I704c560fa23c03237d0f8adc30908a617265a5a1 --- M src/openvpn/ssl.c 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/78/1478/1 diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 69d0e4e..6a28b64 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -3310,6 +3310,11 @@ ks->state =3D S_ERROR_PRE; } + /* make the lame duck key the primary one while we transition = to + * the new one */ + struct key_state *ks_lame =3D &session->key[KS_LAME_DUCK]; + ks_lame->auth_deferred_expire =3D now; + /* Update auth token on the client if needed on renegotiation * (key id !=3D0) */ if (session->key[KS_PRIMARY].key_id !=3D 0) -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1478?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I704c560fa23c03237d0f8adc30908a617265a5a1 Gerrit-Change-Number: 1478 Gerrit-PatchSet: 1 Gerrit-Owner: ralf_lici Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --DLXaMhTxesc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

ralf_lici would like plaisthos to review this change.

V= iew Change

tls_multi_process: promote lame duck key to=
 primary after reneg

When a key is negotiated, the transition window= logic imposes a delay
before fully adopting the new key. The auth_defer= red_expire field
indicates the interval we must wait before considering = the key fully
usable (see tls_select_encryption_key). However, in an unf= ortunate
scenario where the remote peer uses a reneg-sec interval lower = than our
handshake window or lower than half of our reneg-sec interval, = we end up
initializing every key with an auth_deferred_expire value that= never
expires. This leads to selecting the wrong key when invoking
t= ls_select_encryption_key.

To ensure we always have a fully valid key= , whenever a renegotiation
happens, promote the old key even if its auth= _deferred_expire has not
yet expired.

Change-Id: I704c560fa23c032= 37d0f8adc30908a617265a5a1
---
M src/openvpn/ssl.c
1 file changed, = 5 insertions(+), 0 deletions(-)

git pull ssh://g=
errit.openvpn.net:29418/openvpn refs/changes/78/1478/1
diff --git a=
/src/openvpn/ssl.c b/src/openvpn/ssl.c
index 69d0e4e..6a28b= 64 100644
--- a/src/openvpn/ssl.c
+++ b/src= /openvpn/ssl.c
@@ -3310,6 +3310,11 @@
= ks->state =3D S_ERROR_PRE;
}

+ = /* make the lame duck key the primary one while we transition to
+ * the new= one */
+ = struct key_state *ks_lame =3D &session->key[KS_LAME_DUCK];+ ks_lame->auth_= deferred_expire =3D now;
+
/* Update auth token on the client if ne= eded on renegotiation
* (key id !=3D0) */
if (session->key[KS_PRIMARY].key_id !=3D 0)

To view, visit change 1478. To unsubscribe, o= r for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I704c560fa23c03237d0f8adc309= 08a617265a5a1
Gerrit-Change-Number: 1478
Gerrit-PatchSet: 1
Gerrit-Owner: ralf_lici <ralf@...2726...>= ;
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --DLXaMhTxesc=--