make style

This commit is contained in:
Philippe Teuwen 2022-01-05 18:56:56 +01:00
commit 5561466fe8
4 changed files with 44 additions and 44 deletions

View file

@ -1445,7 +1445,7 @@ void ReaderIClass(uint8_t flags) {
}; };
memcpy(&payload.header.hdr, &hdr, sizeof(picopass_hdr_t)); memcpy(&payload.header.hdr, &hdr, sizeof(picopass_hdr_t));
reply_ng(CMD_HF_ICLASS_READER, PM3_SUCCESS, (uint8_t*)&payload, sizeof(iclass_card_select_resp_t)); reply_ng(CMD_HF_ICLASS_READER, PM3_SUCCESS, (uint8_t *)&payload, sizeof(iclass_card_select_resp_t));
out: out:
switch_off(); switch_off();

View file

@ -280,7 +280,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
HFiClassCalcDivKey(cc->csn, iClass_Key_Table[0], cc->key_d, false); HFiClassCalcDivKey(cc->csn, iClass_Key_Table[0], cc->key_d, false);
} else { } else {
PrintAndLogEx(FAILED, "failed to read a card"); PrintAndLogEx(FAILED, "failed to read a card");
PrintAndLogEx(INFO,"falling back to default config card"); PrintAndLogEx(INFO, "falling back to default config card");
} }
// generate dump file // generate dump file
@ -338,7 +338,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
if (Encrypt(ffs, ffs) == false) { if (Encrypt(ffs, ffs) == false) {
PrintAndLogEx(WARNING, "failed to encrypt FF"); PrintAndLogEx(WARNING, "failed to encrypt FF");
} else { } else {
PrintAndLogEx(NORMAL,"( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
} }
// local key copy // local key copy
@ -349,7 +349,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
if (Encrypt(lkey, enckey1) == false) { if (Encrypt(lkey, enckey1) == false) {
PrintAndLogEx(WARNING, "failed to encrypt key1"); PrintAndLogEx(WARNING, "failed to encrypt key1");
} else { } else {
PrintAndLogEx(NORMAL,"( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
} }
PrintAndLogEx(INFO, "Copy data... " NOLF); PrintAndLogEx(INFO, "Copy data... " NOLF);
@ -362,7 +362,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
for (uint8_t i = 0xD; i < 0x14; i++) { for (uint8_t i = 0xD; i < 0x14; i++) {
memcpy(data + (i * 8), ffs, sizeof(ffs)); memcpy(data + (i * 8), ffs, sizeof(ffs));
} }
PrintAndLogEx(NORMAL,"( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
// encrypted partial keyroll key 14 // encrypted partial keyroll key 14
PrintAndLogEx(INFO, "Setting encrypted partial key14... " NOLF); PrintAndLogEx(INFO, "Setting encrypted partial key14... " NOLF);
@ -373,7 +373,7 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
PrintAndLogEx(WARNING, "failed to encrypt partial 1"); PrintAndLogEx(WARNING, "failed to encrypt partial 1");
} }
memcpy(data + (0x14 * 8), enckey2, sizeof(enckey2)); memcpy(data + (0x14 * 8), enckey2, sizeof(enckey2));
PrintAndLogEx(NORMAL,"( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
// encrypted partial keyroll key 15 // encrypted partial keyroll key 15
@ -384,14 +384,14 @@ static int generate_config_card(const iclass_config_card_item_t *o, uint8_t *ke
PrintAndLogEx(WARNING, "failed to encrypt partial 2"); PrintAndLogEx(WARNING, "failed to encrypt partial 2");
} }
memcpy(data + (0x15 * 8), enckey2, sizeof(enckey2)); memcpy(data + (0x15 * 8), enckey2, sizeof(enckey2));
PrintAndLogEx(NORMAL,"( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
// encrypted 0xFF // encrypted 0xFF
PrintAndLogEx(INFO, "Setting 0xFF's... " NOLF); PrintAndLogEx(INFO, "Setting 0xFF's... " NOLF);
for (uint8_t i = 0x16; i <= app1_limit; i++) { for (uint8_t i = 0x16; i <= app1_limit; i++) {
memcpy(data + (i * 8), ffs, sizeof(ffs)); memcpy(data + (i * 8), ffs, sizeof(ffs));
} }
PrintAndLogEx(NORMAL,"( " _GREEN_("ok") " )"); PrintAndLogEx(NORMAL, "( " _GREEN_("ok") " )");
// revert potential modified app1_limit // revert potential modified app1_limit
cc->conf.app_limit = old_limit; cc->conf.app_limit = old_limit;
@ -569,14 +569,14 @@ static void mem_app_config(const picopass_hdr_t *hdr) {
PrintAndLogEx(INFO, " First book / first page configuration"); PrintAndLogEx(INFO, " First book / first page configuration");
PrintAndLogEx(INFO, " Config | 0 - 5 ( 0x00 - 0x05 ) - 6 blocks "); PrintAndLogEx(INFO, " Config | 0 - 5 ( 0x00 - 0x05 ) - 6 blocks ");
PrintAndLogEx(INFO, " AA1 | 6 - %2d ( 0x06 - 0x%02X ) - %u blocks", app1_limit + 5, app1_limit + 5, app1_limit); PrintAndLogEx(INFO, " AA1 | 6 - %2d ( 0x06 - 0x%02X ) - %u blocks", app1_limit + 5, app1_limit + 5, app1_limit);
if (app1_limit + 5 < app2_limit ) { if (app1_limit + 5 < app2_limit) {
PrintAndLogEx(INFO, " AA2 | %2d - %2d ( 0x%02X - 0x%02X ) - %u blocks", app1_limit + 5 + 1, app2_limit, app1_limit + 5 + 1, app2_limit, app2_limit - app1_limit); PrintAndLogEx(INFO, " AA2 | %2d - %2d ( 0x%02X - 0x%02X ) - %u blocks", app1_limit + 5 + 1, app2_limit, app1_limit + 5 + 1, app2_limit, app2_limit - app1_limit);
} }
/* /*
[=] 32 KBits/3 App Areas ( 2048 bytes ) [=] 32 KBits/3 App Areas ( 2048 bytes )
[=] AA1 blocks 250 { 0x06 - 0xFF (06 - 255) } [=] AA1 blocks 250 { 0x06 - 0xFF (06 - 255) }
[=] AA2 blocks 5 { 0x100 - 0xFF (256 - 255) } [=] AA2 blocks 5 { 0x100 - 0xFF (256 - 255) }
*/ */
PrintAndLogEx(INFO, "------------------------- " _CYAN_("KeyAccess") " ------------------------"); PrintAndLogEx(INFO, "------------------------- " _CYAN_("KeyAccess") " ------------------------");
PrintAndLogEx(INFO, " * Kd, Debit key, AA1 Kc, Credit key, AA2 *"); PrintAndLogEx(INFO, " * Kd, Debit key, AA1 Kc, Credit key, AA2 *");
@ -906,11 +906,11 @@ int read_iclass_csn(bool loop, bool verbose) {
do { do {
clearCommandBuffer(); clearCommandBuffer();
PacketResponseNG resp; PacketResponseNG resp;
SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t*)&payload, sizeof(iclass_card_select_t)); SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t *)&payload, sizeof(iclass_card_select_t));
if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000)) { if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000)) {
iclass_card_select_resp_t *r = (iclass_card_select_resp_t*)resp.data.asBytes; iclass_card_select_resp_t *r = (iclass_card_select_resp_t *)resp.data.asBytes;
if (loop) { if (loop) {
if (resp.status == PM3_ERFTRANS) { if (resp.status == PM3_ERFTRANS) {
continue; continue;
@ -1550,14 +1550,14 @@ static bool select_only(uint8_t *CSN, uint8_t *CCNR, bool verbose) {
clearCommandBuffer(); clearCommandBuffer();
PacketResponseNG resp; PacketResponseNG resp;
SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t*)&payload, sizeof(iclass_card_select_t)); SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t *)&payload, sizeof(iclass_card_select_t));
if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000) == false) { if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000) == false) {
PrintAndLogEx(WARNING, "command execute timeout"); PrintAndLogEx(WARNING, "command execute timeout");
return false; return false;
} }
iclass_card_select_resp_t *r = (iclass_card_select_resp_t*)resp.data.asBytes; iclass_card_select_resp_t *r = (iclass_card_select_resp_t *)resp.data.asBytes;
picopass_hdr_t *hdr = &r->header.hdr; picopass_hdr_t *hdr = &r->header.hdr;
// no tag found or button pressed // no tag found or button pressed
@ -1704,7 +1704,7 @@ static int CmdHFiClassDump(const char *Cmd) {
}; };
clearCommandBuffer(); clearCommandBuffer();
PacketResponseNG resp; PacketResponseNG resp;
SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t*)&payload_rdr, sizeof(iclass_card_select_t)); SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t *)&payload_rdr, sizeof(iclass_card_select_t));
if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000) == false) { if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000) == false) {
PrintAndLogEx(WARNING, "command execute timeout"); PrintAndLogEx(WARNING, "command execute timeout");
@ -1719,7 +1719,7 @@ static int CmdHFiClassDump(const char *Cmd) {
return PM3_ESOFT; return PM3_ESOFT;
} }
iclass_card_select_resp_t *r = (iclass_card_select_resp_t*)resp.data.asBytes; iclass_card_select_resp_t *r = (iclass_card_select_resp_t *)resp.data.asBytes;
if (r->status == FLAG_ICLASS_NULL) { if (r->status == FLAG_ICLASS_NULL) {
PrintAndLogEx(FAILED, "failed to read block 0,1,2"); PrintAndLogEx(FAILED, "failed to read block 0,1,2");
return PM3_ESOFT; return PM3_ESOFT;
@ -4042,7 +4042,7 @@ int info_iclass(void) {
}; };
clearCommandBuffer(); clearCommandBuffer();
PacketResponseNG resp; PacketResponseNG resp;
SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t*)&payload, sizeof(iclass_card_select_t)); SendCommandNG(CMD_HF_ICLASS_READER, (uint8_t *)&payload, sizeof(iclass_card_select_t));
if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000) == false) { if (WaitForResponseTimeout(CMD_HF_ICLASS_READER, &resp, 2000) == false) {
DropField(); DropField();
@ -4050,7 +4050,7 @@ int info_iclass(void) {
} }
DropField(); DropField();
iclass_card_select_resp_t *r = (iclass_card_select_resp_t*)resp.data.asBytes; iclass_card_select_resp_t *r = (iclass_card_select_resp_t *)resp.data.asBytes;
// no tag found or button pressed // no tag found or button pressed
if (r->status == FLAG_ICLASS_NULL || resp.status == PM3_ERFTRANS) { if (r->status == FLAG_ICLASS_NULL || resp.status == PM3_ERFTRANS) {