Mercurial > vim
comparison src/testdir/test_crypt.vim @ 32503:5d07e7e9580f v9.0.1583
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
Commit: https://github.com/vim/vim/commit/3a2a60ce4a8e73594bca16814672fcc243d093ac
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 27 18:02:55 2023 +0100
patch 9.0.1583: get E304 when using 'cryptmethod' "xchacha20v2"
Problem: Get E304 when using 'cryptmethod' "xchacha20v2". (Steve Mynott)
Solution: Add 4th crypt method to block zero ID check. Avoid syncing a swap
file before reading the file. (closes #12433)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 27 May 2023 19:15:04 +0200 |
parents | 6761c71f4b25 |
children | 448aef880252 |
comparison
equal
deleted
inserted
replaced
32502:b1bb97d879b6 | 32503:5d07e7e9580f |
---|---|
1 " Tests for encryption. | 1 " Tests for encryption. |
2 | 2 |
3 source shared.vim | |
3 source check.vim | 4 source check.vim |
4 CheckFeature cryptv | 5 CheckFeature cryptv |
5 | 6 |
6 " Use the xxd command from: | 7 " Use the xxd command from: |
7 " 1: $XXDPROG if set and it is executable | 8 " 1: $XXDPROG if set and it is executable |
84 endfunc | 85 endfunc |
85 | 86 |
86 func Test_crypt_sodium_v2() | 87 func Test_crypt_sodium_v2() |
87 CheckFeature sodium | 88 CheckFeature sodium |
88 call Crypt_uncrypt('xchacha20v2') | 89 call Crypt_uncrypt('xchacha20v2') |
90 endfunc | |
91 | |
92 func Test_crypt_sodium_v2_startup() | |
93 CheckFeature sodium | |
94 CheckRunVimInTerminal | |
95 | |
96 let buf = RunVimInTerminal('--cmd "set cm=xchacha20v2" -x Xfoo', #{wait_for_ruler: 0, rows: 6}) | |
97 call g:TermWait(buf, g:RunningWithValgrind() ? 1000 : 50) | |
98 call term_sendkeys(buf, "foo\<CR>foo\<CR>") | |
99 call term_sendkeys(buf, "ifoo\<Esc>") | |
100 call term_sendkeys(buf, "ZZ") | |
101 call TermWait(buf) | |
102 | |
103 " Wait for Vim to write the file and exit. Then wipe out the terminal buffer. | |
104 call WaitForAssert({-> assert_equal("finished", term_getstatus(buf))}) | |
105 exe buf .. 'bwipe!' | |
106 call assert_true(filereadable('Xfoo')) | |
107 | |
108 let buf = RunVimInTerminal('--cmd "set ch=3 cm=xchacha20v2 key=foo" Xfoo', #{rows: 10}) | |
109 call g:TermWait(buf, g:RunningWithValgrind() ? 1000 : 50) | |
110 call StopVimInTerminal(buf) | |
111 | |
112 call delete('Xfoo') | |
89 endfunc | 113 endfunc |
90 | 114 |
91 func Uncrypt_stable(method, crypted_text, key, uncrypted_text) | 115 func Uncrypt_stable(method, crypted_text, key, uncrypted_text) |
92 split Xtest.txt | 116 split Xtest.txt |
93 set bin noeol key= fenc=latin1 | 117 set bin noeol key= fenc=latin1 |