mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
style
This commit is contained in:
parent
cef1f21a34
commit
a751684a31
3 changed files with 37 additions and 37 deletions
|
@ -1248,7 +1248,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
// SniffMifare(packet->oldarg[0]);
|
// SniffMifare(packet->oldarg[0]);
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
case CMD_HF_MIFARE_PERSONALIZE_UID: {
|
case CMD_HF_MIFARE_PERSONALIZE_UID: {
|
||||||
struct p {
|
struct p {
|
||||||
uint8_t keytype;
|
uint8_t keytype;
|
||||||
uint8_t pers_option;
|
uint8_t pers_option;
|
||||||
|
@ -1256,8 +1256,8 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||||
} PACKED;
|
} PACKED;
|
||||||
struct p *payload = (struct p *) packet->data.asBytes;
|
struct p *payload = (struct p *) packet->data.asBytes;
|
||||||
uint64_t authkey = bytes_to_num(payload->key, 6);
|
uint64_t authkey = bytes_to_num(payload->key, 6);
|
||||||
MifarePersonalizeUID(payload->keytype, payload->pers_option, authkey);
|
MifarePersonalizeUID(payload->keytype, payload->pers_option, authkey);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CMD_HF_MIFARE_SETMOD: {
|
case CMD_HF_MIFARE_SETMOD: {
|
||||||
MifareSetMod(packet->data.asBytes);
|
MifareSetMod(packet->data.asBytes);
|
||||||
|
|
|
@ -1811,53 +1811,53 @@ void MifareChkKeys_file(uint8_t *fn) {
|
||||||
void MifarePersonalizeUID(uint8_t keyType, uint8_t perso_option, uint64_t key) {
|
void MifarePersonalizeUID(uint8_t keyType, uint8_t perso_option, uint64_t key) {
|
||||||
|
|
||||||
uint16_t isOK = PM3_EUNDEF;
|
uint16_t isOK = PM3_EUNDEF;
|
||||||
uint8_t uid[10];
|
uint8_t uid[10];
|
||||||
uint32_t cuid;
|
uint32_t cuid;
|
||||||
struct Crypto1State mpcs = {0, 0};
|
struct Crypto1State mpcs = {0, 0};
|
||||||
struct Crypto1State *pcs;
|
struct Crypto1State *pcs;
|
||||||
pcs = &mpcs;
|
pcs = &mpcs;
|
||||||
|
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
clear_trace();
|
clear_trace();
|
||||||
set_tracing(true);
|
set_tracing(true);
|
||||||
|
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {
|
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {
|
||||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Can't select card");
|
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Can't select card");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t block_number = 0;
|
uint8_t block_number = 0;
|
||||||
if (mifare_classic_auth(pcs, cuid, block_number, keyType, key, AUTH_FIRST)) {
|
if (mifare_classic_auth(pcs, cuid, block_number, keyType, key, AUTH_FIRST)) {
|
||||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Auth error");
|
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Auth error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE];
|
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE];
|
||||||
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE];
|
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE];
|
||||||
int len = mifare_sendcmd_short(pcs, true, MIFARE_EV1_PERSONAL_UID, perso_option, receivedAnswer, receivedAnswerPar, NULL);
|
int len = mifare_sendcmd_short(pcs, true, MIFARE_EV1_PERSONAL_UID, perso_option, receivedAnswer, receivedAnswerPar, NULL);
|
||||||
if (len != 1 || receivedAnswer[0] != CARD_ACK) {
|
if (len != 1 || receivedAnswer[0] != CARD_ACK) {
|
||||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Cmd Error: %02x", receivedAnswer[0]);
|
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Cmd Error: %02x", receivedAnswer[0]);
|
||||||
break;;
|
break;;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mifare_classic_halt(pcs, cuid)) {
|
if (mifare_classic_halt(pcs, cuid)) {
|
||||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Halt error");
|
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Halt error");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
isOK = PM3_SUCCESS;
|
isOK = PM3_SUCCESS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
crypto1_deinit(pcs);
|
crypto1_deinit(pcs);
|
||||||
|
|
||||||
LED_B_ON();
|
LED_B_ON();
|
||||||
reply_ng(CMD_HF_MIFARE_PERSONALIZE_UID, isOK, NULL, 0);
|
reply_ng(CMD_HF_MIFARE_PERSONALIZE_UID, isOK, NULL, 0);
|
||||||
LED_B_OFF();
|
LED_B_OFF();
|
||||||
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue