mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
Use ARRAYLEN
This commit is contained in:
parent
da09131aa3
commit
1147c9faf8
5 changed files with 7 additions and 7 deletions
|
@ -431,7 +431,7 @@ int EPA_PACE_MSE_Set_AT(pace_version_info_t pace_version_info, uint8_t password)
|
||||||
// Perform the PACE protocol by replaying given APDUs
|
// Perform the PACE protocol by replaying given APDUs
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void EPA_PACE_Replay(PacketCommandNG *c) {
|
void EPA_PACE_Replay(PacketCommandNG *c) {
|
||||||
uint32_t timings[sizeof(apdu_lengths_replay) / sizeof(apdu_lengths_replay[0])] = {0};
|
uint32_t timings[ARRAYLEN(apdu_lengths_replay)] = {0};
|
||||||
|
|
||||||
// if an APDU has been passed, save it
|
// if an APDU has been passed, save it
|
||||||
if (c->oldarg[0] != 0) {
|
if (c->oldarg[0] != 0) {
|
||||||
|
|
|
@ -1930,7 +1930,7 @@ void check_challenges(bool file_given, uint8_t *data) {
|
||||||
}
|
}
|
||||||
txlen = 64;
|
txlen = 64;
|
||||||
|
|
||||||
if (u1 >= (sizeof(unlocker) / sizeof(unlocker[0])))
|
if (u1 >= ARRAYLEN(unlocker))
|
||||||
bStop = !false;
|
bStop = !false;
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
tx[i] = unlocker[u1][i];
|
tx[i] = unlocker[u1][i];
|
||||||
|
|
|
@ -650,7 +650,7 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||||
// get frame length from ATS in data field
|
// get frame length from ATS in data field
|
||||||
if (resp.oldarg[0] > 1) {
|
if (resp.oldarg[0] > 1) {
|
||||||
uint8_t fsci = resp.data.asBytes[1] & 0x0f;
|
uint8_t fsci = resp.data.asBytes[1] & 0x0f;
|
||||||
if (fsci < sizeof(atsFSC) / sizeof(atsFSC[0]))
|
if (fsci < ARRAYLEN(atsFSC))
|
||||||
frameLength = atsFSC[fsci];
|
frameLength = atsFSC[fsci];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -658,7 +658,7 @@ static int SelectCard14443_4(bool disconnect, iso14a_card_select_t *card) {
|
||||||
iso14a_card_select_t *vcard = (iso14a_card_select_t *) resp.data.asBytes;
|
iso14a_card_select_t *vcard = (iso14a_card_select_t *) resp.data.asBytes;
|
||||||
if (vcard->ats_len > 1) {
|
if (vcard->ats_len > 1) {
|
||||||
uint8_t fsci = vcard->ats[1] & 0x0f;
|
uint8_t fsci = vcard->ats[1] & 0x0f;
|
||||||
if (fsci < sizeof(atsFSC) / sizeof(atsFSC[0]))
|
if (fsci < ARRAYLEN(atsFSC))
|
||||||
frameLength = atsFSC[fsci];
|
frameLength = atsFSC[fsci];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1296,7 +1296,7 @@ int infoHF14A(bool verbose, bool do_nack_test) {
|
||||||
(tb1 ? "" : " NOT"),
|
(tb1 ? "" : " NOT"),
|
||||||
(tc1 ? "" : " NOT"),
|
(tc1 ? "" : " NOT"),
|
||||||
fsci,
|
fsci,
|
||||||
fsci < sizeof(atsFSC) / sizeof(atsFSC[0]) ? atsFSC[fsci] : -1
|
fsci < ARRAYLEN(atsFSC) ? atsFSC[fsci] : -1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
pos = 2;
|
pos = 2;
|
||||||
|
|
|
@ -1244,7 +1244,7 @@ static int CmdHF15Restore(const char *Cmd) {
|
||||||
for (int j = 0; j < blocksize; j++)
|
for (int j = 0; j < blocksize; j++)
|
||||||
snprintf(hex + j * 2, 3, "%02X", buff[j]);
|
snprintf(hex + j * 2, 3, "%02X", buff[j]);
|
||||||
|
|
||||||
for (int j = 0; j < sizeof(uid) / sizeof(uid[0]); j++)
|
for (int j = 0; j < ARRAYLEN(uid); j++)
|
||||||
snprintf(buff + j * 2, 3, "%02X", uid[j]);
|
snprintf(buff + j * 2, 3, "%02X", uid[j]);
|
||||||
|
|
||||||
//TODO: Addressed mode currently not work
|
//TODO: Addressed mode currently not work
|
||||||
|
|
|
@ -99,7 +99,7 @@ static int asn1_tlv_compare(const void *a, const void *b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct asn1_tag *asn1_get_tag(const struct tlv *tlv) {
|
static const struct asn1_tag *asn1_get_tag(const struct tlv *tlv) {
|
||||||
struct asn1_tag *tag = bsearch(tlv, asn1_tags, sizeof(asn1_tags) / sizeof(asn1_tags[0]),
|
struct asn1_tag *tag = bsearch(tlv, asn1_tags, ARRAYLEN(asn1_tags),
|
||||||
sizeof(asn1_tags[0]), asn1_tlv_compare);
|
sizeof(asn1_tags[0]), asn1_tlv_compare);
|
||||||
|
|
||||||
return tag ? tag : &asn1_tags[0];
|
return tag ? tag : &asn1_tags[0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue