From: "cron2 (Code Review)" Date: Thu, 4 Dec 2025 13:23:57 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641..., antonio@...2726... Message-ID: <48b6d634ed33d7c86edf88b069a9ff65f6276302-EmailReplacePatchSet-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="XfSQt/JvD5s="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: Clarify some code in epoch with better comments List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos , flichtenheld Cc: openvpn-devel --XfSQt/JvD5s= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has uploaded a new patch set (#3) to the change originally created by= plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/1190?usp=3Demail ) The following approvals got outdated and were removed: Code-Review+2 by flichtenheld, Code-Review-1 by ordex Change subject: Clarify some code in epoch with better comments ...................................................................... Clarify some code in epoch with better comments Change-Id: I34e6b680618a52003d8408852d415c8aeac01feb Signed-off-by: Arne Schwabe Acked-by: Frank Lichtenheld Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1190 Message-Id: <20251203125741.29239-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 829.html Signed-off-by: Gert Doering --- M src/openvpn/crypto.c M src/openvpn/crypto.h 2 files changed, 11 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/90/1190/3 diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 8049b3a..e43bc6c 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -97,6 +97,13 @@ /* IV starts with packet id to make the IV unique for packet */ if (use_epoch_data_format) { + /* Note this does not check aead_usage_limit but can overstep = it by + * a few extra blocks in one extra write. This is not affectin= g the + * security margin as these extra blocks are on a completely + * different order of magnitude than the security margin. + * The next iteration/call to epoch_check_send_iterate will + * iterate the epoch + */ if (!packet_id_write_epoch(&opt->packet_id.send, ctx->epoch, &= iv_buffer)) { msg(D_CRYPT_ERRORS, "ENCRYPT ERROR: packet ID roll over"); diff --git a/src/openvpn/crypto.h b/src/openvpn/crypto.h index 72c6821..9424fd7 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -298,7 +298,8 @@ /** last epoch_key used for generation of the current send data keys. * As invariant, the epoch of epoch_key_send is always kept >=3D the e= poch of - * epoch_key_recv */ + * key_ctx_bi.decrypt.epoch + */ struct epoch_key epoch_key_send; /** epoch_key used for the highest receive epoch keys */ @@ -309,7 +310,8 @@ /** The limit for AEAD cipher, this is the sum of packets + blocks * that are allowed to be used. Will switch to a new epoch if this - * limit is reached*/ + * limit is reached. + */ uint64_t aead_usage_limit; /** Keeps the future epoch data keys for decryption. The current one -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1190?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: newpatchset Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I34e6b680618a52003d8408852d415c8aeac01feb Gerrit-Change-Number: 1190 Gerrit-PatchSet: 3 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-Reviewer: ordex Gerrit-CC: openvpn-devel --XfSQt/JvD5s= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 upl= oaded patch set #3 to the change originally created by plaisthos.<= /p>

Vi= ew Change

The following approvals got outdated and were removed: Code-Review+2 by flichtenheld, Code-Review-1 by ordex

Clar=
ify some code in epoch with better comments

Change-Id: I34e6b680618a= 52003d8408852d415c8aeac01feb
Signed-off-by: Arne Schwabe <arne@...2068...= 7...>
Acked-by: Frank Lichtenheld <frank@...2641...>
Gerrit = URL: https://gerrit.openvpn.net/c/openvpn/+/1190
Message-Id: <2025120= 3125741.29239-1-gert@...1296...>
URL: https://www.mail-archive.com/op= envpn-devel@lists.sourceforge.net/msg34829.html
Signed-off-by: Gert Doer= ing <gert@...1296...>
---
M src/openvpn/crypto.c
M src/openv= pn/crypto.h
2 files changed, 11 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/chang=
es/90/1190/3
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto=
.c
index 8049b3a..e43bc6c 100644
--- a/src/= openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -97,6 +97,13 @@
/* IV starts with packet id to= make the IV unique for packet */
if (use_epoch_da= ta_format)
{
+ /* Note this does not check aead_usage_limit = but can overstep it by
+ = * security margin as these extra blocks are on a completely
+ * different order of = magnitude than the security margin.
+ * The next iteration/call to epoch_check_send_= iterate will
+ = * iterate the epoch
+ */
if (!packet_id_write_epo= ch(&opt->packet_id.send, ctx->epoch, &iv_buffer))
<= span> {
msg(D_CRYPT_ERRORS, &q= uot;ENCRYPT ERROR: packet ID roll over");
diff --git a= /src/openvpn/crypto.h b/src/openvpn/crypto.h
index 72c6821.= .9424fd7 100644
--- a/src/openvpn/crypto.h
= +++ b/src/openvpn/crypto.h
@@ -298,7 +298,8 @@

/** last epoch_key used for generation of the cu= rrent send data keys.
* As invariant, the epoch of ep= och_key_send is always kept >=3D the epoch of
- * epoch_key_recv */
+ * key_ctx_bi.decrypt.epoch+ */
= struct epoch_key epoch_key_send;

/**= epoch_key used for the highest receive epoch keys */
@@ -3= 09,7 +310,8 @@

/** The limit for AEA= D cipher, this is the sum of packets + blocks
* that = are allowed to be used. Will switch to a new epoch if this
- * limit is reached*/
+ * limit is reached.<= br>+ */
= uint64_t aead_usage_limit;

/** Kee= ps the future epoch data keys for decryption. The current one

To view, visit change 1190. To unsubscribe, or for help = writing mail filters, visit settings.

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34e6b680618a52003d8408852d4= 15c8aeac01feb
Gerrit-Change-Number: 1190
Gerrit-PatchSet: 3
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-Reviewer: ordex <antonio@...2726...&= gt;
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --XfSQt/JvD5s=--