Skip to contentSkip to conversation

Change in openvpn[master]: dco-win: fix broken ASSERT in dco_new_key

Openvpn-devel In review stipa (Code Review) 3 participants 6 messages Sep 29, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1759135650000.I3b1243461ec9b6e85897f452f78dc4b05f7e126d@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email

to review the following change.

Change subject: dco-win: fix broken ASSERT in dco_new_key
......................................................................

dco-win: fix broken ASSERT in dco_new_key

Commit

e77c343 ("dco_win: In dco_new_key, document size assumptions for the integer casts")

has added an ASSERT on key-id, but didn't take into account that key-id 0 is a perfectly valid value and is the first key-id. This essentially broke dco-win.

Fix by adjusting ASSERT to >= 0.

Change-Id I3b1243461ec9b6e85897f452f78dc4b05f7e126d

---
M src/openvpn/dco_win.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/23/1223/1

src/openvpn/dco_win.c +1 -1
index 4dd307f..30307de 100644
@@ -541,7 +541,7 @@
     ZeroMemory(&crypto_data, sizeof(crypto_data));
 
     crypto_data.CipherAlg = dco_get_cipher(ciphername);
-    ASSERT(keyid > 0 && keyid <= UCHAR_MAX);
+    ASSERT(keyid >= 0 && keyid <= UCHAR_MAX);
     crypto_data.KeyId = (unsigned char)keyid;
     crypto_data.PeerId = peerid;
     crypto_data.KeySlot = slot;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3b1243461ec9b6e85897f452f78dc4b05f7e126d
Gerrit-Change-Number: 1223
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos, stipa.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email )

Change subject: dco-win: fix broken ASSERT in dco_new_key
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3b1243461ec9b6e85897f452f78dc4b05f7e126d
Gerrit-Change-Number: 1223
Gerrit-PatchSet: 1
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 29 Sep 2025 15:14:29 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw

PATCH 1/1 dco-win: fix broken ASSERT in dco_new_key

In reply to a message not in the archive

From: Lev Stipakov <[email protected]...>

Commit

e77c343 ("dco_win: In dco_new_key, document size assumptions for the integer casts")

has added an ASSERT on key-id, but didn't take into account that key-id 0 is a perfectly valid value and is the first key-id. This essentially broke dco-win.

Fix by adjusting ASSERT to >= 0.

Change-Id I3b1243461ec9b6e85897f452f78dc4b05f7e126d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1223
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1223
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>

src/openvpn/dco_win.c +1 -1
index 4dd307f..30307de 100644
@@ -541,7 +541,7 @@
     ZeroMemory(&crypto_data, sizeof(crypto_data));
 
     crypto_data.CipherAlg = dco_get_cipher(ciphername);
-    ASSERT(keyid > 0 && keyid <= UCHAR_MAX);
+    ASSERT(keyid >= 0 && keyid <= UCHAR_MAX);
     crypto_data.KeyId = (unsigned char)keyid;
     crypto_data.PeerId = peerid;
     crypto_data.KeySlot = slot;
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: dco-win: fix broken ASSERT in dco_new_key

The moment you notice that you have a CI infrastructure that actually caught the issue - and the notification went "somewhere"...

Your patch has been applied to the master branch.

commit 290a14cd9edf95f07940f63993c290dc045c2a44

Author: Lev Stipakov
Date:   Mon Sep 29 17:28:41 2025 +0200
     dco-win: fix broken ASSERT in dco_new_key

     Signed-off-by: Lev Stipakov <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1223
     Message-Id: <[email protected]...>
     URL: https://sourceforge.net/p/openvpn/mailman/message/59240115/
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by stipa. ( http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email )

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

Change subject: dco-win: fix broken ASSERT in dco_new_key
......................................................................

dco-win: fix broken ASSERT in dco_new_key

Commit

e77c343 ("dco_win: In dco_new_key, document size assumptions for the integer casts")

has added an ASSERT on key-id, but didn't take into account that key-id 0 is a perfectly valid value and is the first key-id. This essentially broke dco-win.

Fix by adjusting ASSERT to >= 0.

Change-Id I3b1243461ec9b6e85897f452f78dc4b05f7e126d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1223
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59240115/

---
M src/openvpn/dco_win.c

1 file changed, 1 insertion(+), 1 deletion(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/23/1223/2

src/openvpn/dco_win.c +1 -1
index 4dd307f..30307de 100644
@@ -541,7 +541,7 @@
     ZeroMemory(&crypto_data, sizeof(crypto_data));
 
     crypto_data.CipherAlg = dco_get_cipher(ciphername);
-    ASSERT(keyid > 0 && keyid <= UCHAR_MAX);
+    ASSERT(keyid >= 0 && keyid <= UCHAR_MAX);
     crypto_data.KeyId = (unsigned char)keyid;
     crypto_data.PeerId = peerid;
     crypto_data.KeySlot = slot;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3b1243461ec9b6e85897f452f78dc4b05f7e126d
Gerrit-Change-Number: 1223
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email )

Change subject: dco-win: fix broken ASSERT in dco_new_key
......................................................................

dco-win: fix broken ASSERT in dco_new_key

Commit

e77c343 ("dco_win: In dco_new_key, document size assumptions for the integer casts")

has added an ASSERT on key-id, but didn't take into account that key-id 0 is a perfectly valid value and is the first key-id. This essentially broke dco-win.

Fix by adjusting ASSERT to >= 0.

Change-Id I3b1243461ec9b6e85897f452f78dc4b05f7e126d

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1223
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59240115/

---
M src/openvpn/dco_win.c

1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/dco_win.c +1 -1
index 4dd307f..30307de 100644
@@ -541,7 +541,7 @@
     ZeroMemory(&crypto_data, sizeof(crypto_data));
 
     crypto_data.CipherAlg = dco_get_cipher(ciphername);
-    ASSERT(keyid > 0 && keyid <= UCHAR_MAX);
+    ASSERT(keyid >= 0 && keyid <= UCHAR_MAX);
     crypto_data.KeyId = (unsigned char)keyid;
     crypto_data.PeerId = peerid;
     crypto_data.KeySlot = slot;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1223?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I3b1243461ec9b6e85897f452f78dc4b05f7e126d
Gerrit-Change-Number: 1223
Gerrit-PatchSet: 2
Gerrit-Owner: stipa <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged