diff src/crypt.c @ 6353:60659773c73b v7.4.509

updated for version 7.4.509 Problem: Users are not aware their encryption is weak. Solution: Give a warning when prompting for the key.
author Bram Moolenaar <bram@vim.org>
date Wed, 12 Nov 2014 15:15:42 +0100
parents 0242c27e40e1
children 83861277e6a3
line wrap: on
line diff
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -504,6 +504,26 @@ crypt_free_key(key)
 }
 
 /*
+ * Check the crypt method and give a warning if it's outdated.
+ */
+    void
+crypt_check_method(method)
+    int method;
+{
+    if (method < CRYPT_M_BF2)
+    {
+	msg_scroll = TRUE;
+	MSG(_("Warning: Using a weak encryption method; see :help 'cm'"));
+    }
+}
+
+    void
+crypt_check_current_method()
+{
+    crypt_check_method(crypt_get_method_nr(curbuf));
+}
+
+/*
  * Ask the user for a crypt key.
  * When "store" is TRUE, the new key is stored in the 'key' option, and the
  * 'key' option value is returned: Don't free it.