Permalink
Browse files

Add the blowfish encryption patch from Mohsin Ahmed. Needs more work.

--HG--
branch : vim73
  • Loading branch information...
1 parent 1429079 commit 5287c180610f05d2046b872b7c48010db77bf180 @brammool brammool committed May 16, 2010
View
@@ -7,6 +7,7 @@ SRC_ALL = \
src/arabic.c \
src/arabic.h \
src/ascii.h \
+ src/blowfish.c \
src/buffer.c \
src/charset.c \
src/diff.c \
@@ -58,6 +59,7 @@ SRC_ALL = \
src/regexp.h \
src/screen.c \
src/search.c \
+ src/sha256.c \
src/structs.h \
src/spell.c \
src/syntax.c \
@@ -79,6 +81,7 @@ SRC_ALL = \
src/testdir/test49.vim \
src/testdir/test60.vim \
src/proto.h \
+ src/proto/blowfish.pro \
src/proto/buffer.pro \
src/proto/charset.pro \
src/proto/diff.pro \
@@ -116,6 +119,7 @@ SRC_ALL = \
src/proto/regexp.pro \
src/proto/screen.pro \
src/proto/search.pro \
+ src/proto/sha256.pro \
src/proto/spell.pro \
src/proto/syntax.pro \
src/proto/tag.pro \
View
@@ -1361,6 +1361,11 @@ the file is encrypted.
To disable the encryption, reset the 'key' option to an empty value: >
:set key=
+You can use the 'cryptmethod' option to select the type of encryption. Do
+this before writing the file. When reading an encrypted file it will be set
+automatically to the method used when that file was written. You can change
+'cryptmethod' before writing that file to change the method.
+
When reading a file that has been encrypted and this option is not empty, it
will be used for decryption. If the value is empty, you will be prompted to
enter the key. If you don't enter a key, the file is edited without being
View
@@ -2049,6 +2049,19 @@ A jump table for the options with a short description can be found at |Q_op|.
with system specific functions.
+ *'cryptmethod'* *'cm'*
+'cryptmethod' number (default 0)
+ local to buffer
+ {not in Vi}
+ Method used for encryption when the buffer is written to a file:
+ 0 PkZip compatible method. A weak kind of encryption.
+ backwards compatible with Vim 7.2 and older.
+ 1 Blowfish method. Strong encryption. Not compatible
+ with Vim 7.2 and older.
+ When reading an encrypted file 'cryptmethod' will be set automatically
+ to detected method for the file being read.
+
+
*'cscopepathcomp'* *'cspc'*
'cscopepathcomp' 'cspc' number (default 0)
global
@@ -4141,7 +4154,7 @@ A jump table for the options with a short description can be found at |Q_op|.
local to buffer
{not in Vi}
The key that is used for encrypting and decrypting the current buffer.
- See |encryption|.
+ See |encryption| and 'cryptmethod'.
Careful: Do not set the key value by hand, someone might see the typed
key. Use the |:X| command. But you can make 'key' empty: >
:set key=
View
@@ -30,6 +30,17 @@ be worked on, but only if you sponsor Vim development. See |sponsor|.
*known-bugs*
-------------------- Known bugs and current work -----------------------
+check blowfish.c
+check sha256.c
+Use 'cm' option only when FEAT_CRYPT is defined.
+When not full match with magic, check for head and give warning about
+unsupported crypt method.
+if 'enc' is ucs-2, does utf-8 to ucs-2 encoding always work for seed?
+
+Crypt update:
+- move bf_self_test() and sha256_self_test() elsewhere
+- Update E000 to error number.
+
Cursor positioning wrong with 0x200e character. (John Becket, 2010 May 6)
E315 when trying to change a file in FileChangedRO autocommand event.
@@ -1082,8 +1093,6 @@ restored. (Luc St-Louis)
Vim 7.3:
Patches to include:
-- Add patch for 'relativenumber' option? Markus Heidelberg, 2008 Jun 27.
- Update 2010 May 2.
- Add blowfish encryption. Openssl has an implementation. Also by Paul
Kocher (LGPL), close to original. Mohsin also has some ideas.
Take four bytes and turn them into unsigned to avoid byte-order problems.
View
@@ -533,6 +533,7 @@ vimwinmain = \
!endif
vimobj = \
+ $(OBJDIR)\blowfish.obj \
$(OBJDIR)\buffer.obj \
$(OBJDIR)\charset.obj \
$(OBJDIR)\diff.obj \
@@ -567,6 +568,7 @@ vimobj = \
$(OBJDIR)\regexp.obj \
$(OBJDIR)\screen.obj \
$(OBJDIR)\search.obj \
+ $(OBJDIR)\sha256.obj \
$(OBJDIR)\spell.obj \
$(OBJDIR)\syntax.obj \
$(OBJDIR)\tag.obj \
View
@@ -210,6 +210,7 @@ ALL : .\$(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvime
LINK32_OBJS= \
$(EXTRAS) \
+ "$(INTDIR)/blowfish.obj" \
"$(INTDIR)/buffer.obj" \
"$(INTDIR)/charset.obj" \
"$(INTDIR)/diff.obj" \
@@ -246,6 +247,7 @@ LINK32_OBJS= \
"$(INTDIR)/regexp.obj" \
"$(INTDIR)/screen.obj" \
"$(INTDIR)/search.obj" \
+ "$(INTDIR)/sha256.obj" \
"$(INTDIR)/spell.obj" \
"$(INTDIR)/syntax.obj" \
"$(INTDIR)/tag.obj" \
View
@@ -124,7 +124,8 @@ OBJ = obj/buffer.o \
obj/window.o \
$(TERMLIB)
-PRO = proto/buffer.pro \
+PRO = proto/blowfish.pro \
+ proto/buffer.pro \
proto/charset.pro \
proto/diff.pro \
proto/digraph.pro \
@@ -159,6 +160,7 @@ PRO = proto/buffer.pro \
proto/regexp.pro \
proto/screen.pro \
proto/search.pro \
+ proto/sha256.pro \
proto/spell.pro \
proto/syntax.pro \
proto/tag.pro \
View
@@ -453,6 +453,8 @@ INCL = vim.h os_win32.h ascii.h feature.h globals.h keymap.h macros.h \
$(NBDEBUG_INCL)
OBJ = \
+ $(OUTDIR)\blowfish.obj \
+ $(OUTDIR)\sha256.obj \
$(OUTDIR)\buffer.obj \
$(OUTDIR)\charset.obj \
$(OUTDIR)\diff.obj \
@@ -912,6 +914,10 @@ testclean:
$(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL)
+$(OUTDIR)/blowfish.obj: $(OUTDIR) blowfish.c $(INCL)
+
+$(OUTDIR)/sha256.obj: $(OUTDIR) sha256.c $(INCL)
+
$(OUTDIR)/charset.obj: $(OUTDIR) charset.c $(INCL)
$(OUTDIR)/diff.obj: $(OUTDIR) diff.c $(INCL)
@@ -1080,6 +1086,7 @@ auto:
# End Custom Build
proto.h: \
+ proto/blowfish.pro \
proto/buffer.pro \
proto/charset.pro \
proto/diff.pro \
@@ -1115,6 +1122,7 @@ proto.h: \
proto/regexp.pro \
proto/screen.pro \
proto/search.pro \
+ proto/sha256.pro \
proto/spell.pro \
proto/syntax.pro \
proto/tag.pro \
View
@@ -179,6 +179,7 @@ OBJ = \
$(TERMLIB)
PRO = \
+ proto/blowfish.pro \
proto/buffer.pro \
proto/charset.pro \
proto/diff.pro \
@@ -214,6 +215,7 @@ PRO = \
proto/regexp.pro \
proto/screen.pro \
proto/search.pro \
+ proto/sha256.pro \
proto/spell.pro \
proto/syntax.pro \
proto/tag.pro \
@@ -278,6 +280,8 @@ $(PRO): $(GST) vim.h
$(CC) $(CFLAGS) GPFILE=proto/$*.pro $(PROPT) $*.c
# dependancies
+blowfish.o: blowfish.c
+proto/blowfish.pro: blowfish.c
buffer.o: buffer.c
proto/buffer.pro: buffer.c
charset.o: charset.c
@@ -348,6 +352,8 @@ screen.o: screen.c
proto/screen.pro: screen.c
search.o: search.c
proto/search.pro: search.c
+sha256.o: sha256.c
+proto/sha256.pro: sha256.c
spell.o: spell.c
proto/spell.pro: spell.c
syntax.o: syntax.c
View
@@ -468,7 +468,7 @@ CClink = $(CC)
#CONF_OPT_FEAT = --with-features=small
#CONF_OPT_FEAT = --with-features=normal
#CONF_OPT_FEAT = --with-features=big
-#CONF_OPT_FEAT = --with-features=huge
+CONF_OPT_FEAT = --with-features=huge
# COMPILED BY - For including a specific e-mail address for ":version".
#CONF_OPT_COMPBY = "--with-compiledby=John Doe <JohnDoe@yahoo.com>"
@@ -536,9 +536,9 @@ CClink = $(CC)
#CFLAGS = -g -O2 '-DSTARTUPTIME="vimstartup"' -fno-strength-reduce -Wall -Wmissing-prototypes
# Use this with GCC to check for mistakes, unused arguments, etc.
-#CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code -D_FORTIFY_SOURCE=1
-#PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers
-#MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter
+CFLAGS = -g -Wall -Wextra -Wmissing-prototypes -Wunreachable-code -D_FORTIFY_SOURCE=1
+PYTHON_CFLAGS_EXTRA = -Wno-missing-field-initializers
+MZSCHEME_CFLAGS_EXTRA = -Wno-unreachable-code -Wno-unused-parameter
# EFENCE - Electric-Fence malloc debugging: catches memory accesses beyond
# allocated memory (and makes every malloc()/free() very slow).
@@ -1377,6 +1377,7 @@ DEST_MAN_RU_U = $(DEST_MAN_TOP)/ru.UTF-8$(MAN1DIR)
TAGS_INCL = *.h
BASIC_SRC = \
+ blowfish.c \
buffer.c \
charset.c \
diff.c \
@@ -1415,6 +1416,7 @@ BASIC_SRC = \
regexp.c \
screen.c \
search.c \
+ sha256.c \
spell.c \
syntax.c \
tag.c \
@@ -1449,6 +1451,7 @@ LINT_SRC = $(BASIC_SRC) $(GUI_SRC) $(HANGULIN_SRC) $(PYTHON_SRC) $(TCL_SRC) \
OBJ = \
objects/buffer.o \
+ objects/blowfish.o \
objects/charset.o \
objects/diff.o \
objects/digraph.o \
@@ -1487,6 +1490,7 @@ OBJ = \
objects/regexp.o \
objects/screen.o \
objects/search.o \
+ objects/sha256.o \
objects/spell.o \
objects/syntax.o \
$(SNIFF_OBJ) \
@@ -1507,6 +1511,7 @@ OBJ = \
$(WSDEBUG_OBJ)
PRO_AUTO = \
+ blowfish.pro \
buffer.pro \
charset.pro \
diff.pro \
@@ -1547,6 +1552,7 @@ PRO_AUTO = \
regexp.pro \
screen.pro \
search.pro \
+ sha256.pro \
spell.pro \
syntax.pro \
tag.pro \
@@ -2337,6 +2343,9 @@ auto/pathdef.c: Makefile auto/config.mk
objects:
mkdir objects
+objects/blowfish.o: blowfish.c
+ $(CCC) -o $@ blowfish.c
+
objects/buffer.o: buffer.c
$(CCC) -o $@ buffer.c
@@ -2547,6 +2556,9 @@ objects/screen.o: screen.c
objects/search.o: search.c
$(CCC) -o $@ search.c
+objects/sha256.o: sha256.c
+ $(CCC) -o $@ sha256.c
+
objects/spell.o: spell.c
$(CCC) -o $@ spell.c
Oops, something went wrong.

0 comments on commit 5287c18

Please sign in to comment.