diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-06-21 06:15:46 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-06-21 06:15:46 +0200 |
commit | a8ffcbbf5d6070380e41b3d0841c3944396a27c0 (patch) | |
tree | b8608922fc9956be229912f1323b0d0a94de526c /src/sha256.c | |
parent | 191e0a2bc7cb4787e19aa1f8c6958b47e05d7882 (diff) | |
download | vim-git-a8ffcbbf5d6070380e41b3d0841c3944396a27c0.tar.gz |
Crypt the swapfile.
Diffstat (limited to 'src/sha256.c')
-rw-r--r-- | src/sha256.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/sha256.c b/src/sha256.c index c24e8b8f8..3379620f3 100644 --- a/src/sha256.c +++ b/src/sha256.c @@ -402,7 +402,8 @@ get_some_time() } /* - * set header = sha2_seed(random_data); + * Fill "header[header_len]" with random_data. + * Also "salt[salt_len]" when "salt" is not NULL. */ void sha2_seed(header, header_len, salt, salt_len) @@ -429,8 +430,9 @@ sha2_seed(header, header_len, salt, salt_len) header[i] = sha256sum[i % sizeof(sha256sum)]; /* put remaining block into salt. */ - for (i = 0; i < salt_len; i++) - salt[i] = sha256sum[(i + header_len) % sizeof(sha256sum)]; + if (salt != NULL) + for (i = 0; i < salt_len; i++) + salt[i] = sha256sum[(i + header_len) % sizeof(sha256sum)]; } #endif /* FEAT_CRYPT */ |