Re: Patch 8.2.0762

2020-05-18 Fir de Conversatie 'Andy Wokula' via vim_dev

Am 18.05.2020 um 15:18 schrieb Bram Moolenaar:

Am 15.05.2020 um 22:31 schrieb Bram Moolenaar:

Patch 8.2.0762
Problem:Buffer is not considered modified after setting crypt key.
Solution:   Set the modified flag. (Christian Brabandt, closes #6082)
Files:  src/optionstr.c, src/testdir/test_crypt.vim


*** ../vim-8.2.0761/src/optionstr.c 2020-04-17 19:41:16.100078313 +0200
--- src/optionstr.c 2020-05-15 22:28:34.399878939 +0200
***
*** 1157,1164 
--- 1157,1167 

if (STRCMP(curbuf->b_p_key, oldval) != 0)
// Need to update the swapfile.
+   {
ml_set_crypt_key(curbuf, oldval,
  *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
+   changed_internal();
+   }
}


Does it really do a before-after comparison of the key?
If so ... maybe ... will this make it easier to guess a key?
Ie, just guess a key and then check 'modified'?


That only means the key is the same as before, not whether it's right or
wrong.  If someone would walk away from the keyboard then you can read
the text already, no need to guess the key, just do
":w !cat >/usr/me/public/secret.txt".
Or look at the sticky notes on the display for the password.
Yeah, encryption safety is not always related to the algorithm :-).


It just didn't seem right, but looks like the only thing to worry
about here are the sticky notes ^^

--
Andy

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/5EC2C316.6060906%40yahoo.de.


Re: Patch 8.2.0762

2020-05-18 Fir de Conversatie Bram Moolenaar


> Am 15.05.2020 um 22:31 schrieb Bram Moolenaar:
> > Patch 8.2.0762
> > Problem:Buffer is not considered modified after setting crypt key.
> > Solution:   Set the modified flag. (Christian Brabandt, closes #6082)
> > Files:  src/optionstr.c, src/testdir/test_crypt.vim
> >
> >
> > *** ../vim-8.2.0761/src/optionstr.c 2020-04-17 19:41:16.100078313 +0200
> > --- src/optionstr.c 2020-05-15 22:28:34.399878939 +0200
> > ***
> > *** 1157,1164 
> > --- 1157,1167 
> >
> > if (STRCMP(curbuf->b_p_key, oldval) != 0)
> > // Need to update the swapfile.
> > +   {
> > ml_set_crypt_key(curbuf, oldval,
> >   *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
> > +   changed_internal();
> > +   }
> >}
> 
> Does it really do a before-after comparison of the key?
> If so ... maybe ... will this make it easier to guess a key?
> Ie, just guess a key and then check 'modified'?

That only means the key is the same as before, not whether it's right or
wrong.  If someone would walk away from the keyboard then you can read
the text already, no need to guess the key, just do
":w !cat >/usr/me/public/secret.txt".
Or look at the sticky notes on the display for the password.
Yeah, encryption safety is not always related to the algorithm :-).

-- 
hundred-and-one symptoms of being an internet addict:
126. You brag to all of your friends about your date Saturday night...but
 you don't tell them it was only in a chat room.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005181318.04IDITdS027491%40masaka.moolenaar.net.


Re: Patch 8.2.0762

2020-05-18 Fir de Conversatie Christian Brabandt


On Mo, 18 Mai 2020, 'Andy Wokula' via vim_dev wrote:

