From: "flichtenheld (Code Review)" Date: Fri, 24 Oct 2025 16:52:49 +0000 References: Reply-To: frank@...2641..., 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="o48IpnH5sCg="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: ssl: Fix conversion warning in tls_prepend_opcode_v1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --o48IpnH5sCg= 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/+/1298?usp=3Demail 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. Change-Id: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d Signed-off-by: Frank Lichtenheld --- 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 diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index dfbbbc6..54b69ea 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -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 =3D multi->save_ks; - uint8_t op; msg(D_TLS_DEBUG, __func__); ASSERT(ks); + ASSERT(ks->key_id <=3D 1 << P_OPCODE_SHIFT); - op =3D (P_DATA_V1 << P_OPCODE_SHIFT) | ks->key_id; + uint8_t op =3D (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=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: I34584f695ddca3b3e1f2bbcb4380ac91b09c1c8d Gerrit-Change-Number: 1298 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos --o48IpnH5sCg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

V= iew Change

ssl: Fix conversion warning in tls_prepend_=
opcode_v1

Document assumption with ASSERT.

Change-Id: I34584f= 695ddca3b3e1f2bbcb4380ac91b09c1c8d
Signed-off-by: Frank Lichtenheld <= frank@...2641...>
---
M src/openvpn/ssl.c
1 file changed, 6 ins= ertions(+), 6 deletions(-)

git pull ssh://gerrit=
.openvpn.net:29418/openvpn refs/changes/98/1298/1
diff --git a/src/=
openvpn/ssl.c b/src/openvpn/ssl.c
index dfbbbc6..54b69ea 10= 0644
--- a/src/openvpn/ssl.c
+++ b/src/open= vpn/ssl.c
@@ -3974,24 +3974,24 @@
}
}

+#if defined(__GNUC__) || defined(__clang__)
+#pragma GCC diagnostic pop+#endif
+
void
t= ls_prepend_opcode_v1(const struct tls_multi *multi, struct buffer *buf)
{
struct key_state *ks =3D multi->sav= e_ks;
- uint8_t op;<= /span>

msg(D_TLS_DEBUG, __func__);
ASSERT(ks);
+ ASSERT(ks->key_id <=3D 1 << P_OPCODE= _SHIFT);

- op =3D (P_DATA_V1 << P_OPCODE_SHIFT) | ks->key_id;=
+ uint8_t op =3D (P_DATA= _V1 << P_OPCODE_SHIFT) | (uint8_t)ks->key_id;
= ASSERT(buf_write_prepend(buf, &op, 1));
}
<= span>

-#if defined(__G= NUC__) || defined(__clang__)
-#pragma GCC diagnostic pop
-#endif
-
void
tls_prepend_opcode_v2(const struct tls= _multi *multi, struct buffer *buf)
{

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

=
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I34584f695ddca3b3e1f2bbcb438= 0ac91b09c1c8d
Gerrit-Change-Number: 1298
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
= --o48IpnH5sCg=--