comparison src/crypt.c @ 32677:4091ae33b9ec v9.0.1669

patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt Commit: https://github.com/vim/vim/commit/19e6c4fd2d262075d39cb802ea5b85f5ec92f153 Author: Christian Brabandt <cb@256bit.org> Date: Tue Jun 27 18:57:10 2023 +0100 patch 9.0.1669: Crash syncing swapfile in new buffer when using sodium crypt Problem: Crash syncing swapfile in new buffer when using sodium crypt. (James McCoy) Solution: Add checks for sodium encryption. (Christian Brabandt, closes #12591, closes #12585)
author Bram Moolenaar <Bram@vim.org>
date Tue, 27 Jun 2023 20:00:04 +0200
parents 695b50472e85
children 185f2a160d5d
comparison
equal deleted inserted replaced
32676:1873e1b4b13c 32677:4091ae33b9ec
1265 return -1; 1265 return -1;
1266 # endif 1266 # endif
1267 } 1267 }
1268 1268
1269 # if defined(FEAT_SODIUM) || defined(PROTO) 1269 # if defined(FEAT_SODIUM) || defined(PROTO)
1270 void
1271 crypt_sodium_lock_key(char_u *key)
1272 {
1273 if (sodium_init() >= 0)
1274 sodium_mlock(key, STRLEN(key));
1275 }
1276
1270 int 1277 int
1271 crypt_sodium_munlock(void *const addr, const size_t len) 1278 crypt_sodium_munlock(void *const addr, const size_t len)
1272 { 1279 {
1273 return sodium_munlock(addr, len); 1280 return sodium_munlock(addr, len);
1274 } 1281 }