> Am 15.05.2020 um 22:31 schrieb Bram Moolenaar:
> > Patch 8.2.0762
> > Problem:Buffer is not considered modified after setting crypt key.
> > Solution:   Set the modified flag. (Christian Brabandt, closes #6082)
> > Files:  src/optionstr.c, src/testdir/test_crypt.vim
> > 
> > 
> > *** ../vim-8.2.0761/src/optionstr.c 2020-04-17 19:41:16.100078313 +0200
> > --- src/optionstr.c 2020-05-15 22:28:34.399878939 +0200
> > ***
> > *** 1157,1164 
> > --- 1157,1167 
> > 
> > if (STRCMP(curbuf->b_p_key, oldval) != 0)
> > // Need to update the swapfile.
> > +   {
> > ml_set_crypt_key(curbuf, oldval,
> >   *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
> > +   changed_internal();
> > +   }
> >}
> 
> Does it really do a before-after comparison of the key?
> If so ... maybe ... will this make it easier to guess a key?
> Ie, just guess a key and then check 'modified'?
> 
> I would have expected that any :X command sets the modified flag.

It does a comparison and checks, if a new key has been entered and that 
one differs from the previous active key. If not a new key has been 
entered than the old key will be still in play. So it does not directly 
relate to guessing the key value, it assumes the buffer has been 
successfully decrypted before.

Best,
Christian
-- 

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20200518114630.GA16708%40256bit.org.


Re: Patch 8.2.0762

2020-05-18 Fir de Conversatie 'Andy Wokula' via vim_dev

Am 15.05.2020 um 22:31 schrieb Bram Moolenaar:

Patch 8.2.0762
Problem:Buffer is not considered modified after setting crypt key.
Solution:   Set the modified flag. (Christian Brabandt, closes #6082)
Files:  src/optionstr.c, src/testdir/test_crypt.vim


*** ../vim-8.2.0761/src/optionstr.c 2020-04-17 19:41:16.100078313 +0200
--- src/optionstr.c 2020-05-15 22:28:34.399878939 +0200
***
*** 1157,1164 
--- 1157,1167 

if (STRCMP(curbuf->b_p_key, oldval) != 0)
// Need to update the swapfile.
+   {
ml_set_crypt_key(curbuf, oldval,
  *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
+   changed_internal();
+   }
   }


Does it really do a before-after comparison of the key?
If so ... maybe ... will this make it easier to guess a key?
Ie, just guess a key and then check 'modified'?

I would have expected that any :X command sets the modified flag.

--
Andy

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/5EC27203.6060301%40yahoo.de.


Patch 8.2.0762

2020-05-15 Fir de Conversatie Bram Moolenaar


Patch 8.2.0762
Problem:Buffer is not considered modified after setting crypt key.
Solution:   Set the modified flag. (Christian Brabandt, closes #6082)
Files:  src/optionstr.c, src/testdir/test_crypt.vim


*** ../vim-8.2.0761/src/optionstr.c 2020-04-17 19:41:16.100078313 +0200
--- src/optionstr.c 2020-05-15 22:28:34.399878939 +0200
***
*** 1157,1164 
--- 1157,1167 
  
if (STRCMP(curbuf->b_p_key, oldval) != 0)
// Need to update the swapfile.
+   {
ml_set_crypt_key(curbuf, oldval,
  *curbuf->b_p_cm == NUL ? p_cm : curbuf->b_p_cm);
+   changed_internal();
+   }
  }
  
  else if (gvarp == _cm)
*** ../vim-8.2.0761/src/testdir/test_crypt.vim  2019-06-15 17:30:57.0 
+0200
--- src/testdir/test_crypt.vim  2020-05-15 22:30:07.107578455 +0200
***
*** 110,112 
--- 110,138 
bwipe!
  endfunc
  
+ func Test_crypt_set_key_changes_buffer()
+ 
+   new Xtest1.txt
+   call setline(1, 'nothing')
+   set cryptmethod=blowfish2
+   call feedkeys(":X\foobar\foobar\", 'xt')
+   call assert_fails(":q", "E37:")
+   w
+   set key=anotherkey
+   call assert_fails(":bw")
+   w
+   call feedkeys(":X\foobar\foobar\", 'xt')
+   call assert_fails(":bw")
+   w
+   let winnr = winnr()
+   wincmd p
+   call setwinvar(winnr, '', 'yetanotherkey')
+   wincmd p
+   call assert_fails(":bw")
+   w
+ 
+   set cryptmethod&
+   set key=
+   bwipe!
+   call delete('Xtest1.txt')
+ endfunc
*** ../vim-8.2.0761/src/version.c   2020-05-15 22:01:51.284965534 +0200
--- src/version.c   2020-05-15 22:29:40.911663367 +0200
***
*** 748,749 
--- 748,751 
  {   /* Add new patch number below this line */
+ /**/
+ 762,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
99. The hum of a cooling fan and the click of keys is comforting to you.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202005152031.04FKVB17016635%40masaka.moolenaar.net.