Change in openvpn[master]: dco_win: In dco_new_key, document size assumptions for the integer casts
A message that is not in the archive (sent off-list or not yet received): gerrit.1758890729000.I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258@...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/+/1221?usp=email
to review the following change.
Change subject: dco_win: In dco_new_key, document size assumptions for the integer casts
......................................................................
dco_win: In dco_new_key, document size assumptions for the integer casts
And make all casts explicit so that compiler doesn't complain.
---
M src/openvpn/dco_win.c
1 file changed, 5 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1221/1
src/openvpn/dco_win.c +5 -12
@@ -525,11 +525,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t slot, const uint8_t *encrypt_key, const uint8_t *encrypt_iv, const uint8_t *decrypt_key,
@@ -540,21 +535,23 @@const int nonce_len =8 ;size_t key_len =cipher_kt_key_size (ciphername); +ASSERT (key_len <=32 );OVPN_CRYPTO_DATA crypto_data;ZeroMemory (&crypto_data,sizeof (crypto_data)); crypto_data.CipherAlg =dco_get_cipher (ciphername); - crypto_data.KeyId = keyid; +ASSERT (keyid >0 && keyid <=UCHAR_MAX ); + crypto_data.KeyId = (unsigned char )keyid; crypto_data.PeerId = peerid; crypto_data.KeySlot = slot;CopyMemory (crypto_data.Encrypt.Key, encrypt_key, key_len); - crypto_data.Encrypt.KeyLen = (char )key_len; + crypto_data.Encrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Encrypt.NonceTail, encrypt_iv, nonce_len);CopyMemory (crypto_data.Decrypt.Key, decrypt_key, key_len); - crypto_data.Decrypt.KeyLen = (char )key_len; + crypto_data.Decrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Decrypt.NonceTail, decrypt_iv, nonce_len);ASSERT (crypto_data.CipherAlg >0 );
@@ -570,10 +567,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -int dco_del_key (dco_context_t *dco,unsigned int peerid,dco_key_slot_t slot) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1221?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: I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258
Gerrit-Change-Number: 1221
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
MaxF has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/1221?usp=email )
Change subject: dco_win: In dco_new_key, document size assumptions for the integer casts
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1221?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: I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258
Gerrit-Change-Number: 1221
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[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: Fri, 26 Sep 2025 15:29:51 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH 1/1 dco_win: In dco_new_key, document size assumptions for the integer casts
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
And make all casts explicit so that compiler doesn't complain.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1221
---
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/+/1221
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
MaxF <[email protected]...>
src/openvpn/dco_win.c +5 -12
@@ -525,11 +525,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t slot, const uint8_t *encrypt_key, const uint8_t *encrypt_iv, const uint8_t *decrypt_key,
@@ -540,21 +535,23 @@const int nonce_len =8 ;size_t key_len =cipher_kt_key_size (ciphername); +ASSERT (key_len <=32 );OVPN_CRYPTO_DATA crypto_data;ZeroMemory (&crypto_data,sizeof (crypto_data)); crypto_data.CipherAlg =dco_get_cipher (ciphername); - crypto_data.KeyId = keyid; +ASSERT (keyid >0 && keyid <=UCHAR_MAX ); + crypto_data.KeyId = (unsigned char )keyid; crypto_data.PeerId = peerid; crypto_data.KeySlot = slot;CopyMemory (crypto_data.Encrypt.Key, encrypt_key, key_len); - crypto_data.Encrypt.KeyLen = (char )key_len; + crypto_data.Encrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Encrypt.NonceTail, encrypt_iv, nonce_len);CopyMemory (crypto_data.Decrypt.Key, decrypt_key, key_len); - crypto_data.Decrypt.KeyLen = (char )key_len; + crypto_data.Decrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Decrypt.NonceTail, decrypt_iv, nonce_len);ASSERT (crypto_data.CipherAlg >0 );
@@ -570,10 +567,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -int dco_del_key (dco_context_t *dco,unsigned int peerid,dco_key_slot_t slot) {
[Openvpn-devel] [PATCH applied] Re: dco_win: In dco_new_key, document size assumptions for the integer casts
Looks reasonable... especially since there already was a (char) cast for both KeyId and KeyLen, it was just missing the right signedness...
Your patch has been applied to the master branch.
commit e77c34370dbe0f894a2a927e18eb9f50a5820954
Author: Frank Lichtenheld Date: Fri Sep 26 18:51:46 2025 +0200
dco_win: In dco_new_key, document size assumptions for the integer casts
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: MaxF <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1221
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33229.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1221?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by MaxF
Change subject: dco_win: In dco_new_key, document size assumptions for the integer casts
......................................................................
dco_win: In dco_new_key, document size assumptions for the integer casts
And make all casts explicit so that compiler doesn't complain.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1221
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33229.html
---
M src/openvpn/dco_win.c
1 file changed, 5 insertions(+), 12 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/21/1221/2
src/openvpn/dco_win.c +5 -12
@@ -525,11 +525,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t slot, const uint8_t *encrypt_key, const uint8_t *encrypt_iv, const uint8_t *decrypt_key,
@@ -540,21 +535,23 @@const int nonce_len =8 ;size_t key_len =cipher_kt_key_size (ciphername); +ASSERT (key_len <=32 );OVPN_CRYPTO_DATA crypto_data;ZeroMemory (&crypto_data,sizeof (crypto_data)); crypto_data.CipherAlg =dco_get_cipher (ciphername); - crypto_data.KeyId = keyid; +ASSERT (keyid >0 && keyid <=UCHAR_MAX ); + crypto_data.KeyId = (unsigned char )keyid; crypto_data.PeerId = peerid; crypto_data.KeySlot = slot;CopyMemory (crypto_data.Encrypt.Key, encrypt_key, key_len); - crypto_data.Encrypt.KeyLen = (char )key_len; + crypto_data.Encrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Encrypt.NonceTail, encrypt_iv, nonce_len);CopyMemory (crypto_data.Decrypt.Key, decrypt_key, key_len); - crypto_data.Decrypt.KeyLen = (char )key_len; + crypto_data.Decrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Decrypt.NonceTail, decrypt_iv, nonce_len);ASSERT (crypto_data.CipherAlg >0 );
@@ -570,10 +567,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -int dco_del_key (dco_context_t *dco,unsigned int peerid,dco_key_slot_t slot) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1221?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: I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258
Gerrit-Change-Number: 1221
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1221?usp=email )
Change subject: dco_win: In dco_new_key, document size assumptions for the integer casts
......................................................................
dco_win: In dco_new_key, document size assumptions for the integer casts
And make all casts explicit so that compiler doesn't complain.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1221
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg33229.html
---
M src/openvpn/dco_win.c
1 file changed, 5 insertions(+), 12 deletions(-)
src/openvpn/dco_win.c +5 -12
@@ -525,11 +525,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif - int dco_new_key(dco_context_t *dco, unsigned int peerid, int keyid, dco_key_slot_t slot, const uint8_t *encrypt_key, const uint8_t *encrypt_iv, const uint8_t *decrypt_key,
@@ -540,21 +535,23 @@const int nonce_len =8 ;size_t key_len =cipher_kt_key_size (ciphername); +ASSERT (key_len <=32 );OVPN_CRYPTO_DATA crypto_data;ZeroMemory (&crypto_data,sizeof (crypto_data)); crypto_data.CipherAlg =dco_get_cipher (ciphername); - crypto_data.KeyId = keyid; +ASSERT (keyid >0 && keyid <=UCHAR_MAX ); + crypto_data.KeyId = (unsigned char )keyid; crypto_data.PeerId = peerid; crypto_data.KeySlot = slot;CopyMemory (crypto_data.Encrypt.Key, encrypt_key, key_len); - crypto_data.Encrypt.KeyLen = (char )key_len; + crypto_data.Encrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Encrypt.NonceTail, encrypt_iv, nonce_len);CopyMemory (crypto_data.Decrypt.Key, decrypt_key, key_len); - crypto_data.Decrypt.KeyLen = (char )key_len; + crypto_data.Decrypt.KeyLen = (unsigned char )key_len;CopyMemory (crypto_data.Decrypt.NonceTail, decrypt_iv, nonce_len);ASSERT (crypto_data.CipherAlg >0 );
@@ -570,10 +567,6 @@return 0 ; } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -int dco_del_key (dco_context_t *dco,unsigned int peerid,dco_key_slot_t slot) {
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1221?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: I612bf3b1c56d70a89fc04fad6fe36fd9fadfd258
Gerrit-Change-Number: 1221
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: MaxF <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged