forked from aniani/vim
updated for version 7.4.509
Problem: Users are not aware their encryption is weak. Solution: Give a warning when prompting for the key.
This commit is contained in:
20
src/crypt.c
20
src/crypt.c
@@ -503,6 +503,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.
|
* Ask the user for a crypt key.
|
||||||
* When "store" is TRUE, the new key is stored in the 'key' option, and the
|
* When "store" is TRUE, the new key is stored in the 'key' option, and the
|
||||||
|
@@ -11524,6 +11524,7 @@ ex_match(eap)
|
|||||||
ex_X(eap)
|
ex_X(eap)
|
||||||
exarg_T *eap UNUSED;
|
exarg_T *eap UNUSED;
|
||||||
{
|
{
|
||||||
|
crypt_check_current_method();
|
||||||
(void)crypt_get_key(TRUE, TRUE);
|
(void)crypt_get_key(TRUE, TRUE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2958,6 +2958,7 @@ check_for_cryptkey(cryptkey, ptr, sizep, filesizep, newfile, fname, did_ask)
|
|||||||
* Happens when retrying to detect encoding. */
|
* Happens when retrying to detect encoding. */
|
||||||
smsg((char_u *)_(need_key_msg), fname);
|
smsg((char_u *)_(need_key_msg), fname);
|
||||||
msg_scroll = TRUE;
|
msg_scroll = TRUE;
|
||||||
|
crypt_check_method(method);
|
||||||
cryptkey = crypt_get_key(newfile, FALSE);
|
cryptkey = crypt_get_key(newfile, FALSE);
|
||||||
*did_ask = TRUE;
|
*did_ask = TRUE;
|
||||||
|
|
||||||
|
@@ -854,6 +854,7 @@ vim_main2(int argc UNUSED, char **argv UNUSED)
|
|||||||
#ifdef FEAT_CRYPT
|
#ifdef FEAT_CRYPT
|
||||||
if (params.ask_for_key)
|
if (params.ask_for_key)
|
||||||
{
|
{
|
||||||
|
crypt_check_current_method();
|
||||||
(void)crypt_get_key(TRUE, TRUE);
|
(void)crypt_get_key(TRUE, TRUE);
|
||||||
TIME_MSG("getting crypt key");
|
TIME_MSG("getting crypt key");
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,8 @@ void crypt_decode __ARGS((cryptstate_T *state, char_u *from, size_t len, char_u
|
|||||||
void crypt_encode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len));
|
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_decode_inplace __ARGS((cryptstate_T *state, char_u *buf, size_t len));
|
||||||
void crypt_free_key __ARGS((char_u *key));
|
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));
|
char_u *crypt_get_key __ARGS((int store, int twice));
|
||||||
void crypt_append_msg __ARGS((buf_T *buf));
|
void crypt_append_msg __ARGS((buf_T *buf));
|
||||||
/* vim: set ft=c : */
|
/* vim: set ft=c : */
|
||||||
|
@@ -741,6 +741,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
509,
|
||||||
/**/
|
/**/
|
||||||
508,
|
508,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user