From: "plaisthos (Code Review)" Date: Mon, 15 Sep 2025 17:39:08 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <625d97ea2d056fa0d24ef17d8ab3526fed324a2a-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="SkVY+yGY4bI="; charset=UTF-8 Subject: [Openvpn-devel] [XS] 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: flichtenheld Cc: openvpn-devel --SkVY+yGY4bI= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1190?usp=3Demail to review the following change. 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 --- M src/openvpn/crypto.c M src/openvpn/crypto.h 2 files changed, 5 insertions(+), 2 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/90/1190/1 diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c index 4c0f684..873fda5 100644 --- a/src/openvpn/crypto.c +++ b/src/openvpn/crypto.c @@ -97,6 +97,9 @@ /* 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 overstepping = it by a few + * extra block in by one extra write, is not affecting the sec= urity margin, + * next iteration/call to epoch_check_send_iterate will iterat= e 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 efd7f60..0f0db13 100644 --- a/src/openvpn/crypto.h +++ b/src/openvpn/crypto.h @@ -298,7 +298,7 @@ /** 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 +309,7 @@ /** 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 Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I34e6b680618a52003d8408852d415c8aeac01feb Gerrit-Change-Number: 1190 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld Gerrit-MessageType: newchange --SkVY+yGY4bI= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

V= iew Change

Clarify some code in epoch with better comments

Chang= e-Id: I34e6b680618a52003d8408852d415c8aeac01feb
Signed-off-by: Arne Schw= abe <arne@...1227...>
---
M src/openvpn/crypto.c
M src/openv= pn/crypto.h
2 files changed, 5 insertions(+), 2 deletions(-)

g=
it pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/90/1190/1
=
diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 4c0f684..873fda5 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -97,6 +97,9 @@=
/* 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 overstepping it= by a few
+ = * extra block in by one extra write, is not affecting the security margi= n,
+ * ne= xt 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/s= rc/openvpn/crypto.h
index efd7f60..0f0db13 100644--- a/src/openvpn/crypto.h
+++ b/src/openvpn/crypto.= h
@@ -298,7 +298,7 @@

= /** last epoch_key used for generation of the current send data keys.
* As invariant, the epoch of epoch_key_send is always ke= pt >=3D the epoch of
- * epoch_key_recv */
+ * key_ctx_bi.decrypt.epoch */
struct epoc= h_key epoch_key_send;

/** epoch_key = used for the highest receive epoch keys */
@@ -309,7 +309,7= @@

/** The limit for AEAD cipher, t= his 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<= br>

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

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34e6b680618a52003d8408852d4= 15c8aeac01feb
Gerrit-Change-Number: 1190
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
Gerrit-MessageType: newchange
--SkVY+yGY4bI=--