mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-07 05:31:17 -07:00
fix clang compiler warnings
identified in http://www.proxmark.org/forum/viewtopic.php?id=5388
This commit is contained in:
parent
30bb6d6591
commit
ec0872181b
5 changed files with 14 additions and 45 deletions
|
@ -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)
|
static inline uint32_t test_bit24(uint32_t *bitarray, uint32_t index)
|
||||||
{
|
{
|
||||||
return bitarray[index>>5] & (0x80000000>>(index&0x0000001f));
|
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
|
#define BITFLIP_2ND_BYTE 0x0200
|
||||||
|
|
|
@ -132,7 +132,7 @@ const APDUCode APDUCodeTable[] = {
|
||||||
{"6EXX", APDUCODE_TYPE_ERROR, "Instruction class not supported (procedure byte), (ISO 7816-3)"},
|
{"6EXX", APDUCODE_TYPE_ERROR, "Instruction class not supported (procedure byte), (ISO 7816-3)"},
|
||||||
{"6F--", APDUCODE_TYPE_ERROR, "Internal exception"},
|
{"6F--", APDUCODE_TYPE_ERROR, "Internal exception"},
|
||||||
{"6F00", APDUCODE_TYPE_ERROR, "Command aborted - more exact diagnosis not possible (e.g., operating system error)."},
|
{"6F00", APDUCODE_TYPE_ERROR, "Command aborted - more exact diagnosis not possible (e.g., operating system error)."},
|
||||||
{"6FFF", APDUCODE_TYPE_ERROR, "Card dead (overuse, …)"},
|
{"6FFF", APDUCODE_TYPE_ERROR, "Card dead (overuse, ...)"},
|
||||||
{"6FXX", APDUCODE_TYPE_ERROR, "No precise diagnosis (procedure byte), (ISO 7816-3)"},
|
{"6FXX", APDUCODE_TYPE_ERROR, "No precise diagnosis (procedure byte), (ISO 7816-3)"},
|
||||||
{"9---", APDUCODE_TYPE_NONE, ""},
|
{"9---", APDUCODE_TYPE_NONE, ""},
|
||||||
{"9000", APDUCODE_TYPE_INFO, "Command successfully executed (OK)."},
|
{"9000", APDUCODE_TYPE_INFO, "Command successfully executed (OK)."},
|
||||||
|
|
|
@ -297,9 +297,9 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
infiles = calloc(num_input_files, sizeof(FILE*));
|
infiles = calloc(num_input_files, sizeof(FILE*));
|
||||||
for (uint16_t i = 0; i < num_input_files; i++) {
|
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) {
|
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);
|
return(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,8 +139,13 @@ bool verify_key(uint32_t cuid, noncelist_t *nonces, uint8_t *best_first_bytes, u
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void*
|
||||||
static void* __attribute__((force_align_arg_pointer)) crack_states_thread(void* x){
|
#ifdef __has_attribute
|
||||||
|
#if __has_attribute(force_align_arg_pointer)
|
||||||
|
__attribute__((force_align_arg_pointer))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
crack_states_thread(void* x){
|
||||||
|
|
||||||
struct arg {
|
struct arg {
|
||||||
bool silent;
|
bool silent;
|
||||||
|
|
|
@ -37,8 +37,12 @@ void msleep(uint32_t n) {
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
|
||||||
|
#ifndef CLOCK_MONOTONIC
|
||||||
#define CLOCK_MONOTONIC (1)
|
#define CLOCK_MONOTONIC (1)
|
||||||
|
#endif
|
||||||
|
#ifndef CLOCK_REALTIME
|
||||||
#define CLOCK_REALTIME (2)
|
#define CLOCK_REALTIME (2)
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <mach/clock.h>
|
#include <mach/clock.h>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue