From: Hansaem Wi <[email protected]>

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]>
Acked-by: Steffan Karger <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2078
---

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/+/2078
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Steffan Karger <[email protected]>

        
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


_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to