Attention is currently required from: Arne Schwabe.

Hello Arne Schwabe,

I'd like you to do a code review.
Please visit

    https://gerrit.openvpn.net/c/openvpn/+/2078?usp=email

to review the following change.


Change subject: crypto: Wipe the struct key_parameters copies after use
......................................................................

crypto: Wipe the struct key_parameters copies after use

init_key_ctx_bi() and tls_crypt_v2_init_server_key() convert the key
into a struct key_parameters on the stack and return without clearing
it. init_key_ctx_bi() sets up the data channel keys (when epoch keys
are not used), tls-auth, tls-crypt and static keys, so the cipher and
HMAC keys stay on the stack after every key setup.
epoch_init_send_key() and epoch_init_recv_key() already clear their
struct key_parameters after use; do the same in these two places.

Assisted-by: Claude Code:claude-opus-5-5
Change-Id: Ic4243377c96a3b460d69050386cddcb30535de27
Signed-off-by: Hansaem Wi <[email protected]>
---
M src/openvpn/crypto.c
M src/openvpn/tls_crypt.c
2 files changed, 4 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/78/2078/1

diff --git a/src/openvpn/crypto.c b/src/openvpn/crypto.c
index 3d3ab0c..a5d4a38 100644
--- a/src/openvpn/crypto.c
+++ b/src/openvpn/crypto.c
@@ -1075,6 +1075,9 @@
     init_key_bi_ctx_send(&ctx->encrypt, &send_key, kt, name);
     init_key_bi_ctx_recv(&ctx->decrypt, &recv_key, kt, name);
     ctx->initialized = true;
+
+    secure_memzero(&send_key, sizeof(send_key));
+    secure_memzero(&recv_key, sizeof(recv_key));
 }

 void
diff --git a/src/openvpn/tls_crypt.c b/src/openvpn/tls_crypt.c
index 23c7975..1ac25ce 100644
--- a/src/openvpn/tls_crypt.c
+++ b/src/openvpn/tls_crypt.c
@@ -359,6 +359,7 @@

     init_key_ctx(key_ctx, &srv_key_params, &kt, encrypt, "tls-crypt-v2 server 
key");
     secure_memzero(&srv_key, sizeof(srv_key));
+    secure_memzero(&srv_key_params, sizeof(srv_key_params));
 }

 static bool

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

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic4243377c96a3b460d69050386cddcb30535de27
Gerrit-Change-Number: 2078
Gerrit-PatchSet: 1
Gerrit-Owner: Hansaem Wi <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to