All of lore.kernel.org
 help / color / mirror / Atom feed
* [Openvpn-devel] [PATCH 1/2] In auth-pam plugin clear the password after use
@ 2017-05-05 18:24 selva.nair
  2017-05-05 18:24 ` [Openvpn-devel] [PATCH 2/2] Parse static challenge response in auth-pam plugin selva.nair
                   ` (2 more replies)
  0 siblings, 3 replies; 35+ messages in thread
From: selva.nair @ 2017-05-05 18:24 UTC (permalink / raw)
  To: openvpn-devel

From: Selva Nair <selva.nair@...277...>

This adds a minimal secure_memzero()

Signed-off-by: Selva Nair <selva.nair@...277...>
---
 src/plugins/auth-pam/auth-pam.c |  2 ++
 src/plugins/auth-pam/utils.h    | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/src/plugins/auth-pam/auth-pam.c b/src/plugins/auth-pam/auth-pam.c
index d3e2c89..10622fd 100644
--- a/src/plugins/auth-pam/auth-pam.c
+++ b/src/plugins/auth-pam/auth-pam.c
@@ -799,8 +799,10 @@ pam_server(int fd, const char *service, int verb, const struct name_value_list *
                         command);
                 goto done;
         }
+        secure_memzero(up.password, sizeof(up.password));
     }
 done:
+    secure_memzero(up.password, sizeof(up.password));
 
 #ifdef USE_PAM_DLOPEN
     dlclose_pam();
diff --git a/src/plugins/auth-pam/utils.h b/src/plugins/auth-pam/utils.h
index fbc9705..c1fa3ee 100644
--- a/src/plugins/auth-pam/utils.h
+++ b/src/plugins/auth-pam/utils.h
@@ -63,4 +63,20 @@ get_env(const char *name, const char *envp[]);
 int
 string_array_len(const char *array[]);
 
+/**
+ * Securely zero memory without letting optimized away by the compiler
+ *
+ * @param data  Pointer to data to fill with zero
+ * @param len   Length of data, in bytes.
+ */
+inline void
+secure_memzero(void *data, size_t len)
+{
+    volatile char *p = (volatile char *) data;
+    while (len--)
+    {
+        *p++ = 0;
+    }
+}
+
 #endif
-- 
2.1.4



^ permalink raw reply related	[flat|nested] 35+ messages in thread

end of thread, other threads:[~2020-05-07 11:55 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-05 18:24 [Openvpn-devel] [PATCH 1/2] In auth-pam plugin clear the password after use selva.nair
2017-05-05 18:24 ` [Openvpn-devel] [PATCH 2/2] Parse static challenge response in auth-pam plugin selva.nair
2017-06-12 18:14   ` Gert Doering
2017-06-12 18:27     ` David Sommerseth
2017-06-12 18:28     ` Selva Nair
2017-06-27 15:04       ` Selva Nair
2018-01-24 22:37   ` [Openvpn-devel] [PATCH] " selva.nair
2018-07-25  2:34     ` [Openvpn-devel] [PATCH v3] " selva.nair
2018-07-25 21:31       ` Joe Bell
2018-07-25 21:43         ` Gert Doering
2018-07-25 22:33           ` Joe Bell
2018-07-29 19:34       ` Gert Doering
2018-07-29 20:16         ` Selva Nair
2018-07-30 14:31           ` Antonio Quartulli
2018-07-30 14:58             ` Selva Nair
2018-07-31  7:07               ` David Sommerseth
2018-07-31 14:07                 ` Selva Nair
2018-08-07 18:59       ` Gert Doering
2018-08-07 19:07         ` Gert Doering
2018-08-07 19:38           ` Selva Nair
2018-08-07 20:33             ` Selva Nair
2018-08-07 21:01             ` Gert Doering
2018-08-08  3:16               ` Selva Nair
2018-08-07 19:15         ` Selva Nair
2018-08-07 19:01       ` [Openvpn-devel] [PATCH applied] " Gert Doering
2020-04-23 14:02         ` Selva Nair
2020-05-07 11:55           ` Gert Doering
2017-05-05 18:28 ` [Openvpn-devel] [PATCH 1/2] In auth-pam plugin clear the password after use Gert Doering
2017-05-05 19:01   ` David Sommerseth
2017-05-05 19:45     ` Selva Nair
2017-05-09 14:52 ` [Openvpn-devel] [PATCH 1/2 v2] " selva.nair
2017-05-09 17:34   ` David Sommerseth
2017-05-09 18:00     ` Selva Nair
2017-05-09 19:44   ` [Openvpn-devel] [PATCH 1/2 v3] " selva.nair
2017-05-09 20:04     ` [Openvpn-devel] [PATCH applied] " David Sommerseth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.