Gert Doering has uploaded a new patch set (#2) to the change originally created 
by Hansaem Wi. ( https://gerrit.openvpn.net/c/openvpn/+/2079?usp=email )

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


Change subject: tls_crypt: Wipe the tls-crypt-v2 client key copies
......................................................................

tls_crypt: Wipe the tls-crypt-v2 client key copies

tls_crypt_v2_init_client_key() reads the client key into a struct key2
on the stack, copies it to *original_key and returns without clearing
it, so every client start leaves the tls-crypt-v2 client key on the
stack. crypto_read_openvpn_key() does the same copy for tls-auth and
tls-crypt keys and clears its struct key2 afterwards; do the same here.

The --genkey tls-crypt-v2-client sanity check in
tls_crypt_v2_write_client_key_file() has two more copies:
- keydata, the struct key2 that tls_crypt_v2_init_client_key() fills;
  clear it after use.
- check_wrapped_client_key, the decoded key file buffer: the client key
  is still in front of the wrapped key when it is freed. Clear it with
  buf_clear() before free_buf(), as do_close_free_key_schedule() does
  for the client's tls_crypt_v2_wkc.

Assisted-by: Claude Code:claude-opus-5-5
Change-Id: I8e02b4cf39cc431f1f2c058db95997c8907557c0
Signed-off-by: Hansaem Wi <[email protected]>
Acked-by: Steffan Karger <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2079
Message-Id: <[email protected]>
URL: 
https://www.mail-archive.com/[email protected]/msg40954.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/tls_crypt.c
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/79/2079/2

diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c
index 64db29f..d7f69f7 100644
--- a/src/openvpn/tls_crypt.c
+++ b/src/openvpn/tls_crypt.c
@@ -332,6 +332,7 @@

     tls_crypt_v2_load_client_key(key, &key2, false);
     *original_key = key2;
+    secure_memzero(&key2, sizeof(key2));

     *wkc_buf = client_key;
 }
@@ -794,6 +795,7 @@
     tls_crypt_v2_init_client_key(&check_client_key, &keydata, 
&check_wrapped_client_key, client_file,
                                  client_inline);
     free_key_ctx_bi(&check_client_key);
+    secure_memzero(&keydata, sizeof(keydata));
 
     /* Sanity check: unwrap and load client key (as "server") */
     struct buffer check_metadata = alloc_buf_gc(TLS_CRYPT_V2_MAX_METADATA_LEN, 
&gc);
@@ -804,6 +806,7 @@
     ASSERT(tls_crypt_v2_unwrap_client_key(&check_client_key2, &check_metadata,
                                           check_wrapped_client_key, 
&server_key));
     secure_memzero(&check_client_key2, sizeof(check_client_key2));
+    buf_clear(&check_wrapped_client_key);
     free_buf(&check_wrapped_client_key);

 cleanup:

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

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I8e02b4cf39cc431f1f2c058db95997c8907557c0
Gerrit-Change-Number: 2079
Gerrit-PatchSet: 2
Gerrit-Owner: Hansaem Wi <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-Reviewer: Steffan Karger <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to