Mercurial > vim
changeset 2184:5028c4d6d825 vim73
Fixed encryption big/little endian test.
Use uint32_t to avoid crash on 64 bit machines.
Added error numbers for Blowfish errors.
Fixed the tiny version not building.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Mon, 17 May 2010 20:32:55 +0200 |
parents | 3cb515c62e9c |
children | c202455d5a3a |
files | runtime/doc/editing.txt runtime/doc/options.txt runtime/doc/tags runtime/doc/todo.txt src/auto/configure src/blowfish.c src/config.h.in src/configure.in src/netbeans.c src/option.c src/sha256.c src/structs.h |
diffstat | 12 files changed, 406 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/doc/editing.txt +++ b/runtime/doc/editing.txt @@ -1366,10 +1366,18 @@ this before writing the file. When read 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 -decrypted. + *E817* *E818* *E819* +When encryption does not work properly, you would be able to write your text +to a file and never be able to read it back. Therefore a test is performed to +check if the encryption works as expected. If you get one of these errors +don't write the file encrypted! You need to rebuild the Vim binary to fix +this. + +When reading a file that has been encrypted and the 'key' 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, or you enter the wrong key, the +file is edited without being decrypted. There is no warning about using the +wrong key (this makes brute force methods to find the key more difficult). If want to start reading a file that uses a different key, set the 'key' option to an empty string, so that Vim will prompt for a new one. Don't use
--- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -2054,8 +2054,10 @@ A jump table for the options with a shor local to buffer {not in Vi} Method used for encryption when the buffer is written to a file: + *pkzip* 0 PkZip compatible method. A weak kind of encryption. backwards compatible with Vim 7.2 and older. + *blowfish* 1 Blowfish method. Strong encryption. Not compatible with Vim 7.2 and older. When reading an encrypted file 'cryptmethod' will be set automatically
--- a/runtime/doc/tags +++ b/runtime/doc/tags @@ -110,6 +110,7 @@ 'cinw' options.txt /*'cinw'* 'cinwords' options.txt /*'cinwords'* 'clipboard' options.txt /*'clipboard'* +'cm' options.txt /*'cm'* 'cmdheight' options.txt /*'cmdheight'* 'cmdwinheight' options.txt /*'cmdwinheight'* 'cmp' options.txt /*'cmp'* @@ -132,6 +133,7 @@ 'cpo' options.txt /*'cpo'* 'cpoptions' options.txt /*'cpoptions'* 'cpt' options.txt /*'cpt'* +'cryptmethod' options.txt /*'cryptmethod'* 'cscopepathcomp' options.txt /*'cscopepathcomp'* 'cscopeprg' options.txt /*'cscopeprg'* 'cscopequickfix' options.txt /*'cscopequickfix'* @@ -4136,6 +4138,9 @@ E813 editing.txt /*E813* E814 editing.txt /*E814* E815 if_mzsch.txt /*E815* E816 diff.txt /*E816* +E817 editing.txt /*E817* +E818 editing.txt /*E818* +E819 editing.txt /*E819* E82 message.txt /*E82* E83 message.txt /*E83* E84 windows.txt /*E84* @@ -4692,6 +4697,7 @@ blockwise-examples visual.txt /*blockwis blockwise-operators visual.txt /*blockwise-operators* blockwise-register change.txt /*blockwise-register* blockwise-visual visual.txt /*blockwise-visual* +blowfish options.txt /*blowfish* bold syntax.txt /*bold* bom-bytes mbyte.txt /*bom-bytes* book intro.txt /*book* @@ -6910,6 +6916,7 @@ pi_spec.txt pi_spec.txt /*pi_spec.txt* pi_tar.txt pi_tar.txt /*pi_tar.txt* pi_vimball.txt pi_vimball.txt /*pi_vimball.txt* pi_zip.txt pi_zip.txt /*pi_zip.txt* +pkzip options.txt /*pkzip* plaintex.vim syntax.txt /*plaintex.vim* plsql ft_sql.txt /*plsql* plugin usr_05.txt /*plugin*
--- a/runtime/doc/todo.txt +++ b/runtime/doc/todo.txt @@ -31,11 +31,9 @@ be worked on, but only if you sponsor Vi -------------------- Known bugs and current work ----------------------- Crypt update: -- 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? -- Update E000 to error number. Include cabal and obj syntax files. (Vincent Berthoux, 2010 May 16) @@ -1145,6 +1143,9 @@ 6 In the quickfix window statusline ad 10.4. - Patch for adding "J" flag to 'cinoptions': placement of jump label. (Manuel Konig, 2010 Feb 19) Update by Lech Lorens, Feb 22. +- Add Lua interface? (Wolfgang Oertl) patch by Luis Carvalho, 2008 Sep 5 + Patch for Make_ming.mak from Paul Moore (2008 Sep 1) + http://code.google.com/p/vim-iflua/ Download vim72-lua-0.7.patch.gz Needs some work: - Use NSIS 2.45, it includes Windows 7 support. Include "RequestExecutionLevel highest" @@ -2194,9 +2195,6 @@ Most interesting new features to be adde - Running a shell command from the GUI still has limitations. Look into how the terminal emulator of the Vim shell project can help: http://vimshell.wana.at -- Add Lua interface? (Wolfgang Oertl) patch by Luis Carvalho, 2008 Sep 5 - Patch for Make_ming.mak from Paul Moore (2008 Sep 1) - http://vim-iflua.googlecode.com/files/vim72-lua-0.7.patch.gz 8 Add a command to jump to a certain kind of tag. Allow the user to specify values for the optional fields. E.g., ":tag size type=m". Also allow specifying the file and command, so that the result of
--- a/src/auto/configure +++ b/src/auto/configure @@ -1957,6 +1957,60 @@ eval ac_res=\$$3 eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} } # ac_fn_c_check_type + +# ac_fn_c_find_uintX_t LINENO BITS VAR +# ------------------------------------ +# Finds an unsigned integer type with width BITS, setting cache variable VAR +# accordingly. +ac_fn_c_find_uintX_t () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 +$as_echo_n "checking for uint$2_t... " >&6; } +if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + # Order is important - never check a type that is potentially smaller + # than half of the expected target width. + for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + case $ac_type in #( + uint$2_t) : + eval "$3=yes" ;; #( + *) : + eval "$3=\$ac_type" ;; +esac +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + eval as_val=\$$3 + if test "x$as_val" = x""no; then : + +else + break +fi + done +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_find_uintX_t cat >auto/config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -8965,6 +9019,20 @@ if test $ac_cv_type_uid_t = no; then fi +ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" +case $ac_cv_c_uint32_t in #( + no|yes) ;; #( + *) + +$as_echo "#define _UINT32_T 1" >>confdefs.h + + +cat >>confdefs.h <<_ACEOF +#define uint32_t $ac_cv_c_uint32_t +_ACEOF +;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if test "${ac_cv_header_time+set}" = set; then : @@ -9022,6 +9090,230 @@ cat >>confdefs.h <<_ACEOF fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + #include <sys/param.h> + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <sys/types.h> + #include <sys/param.h> + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <limits.h> + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <limits.h> + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for rlim_t" >&5 $as_echo_n "checking for rlim_t... " >&6; } @@ -11727,6 +12019,7 @@ LTLIBOBJS=$ac_ltlibobjs + : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files
--- a/src/blowfish.c +++ b/src/blowfish.c @@ -1,7 +1,13 @@ /* vi:set ts=8 sts=4 sw=4: * + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. + * * Blowfish encryption for Vim; in Blowfish output feedback mode. - * GPL(C) Mohsin Ahmed, http://www.cs.albany.edu/~mosh + * Contributed by Mohsin Ahmed, http://www.cs.albany.edu/~mosh * Based on http://www.schneier.com/blowfish.html by Bruce Schneier. */ @@ -15,32 +21,29 @@ #define BF_OFB_LEN (8*(BF_BLOCK)) typedef union { - long_u ul[2]; - char_u uc[8]; + uint32_t ul[2]; + char_u uc[8]; } block8; -#ifdef __BORLANDC__ -# define LITTLE_ENDIAN +#ifdef WIN3264 + /* MS-Windows is always little endian */ #else -# if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN) -# if (('1234' >> 24) == '1') -# define LITTLE_ENDIAN 1 -# else -# if (('4321' >> 24) == '1') -# define BIG_ENDIAN 1 -# endif -# endif +# ifdef HAVE_CONFIG_H + /* in configure.in AC_C_BIGENDIAN() defines WORDS_BIGENDIAN when needed */ +# else + error! + Please change this code to define WORDS_BIGENDIAN for big-endian machines. # endif #endif -static void bf_e_block __ARGS((long_u *p_xl, long_u *p_xr)); +static void bf_e_block __ARGS((uint32_t *p_xl, uint32_t *p_xr)); static void bf_e_cblock __ARGS((char_u *block)); -static int bf_check_tables __ARGS((long_u ipa[18], long_u sbi[4][256], long_u val)); +static int bf_check_tables __ARGS((uint32_t ipa[18], uint32_t sbi[4][256], uint32_t val)); static int bf_self_test __ARGS((void)); // Blowfish code -static long_u pax[18]; -static long_u ipa[18] = { +static uint32_t pax[18]; +static uint32_t ipa[18] = { 0x243f6a88u, 0x85a308d3u, 0x13198a2eu, 0x03707344u, 0xa4093822u, 0x299f31d0u, 0x082efa98u, 0xec4e6c89u, 0x452821e6u, @@ -49,8 +52,8 @@ static long_u ipa[18] = { 0xb5470917u, 0x9216d5d9u, 0x8979fb1bu }; -static long_u sbx[4][256]; -static long_u sbi[4][256] = { +static uint32_t sbx[4][256]; +static uint32_t sbi[4][256] = { {0xd1310ba6u, 0x98dfb5acu, 0x2ffd72dbu, 0xd01adfb7u, 0xb8e1afedu, 0x6a267e96u, 0xba7c9045u, 0xf12c7f99u, 0x24a19947u, 0xb3916cf7u, 0x0801f2e2u, 0x858efc16u, @@ -328,10 +331,10 @@ static long_u sbi[4][256] = { static void bf_e_block(p_xl, p_xr) - long_u *p_xl; - long_u *p_xr; + uint32_t *p_xl; + uint32_t *p_xr; { - long_u temp, xl = *p_xl, xr = *p_xr; + uint32_t temp, xl = *p_xl, xr = *p_xr; F1(0) F2(1) F1(2) F2(3) F1(4) F2(5) F1(6) F2(7) F1(8) F2(9) F1(10) F2(11) F1(12) F2(13) F1(14) F2(15) @@ -343,10 +346,10 @@ bf_e_block(p_xl, p_xr) #if 0 /* not used */ static void bf_d_block(p_xl, p_xr) - long_u *p_xl; - long_u *p_xr; + uint32_t *p_xl; + uint32_t *p_xr; { - long_u temp, xl = *p_xl, xr = *p_xr; + uint32_t temp, xl = *p_xl, xr = *p_xr; F1(17) F2(16) F1(15) F2(14) F1(13) F2(12) F1(11) F2(10) F1(9) F2(8) F1(7) F2(6) F1(5) F2(4) F1(3) F2(2) xl ^= pax[1]; @@ -357,7 +360,7 @@ bf_d_block(p_xl, p_xr) #endif -#ifdef BIG_ENDIAN +#ifdef WORDS_BIGENDIAN # define htonl2(x) \ x = ((((x) & 0xffL) << 24) | (((x) & 0xff00L) << 8) | \ (((x) & 0xff0000L) >> 8) | (((x) & 0xff000000L) >> 24)) @@ -397,10 +400,10 @@ bf_d_cblock(block) bf_key_init(password) char_u *password; { - int i, j, keypos = 0; - long_u val, data_l, data_r; - char_u *key; - int keylen; + int i, j, keypos = 0; + uint32_t val, data_l, data_r; + char_u *key; + int keylen; key = sha256_key(password); keylen = STRLEN(key); @@ -444,12 +447,12 @@ bf_key_init(password) */ static int bf_check_tables(ipa, sbi, val) - long_u ipa[18]; - long_u sbi[4][256]; - long_u val; + uint32_t ipa[18]; + uint32_t sbi[4][256]; + uint32_t val; { int i, j; - long_u c = 0; + uint32_t c = 0; for (i = 0; i < 18; i++) c ^= ipa[i]; @@ -460,10 +463,11 @@ bf_check_tables(ipa, sbi, val) } typedef struct { - char_u password[64]; - char_u plaintxt[8]; - char_u cryptxt[8]; - long_u keysum; + char_u password[64]; + char_u plaintxt[8]; + char_u cryptxt[8]; + char_u badcryptxt[8]; /* cryptxt when big/little endian is wrong */ + uint32_t keysum; } struct_bf_test_data; // Assert bf(password, plaintxt) is cryptxt. @@ -472,11 +476,8 @@ static struct_bf_test_data bf_test_data[ { "password", "plaintxt", -#if 0 /* This value doesn't work, why??? */ "\x55\xca\x56\x3a\xef\xe1\x9c\x73", /* cryptxt */ -#else - "\x47\xd9\x67\x49\x91\xc5\x9a\x95", /* cryptxt */ -#endif + "\x47\xd9\x67\x49\x91\xc5\x9a\x95", /* badcryptxt */ 0x5de01bdbu, /* keysum */ }, }; @@ -505,7 +506,11 @@ bf_self_test() memcpy(bk.uc, bf_test_data[i].plaintxt, 8); bf_e_cblock(bk.uc); if (memcmp(bk.uc, bf_test_data[i].cryptxt, 8) != 0) + { + if (err == 0 && memcmp(bk.uc, bf_test_data[i].badcryptxt, 8) == 0) + EMSG(_("E817: Blowfish big/little endian use wrong")); err++; + } } return err > 0 ? FAIL : OK; @@ -567,12 +572,12 @@ blowfish_self_test() { if (sha256_self_test() == FAIL) { - EMSG2(_("E000: sha256 test failed"),""); + EMSG(_("E818: sha256 test failed")); return FAIL; } if (bf_self_test() == FAIL) { - EMSG2(_("E000: Blowfish test failed"),""); + EMSG(_("E819: Blowfish test failed")); return FAIL; } return OK;
--- a/src/config.h.in +++ b/src/config.h.in @@ -74,6 +74,9 @@ /* Define to `int' if <sys/types.h> doesn't define. */ #undef uid_t +/* Define to `unsigned int' or other type that is 32 bit. */ +#undef uint32_t + /* Define to `int' if <sys/types.h> doesn't define. */ #undef gid_t @@ -83,6 +86,9 @@ /* Define to `unsigned' if <sys/types.h> doesn't define. */ #undef dev_t +/* Define on big-endian machines */ +#undef WORDS_BIGENDIAN + /* Define to `unsigned long' if <sys/types.h> doesn't define. */ #undef rlim_t
--- a/src/configure.in +++ b/src/configure.in @@ -2246,9 +2246,11 @@ AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_UID_T +AC_TYPE_UINT32_T AC_HEADER_TIME AC_CHECK_TYPE(ino_t, long) AC_CHECK_TYPE(dev_t, unsigned) +AC_C_BIGENDIAN(,,,) AC_MSG_CHECKING(for rlim_t) if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
--- a/src/netbeans.c +++ b/src/netbeans.c @@ -43,6 +43,11 @@ # define sock_close(sd) closesocket(sd) # define sleep(t) Sleep(t*1000) /* WinAPI Sleep() accepts milliseconds */ #else + /* uint32_t may be defined by configure, but netdb.h indirectly includes + * stdint.h which tries to typedef uint32_t and fails. */ +# ifdef uint32_t +# undef uint32_t +# endif # include <netdb.h> # include <netinet/in.h> # include <sys/socket.h>
--- a/src/option.c +++ b/src/option.c @@ -278,7 +278,9 @@ static char_u *p_cino; #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) static char_u *p_cinw; #endif +#ifdef FEAT_CRYPT static long p_cm; +#endif #ifdef FEAT_COMMENTS static char_u *p_com; #endif @@ -837,7 +839,11 @@ static struct vimoption {(char_u *)CPO_VI, (char_u *)CPO_VIM} SCRIPTID_INIT}, {"cryptmethod", "cm", P_NUM|P_VI_DEF|P_VIM, +#ifdef FEAT_CRYPT (char_u *)&p_cm, PV_CM, +#else + (char_u *)NULL, PV_NONE, +#endif {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM, #ifdef FEAT_CSCOPE @@ -7875,6 +7881,7 @@ set_num_option(opt_idx, varp, value, err #endif +#ifdef FEAT_CRYPT else if (pp == &curbuf->b_p_cm) { if (curbuf->b_p_cm < 0) @@ -7890,6 +7897,7 @@ set_num_option(opt_idx, varp, value, err if (curbuf->b_p_cm > 0 && blowfish_self_test() == FAIL) curbuf->b_p_cm = 0; } +#endif #ifdef FEAT_WINDOWS /* (re)set last window status line */ @@ -9307,7 +9315,9 @@ get_varp(p) case PV_CINK: return (char_u *)&(curbuf->b_p_cink); case PV_CINO: return (char_u *)&(curbuf->b_p_cino); #endif +#ifdef FEAT_CRYPT case PV_CM: return (char_u *)&(curbuf->b_p_cm); +#endif #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) case PV_CINW: return (char_u *)&(curbuf->b_p_cinw); #endif
--- a/src/sha256.c +++ b/src/sha256.c @@ -1,23 +1,27 @@ /* vi:set ts=8 sts=4 sw=4: * - * FIPS-180-2 compliant SHA-256 implementation - * GPL by Christophe Devine. - * Modified for md5deep, in public domain. - * Modified For Vim, GPL(C) Mohsin Ahmed, http://www.cs.albany.edu/~mosh + * VIM - Vi IMproved by Bram Moolenaar + * + * Do ":help uganda" in Vim to read copying and usage conditions. + * Do ":help credits" in Vim to see a list of people who contributed. + * See README.txt for an overview of the Vim source code. * - * Vim specific notes: - * Functions exported by this file: - * 1. sha256_key() hashes the password to 64 bytes char string. - * 2. sha2_seed() generates a random header. - * sha256_self_test() is implicitly called once. + * FIPS-180-2 compliant SHA-256 implementation + * GPL by Christophe Devine. + * Modified for md5deep, in public domain. + * Modified For Vim, Mohsin Ahmed, http://www.cs.albany.edu/~mosh + * + * Vim specific notes: + * Functions exported by this file: + * 1. sha256_key() hashes the password to 64 bytes char string. + * 2. sha2_seed() generates a random header. + * sha256_self_test() is implicitly called once. */ #include "vim.h" #ifdef FEAT_CRYPT -typedef unsigned long uint32_t; - typedef struct { uint32_t total[2]; uint32_t state[8];