Mercurial > vim
diff src/undo.c @ 24970:7e9e53a0368f v8.2.3022
patch 8.2.3022: available encryption methods are not strong enough
Commit: https://github.com/vim/vim/commit/f573c6e1ed58d46d694c802eaf5ae3662a952744
Author: Christian Brabandt <cb@256bit.org>
Date: Sun Jun 20 14:02:16 2021 +0200
patch 8.2.3022: available encryption methods are not strong enough
Problem: Available encryption methods are not strong enough.
Solution: Add initial support for xchaha20. (Christian Brabandt,
closes #8394)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 20 Jun 2021 14:15:07 +0200 |
parents | 808edde1e97d |
children | 8f2262c72178 |
line wrap: on
line diff
--- a/src/undo.c +++ b/src/undo.c @@ -963,7 +963,9 @@ undo_flush(bufinfo_T *bi) { if (bi->bi_buffer != NULL && bi->bi_state != NULL && bi->bi_used > 0) { - crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used); + // Last parameter is only used for sodium encryption and that + // explicitly disables encryption of undofiles. + crypt_encode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_used, FALSE); if (fwrite(bi->bi_buffer, bi->bi_used, (size_t)1, bi->bi_fp) != 1) return FAIL; bi->bi_used = 0; @@ -995,7 +997,9 @@ fwrite_crypt(bufinfo_T *bi, char_u *ptr, if (copy == NULL) return 0; } - crypt_encode(bi->bi_state, ptr, len, copy); + // Last parameter is only used for sodium encryption and that + // explicitly disables encryption of undofiles. + crypt_encode(bi->bi_state, ptr, len, copy, TRUE); i = fwrite(copy, len, (size_t)1, bi->bi_fp); if (copy != small_buf) vim_free(copy); @@ -1129,7 +1133,7 @@ undo_read(bufinfo_T *bi, char_u *buffer, } bi->bi_avail = n; bi->bi_used = 0; - crypt_decode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_avail); + crypt_decode_inplace(bi->bi_state, bi->bi_buffer, bi->bi_avail, FALSE); } n = size_todo; if (n > bi->bi_avail - bi->bi_used) @@ -1176,7 +1180,7 @@ read_string_decrypt(bufinfo_T *bi, int l ptr[len] = NUL; #ifdef FEAT_CRYPT if (bi->bi_state != NULL && bi->bi_buffer == NULL) - crypt_decode_inplace(bi->bi_state, ptr, len); + crypt_decode_inplace(bi->bi_state, ptr, len, FALSE); #endif } return ptr;