diff --git a/Changes.md b/Changes.md index f3e76cd..2b0a8b1 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,8 @@ +v7.2.2 + +* patches: password was not correctly overwritten in memory after it wasn't needed. IVs weren't as random as intended. Both failures didn't compromise security of the encrypted file, AFAIK. +* code cleaning to eliminate most of the compiler warnings. + v7.2.1 * no fixes, improvements or additions: just little code compatibility changes with Android and others. diff --git a/README.md b/README.md index cddda1b..c9b003d 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ There's an [Android app available here](https://www.github.com/circulosmeos/trio Features: -* Code can be compiled with any C99 compiler, no matter platform, endianness or word size (32-64 bits): it has been tested on Windows, linux, Solaris, HP-UX OS's and Intel/AMD, ARM and Itanium processors. +* Code can be compiled with any C99 compiler, no matter platform, endianness or word size (32-64 bits): it has been tested on Windows, linux, Solaris, HP-UX OS's and Intel/AMD, ARM, MIPS and Itanium processors. * Same content produces different encrypted outputs every time. This is attained with a random initialization vector (IV) stored within the encrypted file. * Files are (by default) encrypted/decrypted on-the-fly, so content is overwritten. This is interesting from a security point of view, as no clear content is left on disk. * When decrypting, if password is not the one used for encrypting, the process is aborted, so the file cannot be rendered unusable. This behaviour is achieved thanks to a password hint stored within the encrypted file. (This hint can optionally be not stored: in this case the file could end up being decrypted with an incorrect password, so its contents would be irrecoverable.) @@ -23,12 +23,11 @@ Features: * Reduced program size: < 100 kiB on all platforms. * [easily portable to Android](https://www.github.com/circulosmeos/triops.apk) as a JNI library. Check "ANDROID_LIBRARY" in the source code. * Licensed as GPL v3. - -Known limitations: - -* Files higher than 4 GiB cannot be managed and will produce unexpected outputs: be warned! +Known limitations: +* Files higher than 4 GiB cannot be managed and will produce unexpected outputs in Windows: be warned! + Before compiling, check in triops.h that next values correctly adjust to your platform, modifying them as convenient: diff --git a/chacha20/include/crypto_stream.h b/chacha20/include/crypto_stream.h index c7abe17..0312345 100644 --- a/chacha20/include/crypto_stream.h +++ b/chacha20/include/crypto_stream.h @@ -47,4 +47,4 @@ int crypto_stream_xor(unsigned char *c, const unsigned char *m, } #endif -#endif \ No newline at end of file +#endif diff --git a/chacha20/include/crypto_stream_xsalsa20.h b/chacha20/include/crypto_stream_xsalsa20.h index 926237b..d035351 100644 --- a/chacha20/include/crypto_stream_xsalsa20.h +++ b/chacha20/include/crypto_stream_xsalsa20.h @@ -49,4 +49,4 @@ int crypto_stream_xsalsa20_xor_ic(unsigned char *c, const unsigned char *m, } #endif -#endif \ No newline at end of file +#endif diff --git a/chacha20/include/export.h b/chacha20/include/export.h index 9ef6252..128f7cb 100644 --- a/chacha20/include/export.h +++ b/chacha20/include/export.h @@ -29,4 +29,4 @@ # endif #endif -#endif \ No newline at end of file +#endif diff --git a/keccak/crypto_hash.h b/keccak/crypto_hash.h index bc26571..9b59ba6 100644 --- a/keccak/crypto_hash.h +++ b/keccak/crypto_hash.h @@ -36,4 +36,4 @@ const char *crypto_hash_primitive(void); } #endif -#endif \ No newline at end of file +#endif diff --git a/keccak/export.h b/keccak/export.h index 9ef6252..128f7cb 100644 --- a/keccak/export.h +++ b/keccak/export.h @@ -29,4 +29,4 @@ # endif #endif -#endif \ No newline at end of file +#endif diff --git a/triops.c b/triops.c index f268b13..b0b276c 100644 --- a/triops.c +++ b/triops.c @@ -44,6 +44,7 @@ #include #include +#include #ifdef ANDROID_LIBRARY #include @@ -74,7 +75,7 @@ int getch(void); -#define TRIOPS_VERSION "7.2.1" +#define TRIOPS_VERSION "7.2.2" #define PROGRAM_NAME "triops" #define BUFFERSIZE 16384 // for CHACHA20: multiple of 64 bytes to avoid bad implementation (http://goo.gl/DHCLz1) @@ -142,10 +143,10 @@ union unionIV_v3 -void truncateFile (LPBYTE); -BOOL obtainPassword (LPBYTE, LPBYTE); +void truncateFile (char *); +BOOL obtainPassword (char *szPassFile, char *szPass); unsigned long long FileSize(char *); -void EliminatePasswords (LPBYTE szPassFile, LPBYTE szPass); +void EliminatePasswords (char *szPassFile, char *szPass); #ifndef WINDOWS_PLATFORM time_t obtainTimestampUnix (char *szFile, int iMarcaDeTiempo); #else @@ -153,7 +154,7 @@ void obtainTimestampWin (char *szFile, LPFILETIME lpLastWriteTime); void writeTimestampWin (char *szFile, LPFILETIME lpLastWriteTime); #endif -void truncateFileBySize ( LPBYTE, unsigned long long ); +void truncateFileBySize ( char *, unsigned long long ); void LoadIVandHash_v3 (FILE *, LPBYTE, LPBYTE, char *); int CheckKeyIsValid_v3 (LPSTR, LPBYTE, LPBYTE, LPDWORD, BOOL); @@ -233,7 +234,7 @@ int local_triops (int argc, char* const argv[static 4]) #endif { unsigned long long nBytesSoFar; - unsigned long long nBytesRead, nBytesWritten; + unsigned long long nBytesRead; FILE * hFile; FILE * hFileOut; FILE * hFileTail; @@ -317,13 +318,14 @@ int local_triops (int argc, char* const argv[static 4]) } } else { // decrypting: so triops Version can be deduced from extension: - if (strlen(szFile)>=4) + if (strlen(szFile)>=4) { if (strcmp( szFile+(strlen(szFile)-4), TRIOPS_V3_EXTENSION ) == 0 ) triopsVersion=TRIOPS_V3; else { printf ("\nDecrypting, but format could not be deduced from file extension.\nProcess aborted.\n"); return 1; } + } } //................................................. // (5) @@ -444,7 +446,7 @@ int local_triops (int argc, char* const argv[static 4]) } } - // use the iv to create a unique key for this file + // use the IV to create a unique key for this file if (triopsVersion==TRIOPS_V3) { CreateUniqueKey_v3 (uniqueKey_v3.keyW, key_v3.keyB, &(iv_v3.iv)); // it is not necessary to make a copy of the original IV, as CHACHA20 uses it as const * @@ -654,7 +656,7 @@ int local_triops (int argc, char* const argv[static 4]) } else { // the space destined to the hash is filled with all zeros value: if (triopsVersion==TRIOPS_V3) - for (i=0; i++; i