fix clang compiler warnings 550/head
authorpwpiwi <pwpiwi@users.noreply.github.com>
Tue, 23 Jan 2018 07:27:58 +0000 (08:27 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Tue, 23 Jan 2018 15:55:48 +0000 (16:55 +0100)
identified in http://www.proxmark.org/forum/viewtopic.php?id=5388

client/cmdhfmfhard.c
client/emv/apduinfo.c
client/fpga_compress.c
client/hardnested/hardnested_bruteforce.c
client/util_posix.c

index 96c3a989f511f4bff60b07012e792099b86ff541..69ad898db4ead30997ce98ede7837db0b886d2cb 100644 (file)
@@ -150,12 +150,6 @@ static inline void set_bit24(uint32_t *bitarray, uint32_t index)
 }
 
 
-static inline void clear_bit24(uint32_t *bitarray, uint32_t index)
-{
-       bitarray[index>>5] &= ~(0x80000000>>(index&0x0000001f));
-}
-
-
 static inline uint32_t test_bit24(uint32_t *bitarray, uint32_t index)
 {
        return  bitarray[index>>5] & (0x80000000>>(index&0x0000001f));
@@ -196,40 +190,6 @@ static inline uint32_t next_state(uint32_t *bitarray, uint32_t state)
 }
 
 
-static inline uint32_t next_not_state(uint32_t *bitarray, uint32_t state)
-{
-       if (++state == 1<<24) return 1<<24;
-       uint32_t index = state >> 5;
-       uint_fast8_t bit = state & 0x1f;
-       uint32_t line = bitarray[index] << bit;
-       while (bit <= 0x1f) {
-               if ((line & 0x80000000) == 0) return state;
-               state++;
-               bit++;
-               line <<= 1;
-       }
-       index++;
-       while (bitarray[index] == 0xffffffff && state < 1<<24) {
-               index++;
-               state += 0x20;
-       }
-       if (state >= 1<<24) return 1<<24;
-#if defined __GNUC__
-       return state + __builtin_clz(~bitarray[index]);
-#else
-       bit = 0x00;
-       line = bitarray[index];
-       while (bit <= 0x1f) {
-               if ((line & 0x80000000) == 0) return state;
-               state++;
-               bit++;
-               line <<= 1;
-       }
-       return 1<<24;
-#endif
-}
-
-
 
 
 #define BITFLIP_2ND_BYTE                               0x0200
index ec7a64a199ef1a35b1a89df959846c0210c9e969..a631c6142219ca3e9ad2f0d55bb41fbce621c053 100644 (file)
@@ -132,7 +132,7 @@ const APDUCode APDUCodeTable[] = {
        {"6EXX",        APDUCODE_TYPE_ERROR,            "Instruction class not supported (procedure byte), (ISO 7816-3)"},
        {"6F--",        APDUCODE_TYPE_ERROR,            "Internal exception"},
        {"6F00",        APDUCODE_TYPE_ERROR,            "Command aborted - more exact diagnosis not possible (e.g., operating system error)."},
-       {"6FFF",        APDUCODE_TYPE_ERROR,            "Card dead (overuse, \85)"},
+       {"6FFF",        APDUCODE_TYPE_ERROR,            "Card dead (overuse, ...)"},
        {"6FXX",        APDUCODE_TYPE_ERROR,            "No precise diagnosis (procedure byte), (ISO 7816-3)"},
        {"9---",        APDUCODE_TYPE_NONE,             ""},
        {"9000",        APDUCODE_TYPE_INFO,                     "Command successfully executed (OK)."},
index a672ab585e99ffbcd75c4d7ab25d391f05c6c480..fc298a8b87b6bb948be72a69d4c731d559e1ede6 100644 (file)
@@ -297,9 +297,9 @@ int main(int argc, char **argv)
                }
                infiles = calloc(num_input_files, sizeof(FILE*));
                for (uint16_t i = 0; i < num_input_files; i++) { 
-                       infiles[i] = fopen(argv[i+hardnested_mode?2:1], "rb");
+                       infiles[i] = fopen(argv[i+(hardnested_mode?2:1)], "rb");
                        if (infiles[i] == NULL) {
-                               fprintf(stderr, "Error. Cannot open input file %s", argv[i+hardnested_mode?2:1]);
+                               fprintf(stderr, "Error. Cannot open input file %s", argv[i+(hardnested_mode?2:1)]);
                                return(EXIT_FAILURE);
                        }
                }
index 3072fc52ddef35b07e4a07988bcd8f6701b31a29..deea69d8479f0b9fbff56811ba619ab24a22ce87 100644 (file)
@@ -139,8 +139,13 @@ bool verify_key(uint32_t cuid, noncelist_t *nonces, uint8_t *best_first_bytes, u
        return true;
 }
 
-
-static void* __attribute__((force_align_arg_pointer)) crack_states_thread(void* x){
+static void* 
+#ifdef __has_attribute
+#if __has_attribute(force_align_arg_pointer)
+__attribute__((force_align_arg_pointer)) 
+#endif
+#endif
+crack_states_thread(void* x){
 
        struct arg {
                bool silent;
index 8f3ed46b6a45c827950dfb377745965ade89e3c7..32158adab3403fa394f1406d40961692ad19425d 100644 (file)
@@ -37,8 +37,12 @@ void msleep(uint32_t n) {
 
 #ifdef __APPLE__
 
+#ifndef CLOCK_MONOTONIC
        #define CLOCK_MONOTONIC (1)
+#endif
+#ifndef CLOCK_REALTIME
        #define CLOCK_REALTIME (2)
+#endif
 
        #include <sys/time.h>
        #include <mach/clock.h>
Impressum, Datenschutz