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/+/2206?usp=email

to review the following change.


Change subject: Wipe auth token and PEM key copies before freeing them
......................................................................

Wipe auth token and PEM key copies before freeing them

generate_auth_token() freed the previous token and its intermediate copies
without wiping them, unlike wipe_auth_token(). crypto_pem_decode() in the
mbed TLS backend freed its copy of the PEM key text the same way.

Change-Id: I9d9b658a00f95ffdcd0db9abd0d8907618925746
Signed-off-by: Razvan Cojocaru <[email protected]>
---
M src/openvpn/auth_token.c
M src/openvpn/crypto_mbedtls.c
2 files changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/06/2206/1

diff --git a/src/openvpn/auth_token.c b/src/openvpn/auth_token.c
index 261c7c2..d8e599b 100644
--- a/src/openvpn/auth_token.c
+++ b/src/openvpn/auth_token.c
@@ -271,10 +271,15 @@
     ASSERT(buf_write(&session_token, b64output, strlen(b64output)));
     ASSERT(buf_write_u8(&session_token, 0));

+    secure_memzero(b64output, strlen(b64output));
     free(b64output);

     /* free the auth-token if defined, we will replace it with a new one */
-    free(multi->auth_token);
+    if (multi->auth_token)
+    {
+        secure_memzero(multi->auth_token, strlen(multi->auth_token));
+        free(multi->auth_token);
+    }
     multi->auth_token = string_alloc((char *)BPTR(&session_token), NULL);

     dmsg(D_SHOW_KEYS, "Generated token for client: %s (%s)", 
multi->auth_token, up->username);
@@ -288,6 +293,8 @@
         multi->auth_token_initial = string_alloc(multi->auth_token, NULL);
     }

+    buf_clear(&token);
+    buf_clear(&session_token);
     gc_free(&gc);
 }

diff --git a/src/openvpn/crypto_mbedtls.c b/src/openvpn/crypto_mbedtls.c
index ceaaad4..58c1fd2 100644
--- a/src/openvpn/crypto_mbedtls.c
+++ b/src/openvpn/crypto_mbedtls.c
@@ -1150,6 +1150,7 @@
     }

     mbedtls_pem_free(&ctx);
+    buf_clear(&input);
     gc_free(&gc);
     return ret;
 }

--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2206?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: I9d9b658a00f95ffdcd0db9abd0d8907618925746
Gerrit-Change-Number: 2206
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[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
  • [Openvpn-devel] [S] Chan... Code Review

Reply via email to