Skip to content

Commit 3a3ea75

Browse files
committed
style
1 parent 51ecdeb commit 3a3ea75

File tree

11 files changed

+123
-125
lines changed

11 files changed

+123
-125
lines changed

armsrc/appmain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1656,9 +1656,9 @@ static void PacketReceived(PacketCommandNG *packet) {
16561656
bool enumerate;
16571657
} PACKED;
16581658
struct p *payload = (struct p *) packet->data.asBytes;
1659-
SimulateIso14443aTagAID(payload->tagtype, payload->flags, payload->uid,
1660-
payload->rats, sizeof(payload->rats), payload->aid, payload->response,
1661-
payload->apdu, payload->aid_len, payload->respond_len,
1659+
SimulateIso14443aTagAID(payload->tagtype, payload->flags, payload->uid,
1660+
payload->rats, sizeof(payload->rats), payload->aid, payload->response,
1661+
payload->apdu, payload->aid_len, payload->respond_len,
16621662
payload->apdu_len, payload->enumerate); // ## Simulate iso14443a tag - pass tag type, UID, rats, aid, resp, apdu
16631663
break;
16641664
}

armsrc/iclass.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ static void generate_single_key_block_inverted_opt(const uint8_t *startingKey, u
21682168
0x95, 0x96, 0x99, 0x9A, 0x9C, 0xA3, 0xA5, 0xA6, 0xA9, 0xAA,
21692169
0xAC, 0xB1, 0xB2, 0xB4, 0xB8, 0xC3, 0xC5, 0xC6, 0xC9, 0xCA,
21702170
0xCC, 0xD1, 0xD2, 0xD4, 0xD8, 0xE1, 0xE2, 0xE4, 0xE8, 0xF0
2171-
};
2171+
};
21722172

21732173
uint8_t binary_endings[8]; // Array to store binary values for each ending bit
21742174
// Extract each bit from the ending_bits[k] and store it in binary_endings

armsrc/iso14443a.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ bool prepare_allocated_tag_modulation(tag_response_info_t *response_info, uint8_
11081108
}
11091109
}
11101110

1111-
bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data,
1111+
bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data,
11121112
uint8_t *iRATs, size_t irats_len, tag_response_info_t **responses,
11131113
uint32_t *cuid, uint32_t counters[3], uint8_t tearings[3], uint8_t *pages) {
11141114
uint8_t sak = 0;
@@ -1272,7 +1272,7 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data,
12721272
}
12731273
}
12741274

1275-
// copy the iRATs if supplied.
1275+
// copy the iRATs if supplied.
12761276
// iRATs is a pointer to 20 byte array
12771277
// rRATS is a 40 byte array
12781278
if ((flags & FLAG_RATS_IN_DATA) == FLAG_RATS_IN_DATA) {
@@ -1283,7 +1283,7 @@ bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data,
12831283
// Even if RATS protocol defined as max 40 bytes doesn't mean people try stuff
12841284
if (rRATS_len > sizeof(rRATS)) {
12851285
if (g_dbglevel >= DBG_ERROR) Dbprintf("[-] ERROR: iRATS overflow. Max %zu, got %zu", sizeof(rRATS), rRATS_len);
1286-
return false;
1286+
return false;
12871287
}
12881288
}
12891289

armsrc/iso14443a.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void SimulateIso14443aTagAID(uint8_t tagType, uint16_t flags, uint8_t *data,
149149
uint8_t *iRATs, size_t irats_len, uint8_t *aid, uint8_t *resp,
150150
uint8_t *apdu, int aid_len, int respond_len, int apdu_len, bool enumerate);
151151

152-
bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data,
152+
bool SimulateIso14443aInit(uint8_t tagType, uint16_t flags, uint8_t *data,
153153
uint8_t *iRATs, size_t irats_len, tag_response_info_t **responses,
154154
uint32_t *cuid, uint32_t counters[3], uint8_t tearings[3], uint8_t *pages);
155155

armsrc/mifarecmd.c

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -3128,82 +3128,82 @@ void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *
31283128
};
31293129
first_nt_counter++;
31303130
} else for (uint8_t i = 0; i < nr_nested; i++) {
3131-
if (need_first_auth) {
3132-
cuid = 0;
3131+
if (need_first_auth) {
3132+
cuid = 0;
31333133

3134-
if (hardreset) {
3134+
if (hardreset) {
3135+
if (g_dbglevel >= DBG_EXTENDED) {
3136+
Dbprintf("RF reset");
3137+
}
3138+
// some cards need longer than mf_reset_card() to see effect on nT
3139+
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
3140+
SpinDelay(150);
3141+
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
3142+
}
31353143
if (g_dbglevel >= DBG_EXTENDED) {
3136-
Dbprintf("RF reset");
3144+
Dbprintf("select");
31373145
}
3138-
// some cards need longer than mf_reset_card() to see effect on nT
3139-
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
3140-
SpinDelay(150);
3141-
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
3142-
}
3143-
if (g_dbglevel >= DBG_EXTENDED) {
3144-
Dbprintf("select");
3145-
}
3146-
if (iso14443a_select_card(NULL, NULL, &cuid, true, 0, true) == false) {
3147-
retval = PM3_ESOFT;
3148-
goto OUT;
3149-
}
3150-
if (mifare_classic_authex_cmd(pcs, cuid, block_no, key_auth_cmd, ui64key, AUTH_FIRST, &nt_first, NULL, NULL, NULL, corruptnrar, corruptnrarparity)) {
3151-
if (g_dbglevel >= DBG_ERROR) Dbprintf("Auth error");
3152-
retval = PM3_ESOFT;
3153-
goto OUT;
3154-
};
3155-
is_last_auth_first_auth = true;
3156-
first_nt_counter++;
3157-
if ((first_nt_counter > 1) && (old_nt_first == nt_first)) {
3158-
first_nt_repetition_counter++;
3159-
}
3160-
old_nt_first = nt_first;
3161-
if (!reset && !hardreset) {
3162-
need_first_auth = false;
3163-
}
3164-
if (addread) {
3165-
uint8_t dataread[16] = {0x00};
3166-
mifare_classic_readblock(pcs, block_no, dataread);
3167-
}
3168-
if (addauth) {
3169-
if (mifare_classic_authex_cmd(pcs, cuid, block_no, key_auth_cmd, ui64key, AUTH_NESTED, &nt, NULL, NULL, NULL, false, false)) {
3146+
if (iso14443a_select_card(NULL, NULL, &cuid, true, 0, true) == false) {
3147+
retval = PM3_ESOFT;
3148+
goto OUT;
3149+
}
3150+
if (mifare_classic_authex_cmd(pcs, cuid, block_no, key_auth_cmd, ui64key, AUTH_FIRST, &nt_first, NULL, NULL, NULL, corruptnrar, corruptnrarparity)) {
31703151
if (g_dbglevel >= DBG_ERROR) Dbprintf("Auth error");
31713152
retval = PM3_ESOFT;
31723153
goto OUT;
3173-
} else if (g_dbglevel >= DBG_EXTENDED) {
3174-
Dbprintf("Nonce distance: %5i (first nonce <> nested nonce)", nonce_distance(nt_first, nt));
3154+
};
3155+
is_last_auth_first_auth = true;
3156+
first_nt_counter++;
3157+
if ((first_nt_counter > 1) && (old_nt_first == nt_first)) {
3158+
first_nt_repetition_counter++;
3159+
}
3160+
old_nt_first = nt_first;
3161+
if (!reset && !hardreset) {
3162+
need_first_auth = false;
31753163
}
3176-
is_last_auth_first_auth = false;
3177-
if (nt == nt_first) {
3178-
first_and_nested_nt_repetition_counter++;
3164+
if (addread) {
3165+
uint8_t dataread[16] = {0x00};
3166+
mifare_classic_readblock(pcs, block_no, dataread);
3167+
}
3168+
if (addauth) {
3169+
if (mifare_classic_authex_cmd(pcs, cuid, block_no, key_auth_cmd, ui64key, AUTH_NESTED, &nt, NULL, NULL, NULL, false, false)) {
3170+
if (g_dbglevel >= DBG_ERROR) Dbprintf("Auth error");
3171+
retval = PM3_ESOFT;
3172+
goto OUT;
3173+
} else if (g_dbglevel >= DBG_EXTENDED) {
3174+
Dbprintf("Nonce distance: %5i (first nonce <> nested nonce)", nonce_distance(nt_first, nt));
3175+
}
3176+
is_last_auth_first_auth = false;
3177+
if (nt == nt_first) {
3178+
first_and_nested_nt_repetition_counter++;
3179+
}
3180+
old_nt = nt;
31793181
}
3180-
old_nt = nt;
31813182
}
3182-
}
31833183

3184-
nt = 0;
3185-
ntenc = 0;
3186-
if (mifare_classic_authex_cmd(pcs, cuid, incblk2 ? block_no_nested + (i * 4) : block_no_nested, key_auth_cmd_nested, ui64key_nested, AUTH_NESTED, &nt, &ntenc, &ntencpar, NULL, false, false)) {
3187-
if (g_dbglevel >= DBG_ERROR) Dbprintf("Nested auth error");
3188-
need_first_auth = true;
3189-
} else if (g_dbglevel >= DBG_EXTENDED) {
3190-
if (is_last_auth_first_auth) {
3191-
Dbprintf("Nonce distance: %5i (first nonce <> nested nonce)", nonce_distance(nt_first, nt));
3192-
} else {
3193-
Dbprintf("Nonce distance: %5i", nonce_distance(old_nt, nt));
3184+
nt = 0;
3185+
ntenc = 0;
3186+
if (mifare_classic_authex_cmd(pcs, cuid, incblk2 ? block_no_nested + (i * 4) : block_no_nested, key_auth_cmd_nested, ui64key_nested, AUTH_NESTED, &nt, &ntenc, &ntencpar, NULL, false, false)) {
3187+
if (g_dbglevel >= DBG_ERROR) Dbprintf("Nested auth error");
3188+
need_first_auth = true;
3189+
} else if (g_dbglevel >= DBG_EXTENDED) {
3190+
if (is_last_auth_first_auth) {
3191+
Dbprintf("Nonce distance: %5i (first nonce <> nested nonce)", nonce_distance(nt_first, nt));
3192+
} else {
3193+
Dbprintf("Nonce distance: %5i", nonce_distance(old_nt, nt));
3194+
}
31943195
}
3196+
nested_nt_session_counter++;
3197+
is_last_auth_first_auth = false;
3198+
old_nt = nt;
3199+
if (nt == nt_first) {
3200+
first_and_nested_nt_repetition_counter++;
3201+
}
3202+
if ((nested_nt_session_counter > 1) && (oldntenc == ntenc)) {
3203+
nested_nt_repetition_counter++;
3204+
}
3205+
oldntenc = ntenc;
31953206
}
3196-
nested_nt_session_counter++;
3197-
is_last_auth_first_auth = false;
3198-
old_nt = nt;
3199-
if (nt == nt_first) {
3200-
first_and_nested_nt_repetition_counter++;
3201-
}
3202-
if ((nested_nt_session_counter > 1) && (oldntenc == ntenc)) {
3203-
nested_nt_repetition_counter++;
3204-
}
3205-
oldntenc = ntenc;
3206-
}
32073207

32083208
data[1] = (cuid >> 24) & 0xFF;
32093209
data[2] = (cuid >> 16) & 0xFF;

client/pyscripts/fm11rf08_full.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def main():
162162

163163
dumpData(data, blkn)
164164

165-
# FIXME: nr of blocks depend on the tag. RF32 is 256, RF08 is 64, RF08S is 64+8,
165+
# FIXME: nr of blocks depend on the tag. RF32 is 256, RF08 is 64, RF08S is 64+8,
166166
# Currently dumpAcl is hardcoded for RF08S
167167
dumpAcl(data)
168168

client/src/cmdhficlass.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
483483
PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
484484

485485
//Block 13 (This is needed for Rev.C readers!)
486-
uint8_t block_0x13[PICOPASS_BLOCK_SIZE] = {0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x1C};
486+
uint8_t block_0x13[PICOPASS_BLOCK_SIZE] = {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C};
487487
memcpy(data + (0x13 * 8), block_0x13, sizeof(block_0x13));
488488

489489
// encrypted partial keyroll key 14
@@ -536,7 +536,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
536536
} else {
537537
memcpy(data, cc, sizeof(picopass_hdr_t));
538538
memcpy(data + (6 * 8), o->data, sizeof(o->data));
539-
if (strstr(o->desc, "Custom") != NULL){
539+
if (strstr(o->desc, "Custom") != NULL) {
540540
if (got_mk == false) {
541541
PrintAndLogEx(ERR, "please specify New Master Key!");
542542
free(data);
@@ -5066,16 +5066,16 @@ static int CmdHFiClassConfigCard(const char *Cmd) {
50665066
if (ccidx > -1 && ccidx < ARRAYLEN(iclass_config_options)) {
50675067
const iclass_config_card_item_t *item = get_config_card_item(ccidx);
50685068
if (strstr(item->desc, "ELITE") != NULL && got_kr == false) {
5069-
PrintAndLogEx(ERR, "please specify ELITE Key (--eki) !");
5070-
return PM3_EINVARG;
5069+
PrintAndLogEx(ERR, "please specify ELITE Key (--eki) !");
5070+
return PM3_EINVARG;
50715071
}
50725072
if (strstr(item->desc, "Custom") != NULL && got_mk == false) {
5073-
PrintAndLogEx(ERR, "please specify New Standard Master Key (--mrki) !");
5074-
return PM3_EINVARG;
5073+
PrintAndLogEx(ERR, "please specify New Standard Master Key (--mrki) !");
5074+
return PM3_EINVARG;
50755075
}
50765076
if (strstr(item->desc, "Restore") != NULL && card_kidx == -1) {
5077-
PrintAndLogEx(ERR, "please specify the Current Reader's Key (--ki) !");
5078-
return PM3_EINVARG;
5077+
PrintAndLogEx(ERR, "please specify the Current Reader's Key (--ki) !");
5078+
return PM3_EINVARG;
50795079
}
50805080
generate_config_card(item, keyroll_key, got_kr, card_key, got_eki, elite, got_mk, master_key);
50815081
}

0 commit comments

Comments
 (0)