+void master_passphrase_forget()
+{
+ /* If master passphrase is currently in memory (entered by user),
+ * get rid of it. User will have to enter the new one again. */
+ if (_master_passphrase != NULL) {
+ memset(_master_passphrase, 0, strlen(_master_passphrase));
+ g_free(_master_passphrase);
+ _master_passphrase = NULL;
+ }
+}
+
+void master_passphrase_change(const gchar *oldp, const gchar *newp)
+{
+ const GChecksumType hashtype = G_CHECKSUM_SHA256;
+ gchar *hash;
+
+ if (oldp == NULL) {
+ /* If oldp is NULL, make sure the user has to enter the
+ * current master passphrase before being able to change it. */
+ master_passphrase_forget();
+ oldp = master_passphrase();
+ }