Ensure n = 2 is set in key2 structer in tls_crypt_v2_unwrap_client_key
PATCH 1/1 Ensure n = 2 is set in key2 structer in tls_crypt_v2_unwrap_client_key
The ASSERT in xor_key2 assumes that all methods that load a key2 struct correctly set n=2. However, tls_crypt_v2_unwrap_client_key loads a key without setting n = 2, trigerring the assert.
Closes and reported in https://github.com/OpenVPN/openvpn/issues/272
--- src/openvpn/tls_crypt.c | 1 + 1 file changed, 1 insertion(+)
src/openvpn/tls_crypt.c +1 -0
@@ -533,6 +533,7 @@ tls_crypt_v2_unwrap_client_key(struct key2 *client_key, struct buffer *metadata, }memcpy (&client_key->keys,BPTR (&plaintext),sizeof (client_key->keys));ASSERT (buf_advance (&plaintext,sizeof (client_key->keys))); + client_key->n =2 ;if (!buf_copy (metadata, &plaintext)) {
Signature · 1 line
2.37.1 (Apple Git-137.1)
Hi,
Quoted 3 lines · Arne Schwabe
The ASSERT in
xor_key2assumes that all methods that load a key2 struct correctly set n=2. However,tls_crypt_v2_unwrap_client_keyloads a key without setting n = 2, trigerring the assert.
trigerring -> triggering
Quoted 5 lines
Closes and reported in https://github.com/OpenVPN/openvpn/issues/272
Change-Id Iaeb163d83b95818e0b26faf9d25e7737dc8ecb23Signed-off-by Arne Schwabe <[email protected]...>
I can easily reproduce the issue ad verify that indeed the patch fixes it.
By checking the code I can see that we set 'n' whenever we initialize the keys member. However, this was not happening in tls_crypt_v2_unwrap_client_key() thus leading to the assert being triggered.
Quoted 16 lines
--- src/openvpn/tls_crypt.c | 1 + 1 file changed, 1 insertion(+)src/openvpn/tls_crypt.c +1
-0@@ -533,6 +533,7 @@ tls_crypt_v2_unwrap_client_key(struct key2 *client_key, struct buffer *metadata, }memcpy (&client_key->keys,BPTR (&plaintext),sizeof (client_key->keys));ASSERT (buf_advance (&plaintext,sizeof (client_key->keys))); + client_key->n =2 ;if (!buf_copy (metadata, &plaintext)) {
Signature · 1 line
Antonio Quartulli
[Openvpn-devel] [PATCH applied] Re: Ensure n = 2 is set in key2 struct in tls_crypt_v2_unwrap_client_key
In reply to Arne SchwabeTrivial enough :-) - wording fixes applied ("structer", "trigerring").
Interesting that Antonio could reproduce this while it "just works" in my test beds.
Your patch has been applied to the master and release/2.6 branch.
commit 85832307fcb41c229ccb7ba83984726757eb32f7 (master) commit ae6068842854278de70264218516b0e4fcdfc6d9 (release/2.6)
Author: Arne Schwabe Date: Thu Mar 9 13:00:31 2023 +0100
Ensure n = 2 is set in key2 struct in tls_crypt_v2_unwrap_client_key
Signed-off-by: Arne Schwabe <[email protected]...>
Acked-by: Antonio Quartulli <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg26363.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering