Hi,

  With the attached path TrueCrack v3.5 compiles under Visual Studio
2010 (if you add a compatible getopt_long implementation and a make-
file with the right source files) and Cygwin GCC v4.7.3 (with a minor
problem that you have to set `EXEEXT =` to the empty string in the
`src/Makefile` file, otherwise `make` will try to make a target with
the name `truecrack.exe` but does not know how; not sure why that is);
in both configurations building for CPU-only ignoring the CUDA parts.

The GCC version even appears to work to some extent, in verbose mode

  sh-4.1$ truecrack -t 2222.tc -v -c "1234" -s 4 -m 4
  TrueCrack v3.5
  Website: http://code.google.com/p/truecrack
  Contact us: infotruecr...@gmail.com
  
  Memory initialization...
  
  COUNT   PASSWORD        RESULT
  0       1111            NO
  1       2111            NO
  2       3111            NO
  ...
  84      1222            NO
  85      2222            YES
  No found password
  Total computations:     "86"

it stops when it has found the password (but claims to have found no
password, which is a bit disconcerting). The binary built with Visual
Studio 2010 using the same command line parameters also works fine, but
it never prints "YES", so it essentially does not find the password. I
am guessing it could be some kind of memory initialisation problem, but
a quick test under Dr. Memory showed nothing terribly obvious.

As for the particular changes, the patch removes instances of `#include
<sys/mount.h>` which appears to be unused, and `#include <unistd.h>`
which also appears to be unused; I added `#include <stdint.h>` with the
idea to compensate for `unistd.h` but that might not actually be needed,
and I am not sure I put it in the right positions, looking at the patch.
Some functions declare variables after other statements, which is only
allowed in recent versions of the C language, I reordered four cases or
so; I noticed there are a few `pow` calls that need type casts for them
to compile under C++ rules. In `Common/Endian.h` I added a check for the
`__CYGWIN__` macro to the check for `_WIN32` to define the endianess; I
imagine there might be better ways to do that.

