comparison src/fileio.c @ 5651:391e10afccf6 v7.4.172

updated for version 7.4.172 Problem: The blowfish code mentions output feedback, but the code is actually doing cipher feedback. Solution: Adjust names and comments.
author Bram Moolenaar <bram@vim.org>
date Tue, 11 Feb 2014 15:23:32 +0100
parents 1cdf51706774
children 136f05449f29
comparison
equal deleted inserted replaced
5650:5b8873427318 5651:391e10afccf6
2971 if (method == 0) 2971 if (method == 0)
2972 crypt_init_keys(cryptkey); 2972 crypt_init_keys(cryptkey);
2973 else 2973 else
2974 { 2974 {
2975 bf_key_init(cryptkey, ptr + CRYPT_MAGIC_LEN, salt_len); 2975 bf_key_init(cryptkey, ptr + CRYPT_MAGIC_LEN, salt_len);
2976 bf_ofb_init(ptr + CRYPT_MAGIC_LEN + salt_len, seed_len); 2976 bf_cfb_init(ptr + CRYPT_MAGIC_LEN + salt_len, seed_len);
2977 } 2977 }
2978 2978
2979 /* Remove magic number from the text */ 2979 /* Remove magic number from the text */
2980 *filesizep += CRYPT_MAGIC_LEN + salt_len + seed_len; 2980 *filesizep += CRYPT_MAGIC_LEN + salt_len + seed_len;
2981 *sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len; 2981 *sizep -= CRYPT_MAGIC_LEN + salt_len + seed_len;
3023 int seed_len = crypt_seed_len[method]; 3023 int seed_len = crypt_seed_len[method];
3024 3024
3025 if (fread(buffer, salt_len + seed_len, 1, fp) != 1) 3025 if (fread(buffer, salt_len + seed_len, 1, fp) != 1)
3026 return FAIL; 3026 return FAIL;
3027 bf_key_init(curbuf->b_p_key, buffer, salt_len); 3027 bf_key_init(curbuf->b_p_key, buffer, salt_len);
3028 bf_ofb_init(buffer + salt_len, seed_len); 3028 bf_cfb_init(buffer + salt_len, seed_len);
3029 } 3029 }
3030 return OK; 3030 return OK;
3031 } 3031 }
3032 3032
3033 /* 3033 /*
3062 /* Using blowfish, add salt and seed. */ 3062 /* Using blowfish, add salt and seed. */
3063 salt = header + CRYPT_MAGIC_LEN; 3063 salt = header + CRYPT_MAGIC_LEN;
3064 seed = salt + salt_len; 3064 seed = salt + salt_len;
3065 sha2_seed(salt, salt_len, seed, seed_len); 3065 sha2_seed(salt, salt_len, seed, seed_len);
3066 bf_key_init(buf->b_p_key, salt, salt_len); 3066 bf_key_init(buf->b_p_key, salt, salt_len);
3067 bf_ofb_init(seed, seed_len); 3067 bf_cfb_init(seed, seed_len);
3068 } 3068 }
3069 } 3069 }
3070 *lenp = CRYPT_MAGIC_LEN + salt_len + seed_len; 3070 *lenp = CRYPT_MAGIC_LEN + salt_len + seed_len;
3071 return header; 3071 return header;
3072 } 3072 }