0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

Change 'cryptmethod' from a number to a string option. Make it global-local.

This commit is contained in:
Bram Moolenaar
2010-07-20 17:32:38 +02:00
parent c7040a5615
commit 49771f4fb0
14 changed files with 176 additions and 82 deletions

View File

@@ -441,7 +441,7 @@ ml_set_b0_crypt(buf, b0p)
b0p->b0_id[1] = BLOCK0_ID1;
else
{
if (buf->b_p_cm == 0)
if (get_crypt_method(buf) == 0)
b0p->b0_id[1] = BLOCK0_ID1_C0;
else
{
@@ -458,8 +458,8 @@ ml_set_b0_crypt(buf, b0p)
* Will apply this to the swapfile.
* "old_key" is the previous key. It is equal to buf->b_p_key when
* 'cryptmethod' is changed.
* "old_cm" is the previous 'cryptmethod'. It is equal to buf->b_p_cm when
* 'key' is changed.
* "old_cm" is the previous 'cryptmethod'. It is equal to the current
* 'cryptmethod' when 'key' is changed.
*/
void
ml_set_crypt_key(buf, old_key, old_cm)
@@ -1250,12 +1250,13 @@ ml_recover()
#ifdef FEAT_CRYPT
if (b0p->b0_id[1] == BLOCK0_ID1_C0)
buf->b_p_cm = b0_cm = 0;
b0_cm = 0;
else if (b0p->b0_id[1] == BLOCK0_ID1_C1)
{
buf->b_p_cm = b0_cm = 1;
b0_cm = 1;
mch_memmove(mfp->mf_seed, &b0p->b0_seed, MF_SEED_LEN);
}
set_crypt_method(buf, b0_cm);
#else
if (b0p->b0_id[1] != BLOCK0_ID1)
{
@@ -4908,7 +4909,7 @@ ml_crypt_prepare(mfp, offset, reading)
}
else
{
method = buf->b_p_cm;
method = get_crypt_method(buf);
key = buf->b_p_key;
seed = mfp->mf_seed;
}