Mercurial > vim
diff src/structs.h @ 6122:18ac55444b37 v7.4.399
updated for version 7.4.399
Problem: Encryption implementation is messy. Blowfish encryption has a
weakness.
Solution: Refactor the encryption, store the state in an allocated struct
instead of using a save/restore mechanism. Introduce the
"blowfish2" method, which does not have the weakness and encrypts
the whole undo file. (largely by David Leadbeater)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 10 Aug 2014 13:38:34 +0200 |
parents | ef83b423ebf7 |
children | 54194bd6ed60 |
line wrap: on
line diff
--- a/src/structs.h +++ b/src/structs.h @@ -1251,6 +1251,24 @@ typedef struct { } syn_time_T; #endif +#ifdef FEAT_CRYPT +/* + * Structure to hold the type of encryption and the state of encryption or + * decryption. + */ +typedef struct { + int method_nr; + void *method_state; /* method-specific state information */ +} cryptstate_T; + +/* values for method_nr */ +# define CRYPT_M_ZIP 0 +# define CRYPT_M_BF 1 +# define CRYPT_M_BF2 2 +# define CRYPT_M_COUNT 3 /* number of crypt methods */ +#endif + + /* * These are items normally related to a buffer. But when using ":ownsyntax" * a window may have its own instance. @@ -1778,7 +1796,12 @@ struct file_buffer int b_was_netbeans_file;/* TRUE if b_netbeans_file was once set */ #endif -}; +#ifdef FEAT_CRYPT + cryptstate_T *b_cryptstate; /* Encryption state while reading or writing + * the file. NULL when not using encryption. */ +#endif + +}; /* file_buffer */ #ifdef FEAT_DIFF