]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmfhard.c
FIX: this should fix the compilation error for MAC users.
[proxmark3-svn] / client / cmdhfmfhard.c
index 2cec9b7c945ceecdc0c5cd4542aaab636669a051..6da4a1d123ab14ef0d2074d283658869e50841c5 100644 (file)
 #ifdef __WIN32
        #include <windows.h>
 #endif
-#include <malloc.h>
+// don't include for APPLE/mac which has malloc stuff elsewhere.
+#ifndef __APPLE__
+       #include <malloc.h>
+#endif
 #include <assert.h>
 
 #define CONFIDENCE_THRESHOLD   0.95            // Collect nonces until we are certain enough that the following brute force is successfull
@@ -605,11 +608,11 @@ static uint16_t estimate_second_byte_sum(void)
 static int read_nonce_file(void)
 {
        FILE *fnonces = NULL;
-       uint8_t trgBlockNo;
-       uint8_t trgKeyType;
+       uint8_t trgBlockNo = 0;
+       uint8_t trgKeyType = 0;
        uint8_t read_buf[9];
-       uint32_t nt_enc1, nt_enc2;
-       uint8_t par_enc;
+       uint32_t nt_enc1 = 0, nt_enc2 = 0;
+       uint8_t par_enc = 0;
        int total_num_nonces = 0;
        
        if ((fnonces = fopen("nonces.bin","rb")) == NULL) { 
@@ -640,7 +643,6 @@ static int read_nonce_file(void)
        }
        fclose(fnonces);
        PrintAndLog("Read %d nonces from file. cuid=%08x, Block=%d, Keytype=%c", total_num_nonces, cuid, trgBlockNo, trgKeyType==0?'A':'B');
-
        return 0;
 }
 
@@ -1399,7 +1401,7 @@ static const uint64_t crack_states_bitsliced(statelist_t *p){
                bitslice_t * restrict lstate_p = _aligned_malloc((STATE_SIZE+ROLLBACK_SIZE) * bSize, bSize);
        #endif
 #else
-       #ifdef  defined(__APPLE__)
+       #ifdef __APPLE__
                bitslice_t * restrict lstate_p = malloc((STATE_SIZE+ROLLBACK_SIZE) * bSize);
        #else
                bitslice_t * restrict lstate_p = memalign(bSize, (STATE_SIZE+ROLLBACK_SIZE) * bSize);
@@ -1635,7 +1637,8 @@ static void brute_force(void)
         time_t start, end;
         time(&start);
         keys_found = 0;
-
+               foundkey = 0;
+               
         crypto1_bs_init();
 
         PrintAndLog("Using %u-bit bitslices", MAX_BITSLICES);
Impressum, Datenschutz