Fix a bunch of signed/unsigned comparisons.
This commit is contained in:
parent
08195d70ee
commit
478d3d92eb
2 changed files with 12 additions and 11 deletions
11
src/mfoc.c
11
src/mfoc.c
|
@ -735,7 +735,8 @@ int mf_enhanced_auth(int e_sector, int a_sector, mftag t, mfreader r, denonce *d
|
||||||
// Transmit reader-answer
|
// Transmit reader-answer
|
||||||
// fprintf(stdout, "\t{Ar}:\t");
|
// fprintf(stdout, "\t{Ar}:\t");
|
||||||
// print_hex_par(ArEnc, 64, ArEncPar);
|
// print_hex_par(ArEnc, 64, ArEncPar);
|
||||||
if (((RxLen = nfc_initiator_transceive_bits(r.pdi, ArEnc, 64, ArEncPar, Rx, RxPar)) < 0) || (RxLen != 32)) {
|
int res;
|
||||||
|
if (((res = nfc_initiator_transceive_bits(r.pdi, ArEnc, 64, ArEncPar, Rx, RxPar)) < 0) || (res != 32)) {
|
||||||
ERR ("Reader-answer transfer error, exiting..");
|
ERR ("Reader-answer transfer error, exiting..");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -764,7 +765,7 @@ int mf_enhanced_auth(int e_sector, int a_sector, mftag t, mfreader r, denonce *d
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sending the encrypted Auth command
|
// Sending the encrypted Auth command
|
||||||
if ((RxLen = nfc_initiator_transceive_bits(r.pdi, AuthEnc, 32, AuthEncPar,Rx, RxPar)) < 0) {
|
if (nfc_initiator_transceive_bits(r.pdi, AuthEnc, 32, AuthEncPar,Rx, RxPar) < 0) {
|
||||||
fprintf(stdout, "Error requesting encrypted tag-nonce\n");
|
fprintf(stdout, "Error requesting encrypted tag-nonce\n");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -793,7 +794,7 @@ int mf_enhanced_auth(int e_sector, int a_sector, mftag t, mfreader r, denonce *d
|
||||||
ArEncPar[i] = filter(pcs->odd) ^ oddparity(Nt);
|
ArEncPar[i] = filter(pcs->odd) ^ oddparity(Nt);
|
||||||
}
|
}
|
||||||
nfc_device_set_property_bool(r.pdi,NP_HANDLE_PARITY,false);
|
nfc_device_set_property_bool(r.pdi,NP_HANDLE_PARITY,false);
|
||||||
if (((RxLen = nfc_initiator_transceive_bits(r.pdi, ArEnc, 64, ArEncPar, Rx, RxPar)) < 0) || (RxLen != 32)) {
|
if (((res = nfc_initiator_transceive_bits(r.pdi, ArEnc, 64, ArEncPar, Rx, RxPar)) < 0) || (res != 32)) {
|
||||||
ERR ("Reader-answer transfer error, exiting..");
|
ERR ("Reader-answer transfer error, exiting..");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -822,7 +823,7 @@ int mf_enhanced_auth(int e_sector, int a_sector, mftag t, mfreader r, denonce *d
|
||||||
// Encrypt the parity bits with the 4 plaintext bytes
|
// Encrypt the parity bits with the 4 plaintext bytes
|
||||||
AuthEncPar[i] = filter(pcs->odd) ^ oddparity(Auth[i]);
|
AuthEncPar[i] = filter(pcs->odd) ^ oddparity(Auth[i]);
|
||||||
}
|
}
|
||||||
if ((RxLen = nfc_initiator_transceive_bits(r.pdi, AuthEnc, 32, AuthEncPar,Rx, RxPar)) < 0) {
|
if (nfc_initiator_transceive_bits(r.pdi, AuthEnc, 32, AuthEncPar,Rx, RxPar) < 0) {
|
||||||
ERR ("while requesting encrypted tag-nonce");
|
ERR ("while requesting encrypted tag-nonce");
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -920,7 +921,7 @@ int compar_special_int(const void * a, const void * b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
countKeys * uniqsort(uint64_t * possibleKeys, uint32_t size) {
|
countKeys * uniqsort(uint64_t * possibleKeys, uint32_t size) {
|
||||||
int i, j = 0;
|
unsigned int i, j = 0;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
countKeys *our_counts;
|
countKeys *our_counts;
|
||||||
|
|
||||||
|
|
12
src/mfoc.h
12
src/mfoc.h
|
@ -33,9 +33,9 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
u_int32_t *distances;
|
u_int32_t *distances;
|
||||||
u_int32_t median;
|
int32_t median;
|
||||||
u_int32_t num_distances;
|
int32_t num_distances;
|
||||||
u_int32_t tolerance;
|
int32_t tolerance;
|
||||||
uint8_t parity[3]; // used for 3 bits of parity information
|
uint8_t parity[3]; // used for 3 bits of parity information
|
||||||
} denonce; // Revealed information about nonce
|
} denonce; // Revealed information about nonce
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ typedef struct {
|
||||||
nfc_target nt;
|
nfc_target nt;
|
||||||
sector * sectors; // Allocate later, we do not know the number of sectors yet
|
sector * sectors; // Allocate later, we do not know the number of sectors yet
|
||||||
sector e_sector; // Exploit sector
|
sector e_sector; // Exploit sector
|
||||||
uint32_t num_sectors;
|
int32_t num_sectors;
|
||||||
uint32_t num_blocks;
|
int32_t num_blocks;
|
||||||
uint32_t uid;
|
uint32_t uid;
|
||||||
bool b4K;
|
bool b4K;
|
||||||
} mftag;
|
} mftag;
|
||||||
|
@ -56,7 +56,7 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint64_t *brokenKeys;
|
uint64_t *brokenKeys;
|
||||||
uint32_t size;
|
int32_t size;
|
||||||
} bKeys;
|
} bKeys;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
Loading…
Reference in a new issue