summaryrefslogtreecommitdiff
path: root/libsylph/masterpassword.c
diff options
context:
space:
mode:
authorSimeon Simeonov2018-04-04 13:01:37 +0200
committerSimeon Simeonov2018-04-04 13:01:37 +0200
commit62c87a837463fdf09d9e7d1a605000c21f8da060 (patch)
tree5fb0f3080a651ebe56b1d23286ae9fac57199e2a /libsylph/masterpassword.c
parentc6f80c49de727b9857d2bbd1eeaf85930612d0ce (diff)
Implement the wrapper function cleanse_buffer in masterpassword.c
Diffstat (limited to 'libsylph/masterpassword.c')
-rw-r--r--libsylph/masterpassword.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/libsylph/masterpassword.c b/libsylph/masterpassword.c
index b86f06b..2da6969 100644
--- a/libsylph/masterpassword.c
+++ b/libsylph/masterpassword.c
@@ -38,11 +38,17 @@ gchar *get_master_password(void) {
38 return master_password; 38 return master_password;
39} 39}
40 40
41void unload_master_password(void) { 41void cleanse_buffer(void *buf, size_t len) {
42
43#if USE_SSL 42#if USE_SSL
44 OPENSSL_cleanse(master_password, strlen(master_password)); 43 OPENSSL_cleanse(buf, len);
44#else
45 memset(buf, 0, len); /* better than nothing */
45#endif 46#endif
47}
48
49void unload_master_password(void) {
50
51 cleanse_buffer(master_password, strlen(master_password));
46 g_free(master_password); 52 g_free(master_password);
47 master_password = NULL; 53 master_password = NULL;
48 54