Change in openvpn[master]: ssl: Fix conversion warning in tls_prepend_opcode_v1
A message that is not in the archive (sent off-list or not yet received): gerrit.1761324750000.I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d@...2715...
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/+/1298?usp=email
to review the following change.
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
ssl: Fix conversion warning in tls_prepend_opcode_v1
Document assumption with ASSERT.
---
M src/openvpn/ssl.c
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1298/1
src/openvpn/ssl.c +6 -6
@@ -3974,24 +3974,24 @@ } } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +void tls_prepend_opcode_v1 (const struct tls_multi *multi,struct buffer *buf) {struct key_state *ks = multi->save_ks; -uint8_t op;msg (D_TLS_DEBUG , __func__);ASSERT (ks); +ASSERT (ks->key_id <=1 <<P_OPCODE_SHIFT ); - op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | ks->key_id; +uint8_t op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | (uint8_t )ks->key_id;ASSERT (buf_write_prepend (buf, &op,1 )); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void tls_prepend_opcode_v2 (const struct tls_multi *multi,struct buffer *buf) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld.
plaisthos has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email )
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
Patch Set 3: Code-Review-1
(2 comments)
Patchset:
PS3:
I think the assert is wrong.
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/1298/comment/84eda4a7_8aea915f?usp=email :
PS3, Line 3985: ASSERT(ks->key_id <= 1 << P_OPCODE_SHIFT);
Can we add brackets here? I find this a bit hard to read since the order of <= and << is not so super obvious. Brackets would make this a bit nicer to read.
I think we should probably add a define to indicate the highest key ID, something like this:
/* packet opcode (high 5 bits) and key-id (low 3 bits) are combined in one byte */ #define P_KEY_ID_MASK 0x07
#define P_OPCODE_SHIFT 3
/* We use 3 bits for the key id which makes 7 the highest key id */ #define MAXIMUM_KEY_ID 7
I think this assert is also wrong since (1 << 3) = 8 and 8 is not an allowed key id.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 3
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 11 Nov 2025 11:10:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
to look at the new patch set (#4).
The following approvals got outdated and were removed:
Code-Review-1 by plaisthos
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
ssl: Fix conversion warning in tls_prepend_opcode_v1
Document assumption with ASSERT.
---
M src/openvpn/ssl.c
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1298/4
src/openvpn/ssl.c +6 -6
@@ -3970,24 +3970,24 @@ } } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +void tls_prepend_opcode_v1 (const struct tls_multi *multi,struct buffer *buf) {struct key_state *ks = multi->save_ks; -uint8_t op;msg (D_TLS_DEBUG , __func__);ASSERT (ks); +ASSERT (ks->key_id <=P_KEY_ID_MASK ); - op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | ks->key_id; +uint8_t op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | (uint8_t )ks->key_id;ASSERT (buf_write_prepend (buf, &op,1 )); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void tls_prepend_opcode_v2 (const struct tls_multi *multi,struct buffer *buf) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email )
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
Patch Set 4:
(1 comment)
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/1298/comment/63437cc2_76f424ff?usp=email :
PS3, Line 3985: ASSERT(ks->key_id <= 1 << P_OPCODE_SHIFT);
Quoted 1 line
Can we add brackets here? I find this a bit hard to read since the order of <= and << is not so supe […]
That would be redundant with P_KEY_ID_MASK I guess, so how about just using that? Changed to that for now. But definitely right about the off-by-one.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 11 Nov 2025 14:28:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Attention is currently required from: plaisthos.
flichtenheld has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email )
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
Patch Set 4:
(1 comment)
File src/openvpn/ssl.c:
http://gerrit.openvpn.net/c/openvpn/+/1298/comment/140f43a4_4eb0794f?usp=email :
PS3, Line 3985: ASSERT(ks->key_id <= 1 << P_OPCODE_SHIFT);
Quoted 1 line
That would be redundant with
P_KEY_ID_MASKI guess, so how about just using that? Changed to that […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 11 Nov 2025 15:56:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: plaisthos <[email protected]...>
Comment-In-Reply-To: flichtenheld <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email )
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
Patch Set 4: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 4
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Sun, 16 Nov 2025 18:33:23 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH v4 1/1 ssl: Fix conversion warning in tls_prepend_opcode_v1
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Document assumption with ASSERT.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1298
---
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/+/1298
This mail reflects revision 4 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/ssl.c +6 -6
@@ -3970,24 +3970,24 @@ } } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +void tls_prepend_opcode_v1 (const struct tls_multi *multi,struct buffer *buf) {struct key_state *ks = multi->save_ks; -uint8_t op;msg (D_TLS_DEBUG , __func__);ASSERT (ks); +ASSERT (ks->key_id <=P_KEY_ID_MASK ); - op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | ks->key_id; +uint8_t op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | (uint8_t )ks->key_id;ASSERT (buf_write_prepend (buf, &op,1 )); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void tls_prepend_opcode_v2 (const struct tls_multi *multi,struct buffer *buf) {
[Openvpn-devel] [PATCH applied] Re: ssl: Fix conversion warning in tls_prepend_opcode_v1
Change makes sense. Arne has also reviewed this, and v3/v4 take the initial comments into account. Smoke tested on Linux / t_client (though I'm not sure we have tests that excercise opcode_v1).
Your patch has been applied to the master branch.
commit d926257bf4636ea43f6f5c25f5235baa25f65203
Author: Frank Lichtenheld Date: Sun Nov 16 19:33:30 2025 +0100
ssl: Fix conversion warning in tls_prepend_opcode_v1
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1298
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34480.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#5) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
ssl: Fix conversion warning in tls_prepend_opcode_v1
Document assumption with ASSERT.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1298
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34480.html
---
M src/openvpn/ssl.c
1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/98/1298/5
src/openvpn/ssl.c +6 -6
@@ -3962,24 +3962,24 @@ } } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +void tls_prepend_opcode_v1 (const struct tls_multi *multi,struct buffer *buf) {struct key_state *ks = multi->save_ks; -uint8_t op;msg (D_TLS_DEBUG , __func__);ASSERT (ks); +ASSERT (ks->key_id <=P_KEY_ID_MASK ); - op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | ks->key_id; +uint8_t op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | (uint8_t )ks->key_id;ASSERT (buf_write_prepend (buf, &op,1 )); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void tls_prepend_opcode_v2 (const struct tls_multi *multi,struct buffer *buf) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email )
Change subject: ssl: Fix conversion warning in tls_prepend_opcode_v1
......................................................................
ssl: Fix conversion warning in tls_prepend_opcode_v1
Document assumption with ASSERT.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1298
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg34480.html
---
M src/openvpn/ssl.c
1 file changed, 6 insertions(+), 6 deletions(-)
src/openvpn/ssl.c +6 -6
@@ -3962,24 +3962,24 @@ } } +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif +void tls_prepend_opcode_v1 (const struct tls_multi *multi,struct buffer *buf) {struct key_state *ks = multi->save_ks; -uint8_t op;msg (D_TLS_DEBUG , __func__);ASSERT (ks); +ASSERT (ks->key_id <=P_KEY_ID_MASK ); - op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | ks->key_id; +uint8_t op = (P_DATA_V1 <<P_OPCODE_SHIFT ) | (uint8_t )ks->key_id;ASSERT (buf_write_prepend (buf, &op,1 )); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void tls_prepend_opcode_v2 (const struct tls_multi *multi,struct buffer *buf) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1298?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 5
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>