A strange problem was in `Crypto/CpuAes.h` where the `EXTERN` macro is
defined. The patch does

  @@ -1212,7 +1212,7 @@ AES_RETURN aes_ctr_crypt(const unsigned
   #elif defined(DO_TABLES)
   #  define EXTERN
   #else
  -#  define EXTERN //extern
  +#  define EXTERN extern
   #endif

restoring the code from TrueCrypt's `Crypto\Aestab.h` as far as I can
tell. I have no idea why the TrueCrack version makes it a `//` comment.

regards,
-- 
Björn Höhrmann · mailto:bjo...@hoehrmann.de · http://bjoern.hoehrmann.de
Am Badedeich 7 · Telefon: +49(0)160/4415681 · http://www.bjoernsworld.de
25899 Dagebüll · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 



diff -rup ./src/Common/CpuCore.c ..\truecrack/src/Common/CpuCore.c
--- ./src/Common/CpuCore.c      2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Common/CpuCore.c   2013-10-12 16:40:49.344036900 +0200
@@ -23,7 +23,6 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/mount.h>
 #include <time.h>
 
 #include "Volumes.h"
@@ -72,9 +71,10 @@ int cpu_Core_charset(int encryptionAlgor
     unsigned char headerKey[256]={0};
     unsigned char masterKey[256]={0};
     int length;
-    memcpy (salt, encryptedHeader + HEADER_SALT_OFFSET, PKCS5_SALT_SIZE);
     
     uint64 maxcombination=1,count=0;
+    memcpy (salt, encryptedHeader + HEADER_SALT_OFFSET, PKCS5_SALT_SIZE);
+
     for (i=0;i<wordlength;i++)
        maxcombination*= strlen(CORE_charset);
 
diff -rup ./src/Common/Crypto.h ..\truecrack/src/Common/Crypto.h
--- ./src/Common/Crypto.h       2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Common/Crypto.h    2013-10-11 22:12:30.009128900 +0200
@@ -50,7 +50,6 @@
 #include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 
 #ifdef __cplusplus
 extern "C" {
diff -rup ./src/Common/Endian.h ..\truecrack/src/Common/Endian.h
--- ./src/Common/Endian.h       2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Common/Endian.h    2013-10-11 22:49:05.966730500 +0200
@@ -38,7 +38,7 @@ extern "C"
 {
 #endif
 
-#ifdef _WIN32
+#if defined(_WIN32) || defined(__CYGWIN__)
 
 #      ifndef LITTLE_ENDIAN
 #              define LITTLE_ENDIAN 1234
diff -rup ./src/Common/Volumes.c ..\truecrack/src/Common/Volumes.c
--- ./src/Common/Volumes.c      2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Common/Volumes.c   2013-10-11 18:40:12.161565700 +0200
@@ -34,7 +34,6 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/mount.h>
 #include <time.h>
 //#include "EncryptionThreadPool.h"
 #endif
diff -rup ./src/Crypto/CpuAes.h ..\truecrack/src/Crypto/CpuAes.h
--- ./src/Crypto/CpuAes.h       2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Crypto/CpuAes.h    2013-10-11 23:06:10.537332600 +0200
@@ -1212,7 +1212,7 @@ AES_RETURN aes_ctr_crypt(const unsigned
 #elif defined(DO_TABLES)
 #  define EXTERN
 #else
-#  define EXTERN //extern
+#  define EXTERN extern
 #endif
 
 #if defined(_MSC_VER) && defined(TABLE_ALIGN)

diff -rup ./src/Main/Charset.c ..\truecrack/src/Main/Charset.c
--- ./src/Main/Charset.c        2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Main/Charset.c     2013-10-12 16:45:24.513775800 +0200
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
+#include <stdint.h>
 #include "Charset.h"
 
 /*La funzione numberOfStrings dice di quante parole è composta la permutazione 
completa di n caratteri in alfabeto per stringhe lunghe da 1 a n caratteri (è 
di supporto).*/
@@ -36,17 +37,18 @@ unsigned long numberOfStrings(const int
 /*La funzione indexedWordFromAlphabet da la i-esima parola dell’elenco delle 
permutazioni di n caratteri in alfabeto per stringhe da 1 a n caratteri di 
lunghezza massima.
 */
 char* indexedWordFromAlphabet (unsigned long idx, const char* alphCharset, 
const int alphLength, const int minWordLength, const int maxWordLength) {
+    char* genWord;
+    int i, charIdx;
 
     if (idx >= numberOfStrings(alphLength,minWordLength,maxWordLength)) {
         return NULL;
     }
 
-    char* genWord = (char*) malloc(sizeof(char)*(maxWordLength+1));
+    genWord = (char*) malloc(sizeof(char)*(maxWordLength+1));
 
     //Ciclo 0, primo carattere NON null
     genWord[0] = alphCharset[idx % alphLength];
     //Ciclo i-esimo
-    int i, charIdx;
     for (i=minWordLength;i<(maxWordLength+1);i++) {
         if (idx<numberOfStrings(alphLength,minWordLength,i)) {
             genWord[i] = '\0';
diff -rup ./src/Main/Core.c ..\truecrack/src/Main/Core.c
--- ./src/Main/Core.c   2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Main/Core.c        2013-10-11 19:05:39.162905200 +0200
@@ -157,8 +157,8 @@ void core(void){
 
        /* 3. Check the result */
        if (status==1) {
-               printf("Found password:\t\t\"");
                int j;
+               printf("Found password:\t\t\"");
                for (j=0;j<password_size;j++)
                        printf("%c",password[j]);
                printf("\"\nPassword length:\t\"%d\"\n",password_size);
@@ -414,11 +414,11 @@ void core(void){
 
                /* Crypt procedure */
                unsigned char word[MAXWORDSIZE];
-               wordlength=1;
                long long int maxcombination=1;
                long long int restore=CORE_restore;
-               CORE_maxlength++;
                int length,value;
+               wordlength=1;
+               CORE_maxlength++;
                i=0;
 
                if (CORE_verbose)
diff -rup ./src/Main/Main.c ..\truecrack/src/Main/Main.c
--- ./src/Main/Main.c   2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Main/Main.c        2013-10-12 12:07:14.783177800 +0200
@@ -24,6 +24,10 @@
 #include <stdlib.h>
 #include "Core.h"
 
+#ifdef _MSC_VER
+#define strcasecmp(x, y) _stricmp(x, y) 
+#endif
+
 /* The name of this program.*/
 const char *program_name;
 
diff -rup ./src/Main/Utils.c ..\truecrack/src/Main/Utils.c
--- ./src/Main/Utils.c  2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Main/Utils.c       2013-10-11 18:40:12.239570200 +0200
@@ -24,7 +24,6 @@
 
  
 #include <stdio.h>
-#include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
 #include <errno.h>
@@ -33,7 +32,6 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/mount.h>
 #include <time.h>
 
 #include "Tcdefs.h"
diff -rup ./src/Main/Utils.h ..\truecrack/src/Main/Utils.h
--- ./src/Main/Utils.h  2013-08-30 23:55:46.000000000 +0200
+++ ..\truecrack/src/Main/Utils.h       2013-10-11 18:30:25.706022400 +0200
@@ -20,6 +20,7 @@
 #define HEADER_Utils
 
 #include <stdio.h>
+#include <stdint.h>
 #include <sys/types.h>
 #include "Tcdefs.h"
 



Reply via email to