| To: vim_dev@googlegroups.com |
| Subject: Patch 7.4.509 |
| Fcc: outbox |
| From: Bram Moolenaar <Bram@moolenaar.net> |
| Mime-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| |
| Patch 7.4.509 |
| Problem: Users are not aware their encryption is weak. |
| Solution: Give a warning when prompting for the key. |
| Files: src/crypt.c, src/ex_docmd.c, src/fileio.c, src/main.c, |
| src/proto/crypt.pro |
| |
| |
| |
| |
| |
| *** 504,509 **** |
| --- 504,529 ---- |
| } |
| |
| /* |
| + * 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. |
| |
| |
| |
| *** 11524,11529 **** |
| --- 11524,11530 ---- |
| ex_X(eap) |
| exarg_T *eap UNUSED; |
| { |
| + crypt_check_current_method(); |
| (void)crypt_get_key(TRUE, TRUE); |
| } |
| #endif |
| |
| |
| |
| *** 2958,2963 **** |
| --- 2958,2964 ---- |
| * Happens when retrying to detect encoding. */ |
| smsg((char_u *)_(need_key_msg), fname); |
| msg_scroll = TRUE; |
| + crypt_check_method(method); |
| cryptkey = crypt_get_key(newfile, FALSE); |
| *did_ask = TRUE; |
| |
| |
| |
| |
| *** 854,859 **** |
| --- 854,860 ---- |
| #ifdef FEAT_CRYPT |
| if (params.ask_for_key) |
| { |
| + crypt_check_current_method(); |
| (void)crypt_get_key(TRUE, TRUE); |
| TIME_MSG("getting crypt key"); |
| } |
| |
| |
| |
| *** 19,24 **** |
| --- 19,26 ---- |
| void crypt_encode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len)); |
| void crypt_decode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len)); |
| void crypt_free_key __ARGS((char_u *key)); |
| + void crypt_check_method __ARGS((int method)); |
| + void crypt_check_current_method __ARGS((void)); |
| char_u *crypt_get_key __ARGS((int store, int twice)); |
| void crypt_append_msg __ARGS((buf_T *buf)); |
| /* vim: set ft=c : */ |
| |
| |
| |
| *** 743,744 **** |
| --- 743,746 ---- |
| { /* Add new patch number below this line */ |
| + /**/ |
| + 509, |
| /**/ |
| |
| -- |
| Q: How do you tell the difference between a female cat and a male cat? |
| A: You ask it a question and if HE answers, it's a male but, if SHE |
| answers, it's a female. |
| |
| /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ |
| /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ |
| \\\ an exciting new programming language -- http://www.Zimbu.org /// |
| \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |