Indent after last commit.
This commit is contained in:
parent
7ba83f79ed
commit
5aafbc9a48
1 changed files with 31 additions and 31 deletions
|
@ -227,43 +227,43 @@ main(int argc, char *argv[])
|
|||
} else {
|
||||
|
||||
// Create a MAD and mark unaccessible sectors in the card
|
||||
if (!(mad = mad_new ((freefare_get_tag_type (tags[i]) == CLASSIC_4K) ? 2 : 1))) {
|
||||
perror ("mad_new");
|
||||
error = 1;
|
||||
goto error;
|
||||
}
|
||||
if (!(mad = mad_new ((freefare_get_tag_type (tags[i]) == CLASSIC_4K) ? 2 : 1))) {
|
||||
perror ("mad_new");
|
||||
error = 1;
|
||||
goto error;
|
||||
}
|
||||
|
||||
MifareClassicSectorNumber max_s;
|
||||
switch (freefare_get_tag_type (tags[i])) {
|
||||
case CLASSIC_1K:
|
||||
max_s = 15;
|
||||
break;
|
||||
case CLASSIC_4K:
|
||||
max_s = 39;
|
||||
break;
|
||||
default:
|
||||
/* Keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
MifareClassicSectorNumber max_s;
|
||||
switch (freefare_get_tag_type (tags[i])) {
|
||||
case CLASSIC_1K:
|
||||
max_s = 15;
|
||||
break;
|
||||
case CLASSIC_4K:
|
||||
max_s = 39;
|
||||
break;
|
||||
default:
|
||||
/* Keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
|
||||
MifareClassicKey transport_key = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
MifareClassicKey transport_key = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
// Mark unusable sectors as so
|
||||
for (size_t s = max_s; s; s--) {
|
||||
if (s == 0x10) continue;
|
||||
if (!search_sector_key (tags[i], s, &(card_write_keys[s].key), &(card_write_keys[s].type))) {
|
||||
mad_set_aid (mad, s, mad_defect_aid);
|
||||
} else if ((memcmp (card_write_keys[s].key, transport_key, sizeof (transport_key)) != 0) &&
|
||||
(card_write_keys[s].type != MFC_KEY_A)) {
|
||||
// Revert to transport configuration
|
||||
if (mifare_classic_format_sector (tags[i], s) < 0) {
|
||||
perror ("mifare_classic_format_sector");
|
||||
error = 1;
|
||||
goto error;
|
||||
// Mark unusable sectors as so
|
||||
for (size_t s = max_s; s; s--) {
|
||||
if (s == 0x10) continue;
|
||||
if (!search_sector_key (tags[i], s, &(card_write_keys[s].key), &(card_write_keys[s].type))) {
|
||||
mad_set_aid (mad, s, mad_defect_aid);
|
||||
} else if ((memcmp (card_write_keys[s].key, transport_key, sizeof (transport_key)) != 0) &&
|
||||
(card_write_keys[s].type != MFC_KEY_A)) {
|
||||
// Revert to transport configuration
|
||||
if (mifare_classic_format_sector (tags[i], s) < 0) {
|
||||
perror ("mifare_classic_format_sector");
|
||||
error = 1;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MifareClassicSectorNumber *sectors = mifare_application_alloc (mad, mad_nfcforum_aid, encoded_size);
|
||||
if (!sectors) {
|
||||
|
|
Loading…
Reference in a new issue