mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-14 19:24:10 +08:00
style
This commit is contained in:
parent
cef1f21a34
commit
a751684a31
3 changed files with 37 additions and 37 deletions
|
@ -549,7 +549,7 @@ void ListenReaderField(uint8_t limit) {
|
|||
// iceman, useless, since we are measuring readerfield, not our field. My tests shows a max of 20v from a reader.
|
||||
hf_av = hf_max = AvgAdc(ADC_CHAN_HF_RDV40);
|
||||
#else
|
||||
hf_av = hf_max = AvgAdc(ADC_CHAN_HF);
|
||||
hf_av = hf_max = AvgAdc(ADC_CHAN_HF);
|
||||
#endif
|
||||
Dbprintf("HF 13.56MHz Baseline: %dmV", (MAX_ADC_HF_VOLTAGE * hf_av) >> 10);
|
||||
hf_baseline = hf_av;
|
||||
|
@ -1248,7 +1248,7 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
// SniffMifare(packet->oldarg[0]);
|
||||
// break;
|
||||
// }
|
||||
case CMD_HF_MIFARE_PERSONALIZE_UID: {
|
||||
case CMD_HF_MIFARE_PERSONALIZE_UID: {
|
||||
struct p {
|
||||
uint8_t keytype;
|
||||
uint8_t pers_option;
|
||||
|
@ -1256,8 +1256,8 @@ static void PacketReceived(PacketCommandNG *packet) {
|
|||
} PACKED;
|
||||
struct p *payload = (struct p *) packet->data.asBytes;
|
||||
uint64_t authkey = bytes_to_num(payload->key, 6);
|
||||
MifarePersonalizeUID(payload->keytype, payload->pers_option, authkey);
|
||||
break;
|
||||
MifarePersonalizeUID(payload->keytype, payload->pers_option, authkey);
|
||||
break;
|
||||
}
|
||||
case CMD_HF_MIFARE_SETMOD: {
|
||||
MifareSetMod(packet->data.asBytes);
|
||||
|
|
|
@ -1811,54 +1811,54 @@ void MifareChkKeys_file(uint8_t *fn) {
|
|||
void MifarePersonalizeUID(uint8_t keyType, uint8_t perso_option, uint64_t key) {
|
||||
|
||||
uint16_t isOK = PM3_EUNDEF;
|
||||
uint8_t uid[10];
|
||||
uint32_t cuid;
|
||||
struct Crypto1State mpcs = {0, 0};
|
||||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
uint8_t uid[10];
|
||||
uint32_t cuid;
|
||||
struct Crypto1State mpcs = {0, 0};
|
||||
struct Crypto1State *pcs;
|
||||
pcs = &mpcs;
|
||||
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
clear_trace();
|
||||
set_tracing(true);
|
||||
|
||||
LED_A_ON();
|
||||
|
||||
while (true) {
|
||||
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {
|
||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Can't select card");
|
||||
break;
|
||||
}
|
||||
LED_A_ON();
|
||||
|
||||
uint8_t block_number = 0;
|
||||
if (mifare_classic_auth(pcs, cuid, block_number, keyType, key, AUTH_FIRST)) {
|
||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Auth error");
|
||||
break;
|
||||
}
|
||||
while (true) {
|
||||
if (!iso14443a_select_card(uid, NULL, &cuid, true, 0, true)) {
|
||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Can't select card");
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE];
|
||||
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE];
|
||||
int len = mifare_sendcmd_short(pcs, true, MIFARE_EV1_PERSONAL_UID, perso_option, receivedAnswer, receivedAnswerPar, NULL);
|
||||
if (len != 1 || receivedAnswer[0] != CARD_ACK) {
|
||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Cmd Error: %02x", receivedAnswer[0]);
|
||||
break;;
|
||||
}
|
||||
uint8_t block_number = 0;
|
||||
if (mifare_classic_auth(pcs, cuid, block_number, keyType, key, AUTH_FIRST)) {
|
||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Auth error");
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE];
|
||||
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE];
|
||||
int len = mifare_sendcmd_short(pcs, true, MIFARE_EV1_PERSONAL_UID, perso_option, receivedAnswer, receivedAnswerPar, NULL);
|
||||
if (len != 1 || receivedAnswer[0] != CARD_ACK) {
|
||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Cmd Error: %02x", receivedAnswer[0]);
|
||||
break;;
|
||||
}
|
||||
|
||||
if (mifare_classic_halt(pcs, cuid)) {
|
||||
if (DBGLEVEL >= DBG_ERROR) Dbprintf("Halt error");
|
||||
break;
|
||||
}
|
||||
isOK = PM3_SUCCESS;
|
||||
break;
|
||||
}
|
||||
isOK = PM3_SUCCESS;
|
||||
break;
|
||||
}
|
||||
|
||||
crypto1_deinit(pcs);
|
||||
crypto1_deinit(pcs);
|
||||
|
||||
LED_B_ON();
|
||||
reply_ng(CMD_HF_MIFARE_PERSONALIZE_UID, isOK, NULL, 0);
|
||||
LED_B_OFF();
|
||||
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||
LEDsoff();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -537,13 +537,13 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t *datain, uint1
|
|||
|
||||
// find reader field
|
||||
if (cardSTATE == MFEMUL_NOFIELD) {
|
||||
|
||||
|
||||
#if defined RDV4
|
||||
vHf = (MAX_ADC_HF_VOLTAGE_RDV40 * AvgAdc(ADC_CHAN_HF_RDV40)) >> 10;
|
||||
#else
|
||||
vHf = (MAX_ADC_HF_VOLTAGE * AvgAdc(ADC_CHAN_HF)) >> 10;
|
||||
#endif
|
||||
|
||||
|
||||
if (vHf > MF_MINFIELDV) {
|
||||
cardSTATE_TO_IDLE();
|
||||
LED_A_ON();
|
||||
|
|
Loading…
Reference in a new issue