Rename few stuff for consistency

This commit is contained in:
Philippe Teuwen
2019-04-18 12:43:35 +02:00
parent 15558070ad
commit 482db05741
83 changed files with 691 additions and 675 deletions

View File

@@ -428,12 +428,12 @@ failtag:
err = 1;
allKeysFound = false;
// used in “portable” imlementation on microcontroller: it reports back the fail and open the standalone lock
// cmd_send(CMD_CJB_FSMSTATE_MENU, 0, 0, 0, 0, 0);
// reply_old(CMD_CJB_FSMSTATE_MENU, 0, 0, 0, 0, 0);
break;
} else if (key == -2) {
err = 1; // Can't select card.
allKeysFound = false;
// cmd_send(CMD_CJB_FSMSTATE_MENU, 0, 0, 0, 0, 0);
// reply_old(CMD_CJB_FSMSTATE_MENU, 0, 0, 0, 0, 0);
break;
} else {
/* BRACE YOURSELF : AS LONG AS WE TRAP A KNOWN KEY, WE STOP CHECKING AND ENFORCE KNOWN SCHEMES */
@@ -442,7 +442,7 @@ failtag:
num_to_bytes(key64, 6, foundKey[type][sec]);
cjSetCursRight();
DbprintfEx(FLAG_NOLOG, "SEC: %02x ; KEY : %012" PRIx64 " ; TYP: %i", sec, key64, type);
/*cmd_send(CMD_CJB_INFORM_CLIENT_KEY, 12, sec, type, tosendkey, 12);*/
/*reply_old(CMD_CJB_INFORM_CLIENT_KEY, 12, sec, type, tosendkey, 12);*/
switch (key64) {
/////////////////////////////////////////////////////////
// COMMON SCHEME 1 : INFINITRON/HEXACT

View File

@@ -132,12 +132,12 @@ void RunMod() {
SpinDelay(500);
// Begin clone function here:
/* Example from client/mifarehost.c for commanding a block write for "magic Chinese" cards:
UsbCommand c = {CMD_MIFARE_CSETBLOCK, {params & (0xFE | (uid == NULL ? 0:1)), blockNo, 0}};
PacketCommandOLD c = {CMD_MIFARE_CSETBLOCK, {params & (0xFE | (uid == NULL ? 0:1)), blockNo, 0}};
memcpy(c.d.asBytes, data, 16);
SendCommand(&c);
Block read is similar:
UsbCommand c = {CMD_MIFARE_CGETBLOCK, {params, blockNo, 0}};
PacketCommandOLD c = {CMD_MIFARE_CGETBLOCK, {params, blockNo, 0}};
We need to imitate that call with blockNo 0 to set a uid.
The get and set commands are handled in this file:

View File

@@ -117,7 +117,7 @@ void print_result(char *name, uint8_t *buf, size_t len) {
void DbpStringEx(char *str, uint32_t cmd) {
#if DEBUG
uint8_t len = strlen(str);
cmd_send(CMD_DEBUG_PRINT_STRING, len, cmd, 0, (uint8_t *)str, len);
reply_old(CMD_DEBUG_PRINT_STRING, len, cmd, 0, (uint8_t *)str, len);
#endif
}
@@ -129,7 +129,7 @@ void DbpString(char *str) {
#if 0
void DbpIntegers(int x1, int x2, int x3) {
cmd_send(CMD_DEBUG_PRINT_INTEGERS, x1, x2, x3, 0, 0);
reply_old(CMD_DEBUG_PRINT_INTEGERS, x1, x2, x3, 0, 0);
}
#endif
void DbprintfEx(uint32_t cmd, const char *fmt, ...) {
@@ -289,7 +289,7 @@ void MeasureAntennaTuning(void) {
arg2 <<= 32;
arg2 |= peakf;
cmd_send(CMD_MEASURED_ANTENNA_TUNING, arg0, v_hf, arg2, LF_Results, 256);
reply_old(CMD_MEASURED_ANTENNA_TUNING, arg0, v_hf, arg2, LF_Results, 256);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
}
@@ -359,11 +359,11 @@ void SendVersion(void) {
// Send Chip ID and used flash memory
uint32_t text_and_rodata_section_size = (uint32_t)&__data_src_start__ - (uint32_t)&_flash_start;
uint32_t compressed_data_section_size = common_area.arg1;
cmd_send(CMD_ACK, *(AT91C_DBGU_CIDR), text_and_rodata_section_size + compressed_data_section_size, 0, VersionString, strlen(VersionString));
reply_old(CMD_ACK, *(AT91C_DBGU_CIDR), text_and_rodata_section_size + compressed_data_section_size, 0, VersionString, strlen(VersionString));
}
// measure the USB Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the UsbCommandOLD structure included.
// Note: this mimics GetFromBigbuf(), i.e. we have the overhead of the PacketCommandOLD structure included.
void printUSBSpeed(void) {
Dbprintf("USB Speed");
Dbprintf(" Sending USB packets to client...");
@@ -412,7 +412,7 @@ void SendStatus(void) {
Dbprintf(" ToSendBit...............%d", ToSendBit);
Dbprintf(" ToSend BUFFERSIZE.......%d", TOSEND_BUFFER_SIZE);
printStandAloneModes();
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
}
// Show some leds in a pattern to identify StandAlone mod is running
@@ -633,7 +633,7 @@ void ListenReaderField(int limit) {
}
}
static void UsbPacketReceived(UsbCommandNG *packet) {
static void PacketReceived(PacketCommandNG *packet) {
/*
if (packet->ng) {
Dbprintf("received NG frame with %d bytes payload, with command: 0x%04x", packet->length, cmd);
@@ -652,7 +652,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
break;
case CMD_ACQUIRE_RAW_ADC_SAMPLES_125K: {
uint32_t bits = SampleLF(packet->oldarg[0], packet->oldarg[1]);
cmd_send(CMD_ACK, bits, 0, 0, 0, 0);
reply_old(CMD_ACK, bits, 0, 0, 0, 0);
break;
}
case CMD_MOD_THEN_ACQUIRE_RAW_ADC_SAMPLES_125K:
@@ -660,7 +660,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
break;
case CMD_LF_SNIFF_RAW_ADC_SAMPLES: {
uint32_t bits = SniffLF();
cmd_send(CMD_ACK, bits, 0, 0, 0, 0);
reply_old(CMD_ACK, bits, 0, 0, 0, 0);
break;
}
case CMD_HID_DEMOD_FSK: {
@@ -1078,7 +1078,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
// upload file from client
uint8_t *mem = BigBuf_get_addr();
memcpy(mem + packet->oldarg[0], packet->data.asBytes, USB_CMD_DATA_SIZE);
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
break;
}
case CMD_SMART_UPGRADE: {
@@ -1136,25 +1136,25 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
//usb
cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
reply_old(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
LED_A_OFF();
/*
uint8_t my_rx[sizeof(UsbCommandOLD)];
uint8_t my_rx[sizeof(PacketCommandOLD)];
while (!BUTTON_PRESS() && !usb_poll_validate_length()) {
LED_B_INV();
if (usart_readbuffer(my_rx) ) {
//UsbPacketReceived(my_rx, sizeof(my_rx));
//PacketReceived(my_rx, sizeof(my_rx));
UsbCommandOLD *my = (UsbCommandOLD *)my_rx;
PacketCommandOLD *my = (PacketCommandOLD *)my_rx;
if (my->cmd > 0 ) {
Dbprintf("received command: 0x%04x and args: %d %d %d", my->cmd, my->arg[0], my->arg[1], my->arg[2]);
}
}
}
*/
//cmd_send(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
//reply_old(CMD_DEBUG_PRINT_STRING, strlen(dest), 0, 0, dest, strlen(dest));
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
StopTicks();
break;
}
@@ -1194,7 +1194,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
for (size_t i = 0; i < numofbytes; i += USB_CMD_DATA_SIZE) {
size_t len = MIN((numofbytes - i), USB_CMD_DATA_SIZE);
bool isok = cmd_send(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, i, len, BigBuf_get_traceLen(), mem + startidx + i, len);
bool isok = reply_old(CMD_DOWNLOADED_RAW_ADC_SAMPLES_125K, i, len, BigBuf_get_traceLen(), mem + startidx + i, len);
if (isok != 0)
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d)", i, i + len, len);
}
@@ -1204,7 +1204,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
// arg1 = RFU
// arg2 = tracelen?
// asbytes = samplingconfig array
cmd_send(CMD_ACK, 1, 0, BigBuf_get_traceLen(), getSamplingConfig(), sizeof(sample_config));
reply_old(CMD_ACK, 1, 0, BigBuf_get_traceLen(), getSamplingConfig(), sizeof(sample_config));
LED_B_OFF();
break;
}
@@ -1222,7 +1222,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
uint8_t *mem = BigBuf_get_addr();
memcpy(mem + packet->oldarg[0], packet->data.asBytes, USB_CMD_DATA_SIZE);
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
break;
}
case CMD_DOWNLOAD_EML_BIGBUF: {
@@ -1239,12 +1239,12 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
for (size_t i = 0; i < numofbytes; i += USB_CMD_DATA_SIZE) {
len = MIN((numofbytes - i), USB_CMD_DATA_SIZE);
isok = cmd_send(CMD_DOWNLOADED_EML_BIGBUF, i, len, 0, mem + startidx + i, len);
isok = reply_old(CMD_DOWNLOADED_EML_BIGBUF, i, len, 0, mem + startidx + i, len);
if (isok != 0)
Dbprintf("transfer to client failed :: | bytes between %d - %d (%d)", i, i + len, len);
}
// Trigger a finish downloading signal with an ACK frame
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
LED_B_OFF();
break;
}
@@ -1346,7 +1346,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
}
FlashStop();
cmd_send(CMD_ACK, isok, 0, 0, 0, 0);
reply_old(CMD_ACK, isok, 0, 0, 0, 0);
LED_B_OFF();
break;
}
@@ -1357,14 +1357,14 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
bool isok = false;
if (initalwipe) {
isok = Flash_WipeMemory();
cmd_send(CMD_ACK, isok, 0, 0, 0, 0);
reply_old(CMD_ACK, isok, 0, 0, 0, 0);
LED_B_OFF();
break;
}
if (page < 3)
isok = Flash_WipeMemoryPage(page);
cmd_send(CMD_ACK, isok, 0, 0, 0, 0);
reply_old(CMD_ACK, isok, 0, 0, 0, 0);
LED_B_OFF();
break;
}
@@ -1389,13 +1389,13 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
if (!isok)
Dbprintf("reading flash memory failed :: | bytes between %d - %d", i, len);
isok = cmd_send(CMD_FLASHMEM_DOWNLOADED, i, len, 0, mem, len);
isok = reply_old(CMD_FLASHMEM_DOWNLOADED, i, len, 0, mem, len);
if (isok != 0)
Dbprintf("transfer to client failed :: | bytes between %d - %d", i, len);
}
FlashStop();
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
BigBuf_free();
LED_B_OFF();
break;
@@ -1411,7 +1411,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
Flash_UniqueID(info->flashid);
FlashStop();
}
cmd_send(CMD_ACK, isok, 0, 0, info, sizeof(rdv40_validation_t));
reply_old(CMD_ACK, isok, 0, 0, info, sizeof(rdv40_validation_t));
BigBuf_free();
LED_B_OFF();
@@ -1453,9 +1453,9 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
reply_ng(CMD_PING, PM3_SUCCESS, packet->data.asBytes, packet->length);
} else {
#ifdef WITH_FPC_HOST
cmd_send(CMD_ACK, reply_via_fpc, 0, 0, 0, 0);
reply_old(CMD_ACK, reply_via_fpc, 0, 0, 0, 0);
#else
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
#endif
}
break;
@@ -1494,7 +1494,7 @@ static void UsbPacketReceived(UsbCommandNG *packet) {
if (common_area.flags.bootrom_present) {
dev_info |= DEVICE_INFO_FLAG_BOOTROM_PRESENT;
}
cmd_send(CMD_DEVICE_INFO, dev_info, 0, 0, 0, 0);
reply_old(CMD_DEVICE_INFO, dev_info, 0, 0, 0, 0);
break;
}
default:
@@ -1568,9 +1568,9 @@ void __attribute__((noreturn)) AppMain(void) {
// Check if there is a usb packet available
if (usb_poll_validate_length()) {
UsbCommandNG rx;
PacketCommandNG rx;
if (receive_ng(&rx) == PM3_SUCCESS) {
UsbPacketReceived(&rx);
PacketReceived(&rx);
} else {
Dbprintf("Error in frame reception");
// TODO DOEGOX if error, shall we resync ?
@@ -1579,14 +1579,14 @@ void __attribute__((noreturn)) AppMain(void) {
#ifdef WITH_FPC_HOST
// Check if there is a FPC packet available
// TODO DOEGOX NG packets support here too
UsbCommandNG rx;
PacketCommandNG rx;
if (usart_readbuffer((uint8_t *)&rx)) {
reply_via_fpc = true;
rx.ng = false;
rx.magic = 0;
rx.length = USB_CMD_DATA_SIZE;
rx.crc = 0;
UsbPacketReceived(&rx);
PacketReceived(&rx);
}
usart_readcheck((uint8_t *)&rx, sizeof(rx));
#endif

View File

@@ -120,13 +120,13 @@ void AcquireRawAdcSamplesIso14443b(uint32_t parameter);
void ReadSTMemoryIso14443b(uint8_t numofblocks);
void RAMFUNC SniffIso14443b(void);
void SendRawCommand14443B(uint32_t, uint32_t, uint8_t, uint8_t[]);
void SendRawCommand14443B_Ex(UsbCommandNG *c);
void SendRawCommand14443B_Ex(PacketCommandNG *c);
void ClearFpgaShiftingRegisters(void);
// iso14443a.h
void RAMFUNC SniffIso14443a(uint8_t param);
void SimulateIso14443aTag(int tagType, int flags, uint8_t *data);
void ReaderIso14443a(UsbCommandNG *c);
void ReaderIso14443a(PacketCommandNG *c);
// Also used in iclass.c
//bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t len, uint32_t timestamp_start, uint32_t timestamp_end, uint8_t *parity, bool readerToTag);
@@ -137,8 +137,8 @@ void iso14a_set_trigger(bool enable);
//int GetIso14443aCommandFromReader(uint8_t *received, uint8_t *parity, int *len);
// epa.h
void EPA_PACE_Collect_Nonce(UsbCommandNG *c);
void EPA_PACE_Replay(UsbCommandNG *c);
void EPA_PACE_Collect_Nonce(PacketCommandNG *c);
void EPA_PACE_Replay(PacketCommandNG *c);
// mifarecmd.h
void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain);
@@ -222,13 +222,13 @@ void iClass_Clone(uint8_t startblock, uint8_t endblock, uint8_t *data);
void iClass_ReadCheck(uint8_t blockno, uint8_t keytype);
// cmd.h
uint8_t cmd_send(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
uint8_t reply_old(uint64_t cmd, uint64_t arg0, uint64_t arg1, uint64_t arg2, void *data, size_t len);
// util.h
void HfSniff(int, int);
//felica.c
void felica_sendraw(UsbCommandNG *c);
void felica_sendraw(PacketCommandNG *c);
void felica_sniff(uint32_t samplesToSkip, uint32_t triggersToSkip);
void felica_sim_lite(uint64_t uid);
void felica_dump_lite_s();

View File

@@ -253,13 +253,13 @@ static void EPA_PACE_Collect_Nonce_Abort(uint8_t step, int func_return) {
EPA_Finish();
// send the USB packet
cmd_send(CMD_ACK, step, func_return, 0, 0, 0);
reply_old(CMD_ACK, step, func_return, 0, 0, 0);
}
//-----------------------------------------------------------------------------
// Acquire one encrypted PACE nonce
//-----------------------------------------------------------------------------
void EPA_PACE_Collect_Nonce(UsbCommandNG *c) {
void EPA_PACE_Collect_Nonce(PacketCommandNG *c) {
/*
* ack layout:
* arg:
@@ -325,7 +325,7 @@ void EPA_PACE_Collect_Nonce(UsbCommandNG *c) {
EPA_Finish();
// save received information
cmd_send(CMD_ACK, 0, func_return, 0, nonce, func_return);
reply_old(CMD_ACK, 0, func_return, 0, nonce, func_return);
}
//-----------------------------------------------------------------------------
@@ -430,14 +430,14 @@ int EPA_PACE_MSE_Set_AT(pace_version_info_t pace_version_info, uint8_t password)
//-----------------------------------------------------------------------------
// Perform the PACE protocol by replaying given APDUs
//-----------------------------------------------------------------------------
void EPA_PACE_Replay(UsbCommandNG *c) {
void EPA_PACE_Replay(PacketCommandNG *c) {
uint32_t timings[sizeof(apdu_lengths_replay) / sizeof(apdu_lengths_replay[0])] = {0};
// if an APDU has been passed, save it
if (c->oldarg[0] != 0) {
// make sure it's not too big
if (c->oldarg[2] > apdus_replay[c->oldarg[0] - 1].len) {
cmd_send(CMD_ACK, 1, 0, 0, NULL, 0);
reply_old(CMD_ACK, 1, 0, 0, NULL, 0);
}
memcpy(apdus_replay[c->oldarg[0] - 1].data + c->oldarg[1],
c->data.asBytes,
@@ -448,7 +448,7 @@ void EPA_PACE_Replay(UsbCommandNG *c) {
} else {
apdu_lengths_replay[c->oldarg[0] - 1] += c->oldarg[2];
}
cmd_send(CMD_ACK, 0, 0, 0, NULL, 0);
reply_old(CMD_ACK, 0, 0, 0, NULL, 0);
return;
}
@@ -459,7 +459,7 @@ void EPA_PACE_Replay(UsbCommandNG *c) {
func_return = EPA_Setup();
if (func_return != 0) {
EPA_Finish();
cmd_send(CMD_ACK, 2, func_return, 0, NULL, 0);
reply_old(CMD_ACK, 2, func_return, 0, NULL, 0);
return;
}
@@ -482,12 +482,12 @@ void EPA_PACE_Replay(UsbCommandNG *c) {
|| response_apdu[func_return - 4] != 0x90
|| response_apdu[func_return - 3] != 0x00)) {
EPA_Finish();
cmd_send(CMD_ACK, 3 + i, func_return, 0, timings, 20);
reply_old(CMD_ACK, 3 + i, func_return, 0, timings, 20);
return;
}
}
EPA_Finish();
cmd_send(CMD_ACK, 0, 0, 0, timings, 20);
reply_old(CMD_ACK, 0, 0, 0, timings, 20);
return;
}

View File

@@ -475,7 +475,7 @@ static void iso18092_setup(uint8_t fpga_minor_mode) {
// arg0 FeliCa flags
// arg1 len of commandbytes
// d.asBytes command bytes to send
void felica_sendraw(UsbCommandNG *c) {
void felica_sendraw(PacketCommandNG *c) {
if (MF_DBGLEVEL > 3) Dbprintf("FeliCa_sendraw Enter");
@@ -498,7 +498,7 @@ void felica_sendraw(UsbCommandNG *c) {
// if failed selecting, turn off antenna and quite.
if (!(param & FELICA_NO_SELECT)) {
arg0 = felica_select_card(&card);
cmd_send(CMD_ACK, arg0, sizeof(card.uid), 0, &card, sizeof(felica_card_select_t));
reply_old(CMD_ACK, arg0, sizeof(card.uid), 0, &card, sizeof(felica_card_select_t));
if (arg0 > 0)
goto OUT;
}
@@ -525,7 +525,7 @@ void felica_sendraw(UsbCommandNG *c) {
TransmitFor18092_AsReader(buf, buf[2] + 4, NULL, 1, 0);
arg0 = !WaitForFelicaReply(1024);
cmd_send(CMD_ACK, arg0, 0, 0, FelicaFrame.framebytes + 2, FelicaFrame.len - 2);
reply_old(CMD_ACK, arg0, 0, 0, FelicaFrame.framebytes + 2, FelicaFrame.len - 2);
}
if ((param & FELICA_NO_DISCONNECT))
@@ -603,7 +603,7 @@ void felica_sniff(uint32_t samplesToSkip, uint32_t triggersToSkip) {
set_tracelen(numbts);
Dbprintf("Felica sniffing done, tracelen: %i, use hf list felica for annotations", BigBuf_get_traceLen());
cmd_send(CMD_ACK, 1, numbts, 0, 0, 0);
reply_old(CMD_ACK, 1, numbts, 0, 0, 0);
}
#define R_POLL0_LEN 0x16
@@ -794,5 +794,5 @@ void felica_dump_lite_s() {
//setting tracelen - important! it was set by buffer overflow before
set_tracelen(cnt);
cmd_send(CMD_ACK, isOK, cnt, 0, 0, 0);
reply_old(CMD_ACK, isOK, cnt, 0, 0, 0);
}

View File

@@ -1350,9 +1350,9 @@ out:
StartTicks();
if (bSuccessful)
cmd_send(CMD_ACK, bSuccessful, 0, 0, (uint8_t *)tag.sectors, 48);
reply_old(CMD_ACK, bSuccessful, 0, 0, (uint8_t *)tag.sectors, 48);
else
cmd_send(CMD_ACK, bSuccessful, 0, 0, 0, 0);
reply_old(CMD_ACK, bSuccessful, 0, 0, 0, 0);
}
void WriterHitag(hitag_function htf, hitag_data *htd, int page) {
@@ -1613,5 +1613,5 @@ void WriterHitag(hitag_function htf, hitag_data *htd, int page) {
StartTicks();
cmd_send(CMD_ACK, bSuccessful, 0, 0, (uint8_t *)tag.sectors, 48);
reply_old(CMD_ACK, bSuccessful, 0, 0, (uint8_t *)tag.sectors, 48);
}

View File

@@ -1444,7 +1444,7 @@ void ReadHitagS(hitag_function htf, hitag_data *htd) {
StartTicks();
cmd_send(CMD_ACK, bSuccessful, 0, 0, 0, 0);
reply_old(CMD_ACK, bSuccessful, 0, 0, 0, 0);
}
/*
@@ -1737,7 +1737,7 @@ void WritePageHitagS(hitag_function htf, hitag_data *htd, int page) {
StartTicks();
cmd_send(CMD_ACK, bSuccessful, 0, 0, 0, 0);
reply_old(CMD_ACK, bSuccessful, 0, 0, 0, 0);
}
/*
@@ -2041,7 +2041,7 @@ void check_challenges(bool file_given, uint8_t *data) {
StartTicks();
cmd_send(CMD_ACK, bSuccessful, 0, 0, 0, 0);
reply_old(CMD_ACK, bSuccessful, 0, 0, 0, 0);
}

View File

@@ -1195,11 +1195,11 @@ void SimulateIClass(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain
if (doIClassSimulation(MODE_EXIT_AFTER_MAC, mac_responses + i * EPURSE_MAC_SIZE)) {
// Button pressed
cmd_send(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i, 0, mac_responses, i * EPURSE_MAC_SIZE);
reply_old(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i, 0, mac_responses, i * EPURSE_MAC_SIZE);
goto out;
}
}
cmd_send(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i, 0, mac_responses, i * EPURSE_MAC_SIZE);
reply_old(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i, 0, mac_responses, i * EPURSE_MAC_SIZE);
} else if (simType == 3) {
//This is 'full sim' mode, where we use the emulator storage for data.
@@ -1226,20 +1226,20 @@ void SimulateIClass(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain
// keyroll 1
if (doIClassSimulation(MODE_EXIT_AFTER_MAC, mac_responses + i * EPURSE_MAC_SIZE)) {
cmd_send(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i * 2, 0, mac_responses, i * EPURSE_MAC_SIZE * 2);
reply_old(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i * 2, 0, mac_responses, i * EPURSE_MAC_SIZE * 2);
// Button pressed
goto out;
}
// keyroll 2
if (doIClassSimulation(MODE_EXIT_AFTER_MAC, mac_responses + (i + numberOfCSNS) * EPURSE_MAC_SIZE)) {
cmd_send(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i * 2, 0, mac_responses, i * EPURSE_MAC_SIZE * 2);
reply_old(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i * 2, 0, mac_responses, i * EPURSE_MAC_SIZE * 2);
// Button pressed
goto out;
}
}
// double the amount of collected data.
cmd_send(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i * 2, 0, mac_responses, i * EPURSE_MAC_SIZE * 2);
reply_old(CMD_ACK, CMD_SIMULATE_TAG_ICLASS, i * 2, 0, mac_responses, i * EPURSE_MAC_SIZE * 2);
} else {
// We may want a mode here where we hardcode the csns to use (from proxclone).
@@ -2082,7 +2082,7 @@ void ReaderIClass(uint8_t arg0) {
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) Dbprintf("SEND %c", send ? 'y' : 'n');
if (send) {
cmd_send(CMD_ACK, result_status, 0, 0, card_data, sizeof(card_data));
reply_old(CMD_ACK, result_status, 0, 0, card_data, sizeof(card_data));
if (abort_after_read) {
LED_B_OFF();
return;
@@ -2096,10 +2096,10 @@ void ReaderIClass(uint8_t arg0) {
}
if (userCancelled) {
cmd_send(CMD_ACK, 0xFF, 0, 0, card_data, 0);
reply_old(CMD_ACK, 0xFF, 0, 0, card_data, 0);
switch_off();
} else {
cmd_send(CMD_ACK, 0, 0, 0, card_data, 0);
reply_old(CMD_ACK, 0, 0, 0, card_data, 0);
}
}
@@ -2180,7 +2180,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *mac) {
stored_data_length += 8;
if (stored_data_length + 8 > USB_CMD_DATA_SIZE) {
//Time to send this off and start afresh
cmd_send(CMD_ACK,
reply_old(CMD_ACK,
stored_data_length,//data length
failedRead,//Failed blocks?
0,//Not used ATM
@@ -2200,7 +2200,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *mac) {
//Send off any remaining data
if (stored_data_length > 0) {
cmd_send(CMD_ACK,
reply_old(CMD_ACK,
stored_data_length,//data length
failedRead,//Failed blocks?
0,//Not used ATM
@@ -2212,7 +2212,7 @@ void ReaderIClass_Replay(uint8_t arg0, uint8_t *mac) {
break;
}
//Signal end of transmission
cmd_send(CMD_ACK,
reply_old(CMD_ACK,
0,//data length
0,//Failed blocks?
0,//Not used ATM
@@ -2229,7 +2229,7 @@ void iClass_ReadCheck(uint8_t blockno, uint8_t keytype) {
uint8_t resp[] = {0, 0, 0, 0, 0, 0, 0, 0};
size_t isOK = 0;
isOK = sendCmdGetResponseWithRetries(readcheck, sizeof(readcheck), resp, sizeof(resp), 6);
cmd_send(CMD_ACK, isOK, 0, 0, 0, 0);
reply_old(CMD_ACK, isOK, 0, 0, 0, 0);
switch_off();
}
@@ -2248,7 +2248,7 @@ void iClass_Authentication(uint8_t *mac) {
// 6 retries
bool isOK = sendCmdGetResponseWithRetries(check, sizeof(check), resp, 4, 6);
cmd_send(CMD_ACK, isOK, 0, 0, 0, 0);
reply_old(CMD_ACK, isOK, 0, 0, 0, 0);
}
typedef struct iclass_premac {
@@ -2332,7 +2332,7 @@ void iClass_Authentication_fast(uint64_t arg0, uint64_t arg1, uint8_t *datain) {
out:
// send keyindex.
cmd_send(CMD_ACK, isOK, i, 0, 0, 0);
reply_old(CMD_ACK, isOK, i, 0, 0, 0);
if (isOK >= 1 || lastChunk) {
switch_off();
@@ -2360,7 +2360,7 @@ bool iClass_ReadBlock(uint8_t blockno, uint8_t *data, uint8_t len) {
void iClass_ReadBlk(uint8_t blockno) {
uint8_t data[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
bool isOK = iClass_ReadBlock(blockno, data, sizeof(data));
cmd_send(CMD_ACK, isOK, 0, 0, data, sizeof(data));
reply_old(CMD_ACK, isOK, 0, 0, data, sizeof(data));
switch_off();
}
@@ -2394,7 +2394,7 @@ void iClass_Dump(uint8_t blockno, uint8_t numblks) {
memcpy(dataout + (blkCnt * 8), blockdata, 8);
}
//return pointer to dump memory in arg3
cmd_send(CMD_ACK, isOK, blkCnt, BigBuf_max_traceLen(), 0, 0);
reply_old(CMD_ACK, isOK, blkCnt, BigBuf_max_traceLen(), 0, 0);
switch_off();
BigBuf_free();
}
@@ -2424,7 +2424,7 @@ bool iClass_WriteBlock_ext(uint8_t blockno, uint8_t *data) {
// turn off afterwards
void iClass_WriteBlock(uint8_t blockno, uint8_t *data) {
bool isOK = iClass_WriteBlock_ext(blockno, data);
cmd_send(CMD_ACK, isOK, 0, 0, 0, 0);
reply_old(CMD_ACK, isOK, 0, 0, 0, 0);
switch_off();
}
@@ -2451,6 +2451,6 @@ void iClass_Clone(uint8_t startblock, uint8_t endblock, uint8_t *data) {
else
DbpString("Clone incomplete");
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
switch_off();
}

View File

@@ -1273,7 +1273,7 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
ar_nr_nonces[index].state = SECOND;
// send to client
cmd_send(CMD_ACK, CMD_SIMULATE_MIFARE_CARD, 0, 0, &ar_nr_nonces[index], sizeof(nonces_t));
reply_old(CMD_ACK, CMD_SIMULATE_MIFARE_CARD, 0, 0, &ar_nr_nonces[index], sizeof(nonces_t));
ar_nr_nonces[index].state = EMPTY;
ar_nr_nonces[index].sector = 0;
@@ -1392,7 +1392,7 @@ void SimulateIso14443aTag(int tagType, int flags, uint8_t *data) {
}
}
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
switch_off();
set_tracing(false);
@@ -1943,7 +1943,7 @@ void iso14443a_antifuzz(uint32_t flags) {
}
}
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
switch_off();
BigBuf_free_keep_EM();
}
@@ -2350,7 +2350,7 @@ int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, bool send_chaining, void *data, u
// low :: len of commandbytes
// arg2 timeout
// d.asBytes command bytes to send
void ReaderIso14443a(UsbCommandNG *c) {
void ReaderIso14443a(PacketCommandNG *c) {
iso14a_command_t param = c->oldarg[0];
size_t len = c->oldarg[1] & 0xffff;
size_t lenbits = c->oldarg[1] >> 16;
@@ -2376,7 +2376,7 @@ void ReaderIso14443a(UsbCommandNG *c) {
if (!(param & ISO14A_NO_SELECT)) {
iso14a_card_select_t *card = (iso14a_card_select_t *)buf;
arg0 = iso14443a_select_card(NULL, card, NULL, true, 0, param & ISO14A_NO_RATS);
cmd_send(CMD_ACK, arg0, card->uidlen, 0, buf, sizeof(iso14a_card_select_t));
reply_old(CMD_ACK, arg0, card->uidlen, 0, buf, sizeof(iso14a_card_select_t));
if (arg0 == 0)
goto OUT;
}
@@ -2388,7 +2388,7 @@ void ReaderIso14443a(UsbCommandNG *c) {
if ((param & ISO14A_APDU)) {
uint8_t res;
arg0 = iso14_apdu(cmd, len, (param & ISO14A_SEND_CHAINING), buf, &res);
cmd_send(CMD_ACK, arg0, res, 0, buf, sizeof(buf));
reply_old(CMD_ACK, arg0, res, 0, buf, sizeof(buf));
}
if ((param & ISO14A_RAW)) {
@@ -2432,7 +2432,7 @@ void ReaderIso14443a(UsbCommandNG *c) {
}
}
arg0 = ReaderReceive(buf, par);
cmd_send(CMD_ACK, arg0, 0, 0, buf, sizeof(buf));
reply_old(CMD_ACK, arg0, 0, 0, buf, sizeof(buf));
}
if ((param & ISO14A_REQUEST_TRIGGER))
@@ -2737,7 +2737,7 @@ void ReaderMifare(bool first_try, uint8_t block, uint8_t keytype) {
memcpy(buf + 16, ks_list, 8);
memcpy(buf + 24, mf_nr_ar, 8);
cmd_send(CMD_ACK, isOK, 0, 0, buf, sizeof(buf));
reply_old(CMD_ACK, isOK, 0, 0, buf, sizeof(buf));
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
@@ -2963,7 +2963,7 @@ void DetectNACKbug() {
// num_nacks = number of nacks recieved. should be only 1. if not its a clone card which always sends NACK (parity == 0) ?
// i = number of authentications sent. Not always 256, since we are trying to sync but close to it.
cmd_send(CMD_ACK, isOK, num_nacks, i, 0, 0);
reply_old(CMD_ACK, isOK, num_nacks, i, 0, 0);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();

View File

@@ -121,7 +121,7 @@ RAMFUNC int ManchesterDecoding(uint8_t bit, uint16_t offset, uint32_t non_real_t
void RAMFUNC SniffIso14443a(uint8_t param);
void SimulateIso14443aTag(int tagType, int flags, uint8_t *data);
void iso14443a_antifuzz(uint32_t flags);
void ReaderIso14443a(UsbCommandNG *c);
void ReaderIso14443a(PacketCommandNG *c);
void ReaderTransmit(uint8_t *frame, uint16_t len, uint32_t *timing);
void ReaderTransmitBitsPar(uint8_t *frame, uint16_t bits, uint8_t *par, uint32_t *timing);
void ReaderTransmitPar(uint8_t *frame, uint16_t len, uint8_t *par, uint32_t *timing);

View File

@@ -1566,7 +1566,7 @@ void iso14b_set_trigger(bool enable) {
* none
*
*/
void SendRawCommand14443B_Ex(UsbCommandNG *c) {
void SendRawCommand14443B_Ex(PacketCommandNG *c) {
iso14b_command_t param = c->oldarg[0];
size_t len = c->oldarg[1] & 0xffff;
uint32_t timeout = c->oldarg[2];
@@ -1594,7 +1594,7 @@ void SendRawCommand14443B_Ex(UsbCommandNG *c) {
if ((param & ISO14B_SELECT_STD) == ISO14B_SELECT_STD) {
iso14b_card_select_t *card = (iso14b_card_select_t *)buf;
status = iso14443b_select_card(card);
cmd_send(CMD_ACK, status, sendlen, 0, buf, sendlen);
reply_old(CMD_ACK, status, sendlen, 0, buf, sendlen);
// 0: OK 2: attrib fail, 3:crc fail,
if (status > 0) goto out;
}
@@ -1602,14 +1602,14 @@ void SendRawCommand14443B_Ex(UsbCommandNG *c) {
if ((param & ISO14B_SELECT_SR) == ISO14B_SELECT_SR) {
iso14b_card_select_t *card = (iso14b_card_select_t *)buf;
status = iso14443b_select_srx_card(card);
cmd_send(CMD_ACK, status, sendlen, 0, buf, sendlen);
reply_old(CMD_ACK, status, sendlen, 0, buf, sendlen);
// 0: OK 2: demod fail, 3:crc fail,
if (status > 0) goto out;
}
if ((param & ISO14B_APDU) == ISO14B_APDU) {
status = iso14443b_apdu(cmd, len, buf);
cmd_send(CMD_ACK, status, status, 0, buf, status);
reply_old(CMD_ACK, status, status, 0, buf, status);
}
if ((param & ISO14B_RAW) == ISO14B_RAW) {
@@ -1623,7 +1623,7 @@ void SendRawCommand14443B_Ex(UsbCommandNG *c) {
sendlen = MIN(Demod.len, USB_CMD_DATA_SIZE);
status = (Demod.len > 0) ? 0 : 1;
cmd_send(CMD_ACK, status, sendlen, 0, Demod.output, sendlen);
reply_old(CMD_ACK, status, sendlen, 0, Demod.output, sendlen);
}
out:

View File

@@ -34,7 +34,7 @@ extern "C" {
# define AddCrc14B(data, len) compute_crc(CRC_14443_B, (data), (len), (data)+(len), (data)+(len)+1)
#endif
void SendRawCommand14443B_Ex(UsbCommandNG *c);
void SendRawCommand14443B_Ex(PacketCommandNG *c);
void iso14443b_setup();
uint8_t iso14443b_apdu(uint8_t const *message, size_t message_length, uint8_t *response);
uint8_t iso14443b_select_card(iso14b_card_select_t *card);

View File

@@ -849,7 +849,7 @@ void ReaderIso15693(uint32_t parameter) {
// arg1 = len of response (12 bytes)
// arg2 = rtf
// asbytes = uid.
cmd_send(CMD_ACK, 1, sizeof(uid), 0, uid, sizeof(uid));
reply_old(CMD_ACK, 1, sizeof(uid), 0, uid, sizeof(uid));
}
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) {
@@ -989,7 +989,7 @@ void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint
buflen = (buflen > ISO15_MAX_FRAME) ? ISO15_MAX_FRAME : buflen;
LED_B_ON();
cmd_send(CMD_ACK, buflen, 0, 0, buf, buflen);
reply_old(CMD_ACK, buflen, 0, 0, buf, buflen);
LED_B_OFF();
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) {
@@ -998,6 +998,6 @@ void DirectTag15693Command(uint32_t datalen, uint32_t speed, uint32_t recv, uint
Dbhexdump(buflen, buf, true);
}
} else {
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
}
}

View File

@@ -402,7 +402,7 @@ void LegicRfInfo(void) {
// establish shared secret and detect card type
uint8_t card_type = setup_phase(0x01);
if (init_card(card_type, &card) != 0) {
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
@@ -410,7 +410,7 @@ void LegicRfInfo(void) {
for (uint8_t i = 0; i < sizeof(card.uid); ++i) {
int16_t byte = read_byte(i, card.cmdsize);
if (byte == -1) {
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
card.uid[i] = byte & 0xFF;
@@ -420,12 +420,12 @@ void LegicRfInfo(void) {
int16_t mcc = read_byte(4, card.cmdsize);
int16_t calc_mcc = CRC8Legic(card.uid, 4);;
if (mcc != calc_mcc) {
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
// OK
cmd_send(CMD_ACK, 1, 0, 0, (uint8_t *)&card, sizeof(legic_card_select_t));
reply_old(CMD_ACK, 1, 0, 0, (uint8_t *)&card, sizeof(legic_card_select_t));
OUT:
switch_off();
@@ -439,7 +439,7 @@ void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv) {
// establish shared secret and detect card type
uint8_t card_type = setup_phase(iv);
if (init_card(card_type, &card) != 0) {
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
@@ -451,14 +451,14 @@ void LegicRfReader(uint16_t offset, uint16_t len, uint8_t iv) {
for (uint16_t i = 0; i < len; ++i) {
int16_t byte = read_byte(offset + i, card.cmdsize);
if (byte == -1) {
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
legic_mem[i] = byte;
}
// OK
cmd_send(CMD_ACK, 1, len, 0, legic_mem, len);
reply_old(CMD_ACK, 1, len, 0, legic_mem, len);
OUT:
switch_off();
@@ -471,14 +471,14 @@ void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data) {
// uid is not writeable
if (offset <= WRITE_LOWERLIMIT) {
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
// establish shared secret and detect card type
uint8_t card_type = setup_phase(iv);
if (init_card(card_type, &card) != 0) {
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
@@ -491,13 +491,13 @@ void LegicRfWriter(uint16_t offset, uint16_t len, uint8_t iv, uint8_t *data) {
while (len-- > 0 && !BUTTON_PRESS()) {
if (!write_byte(len + offset, data[len], card.addrsize)) {
Dbprintf("operation failed | %02X | %02X | %02X", len + offset, len, data[len]);
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
goto OUT;
}
}
// OK
cmd_send(CMD_ACK, 1, len, 0, legic_mem, len);
reply_old(CMD_ACK, 1, len, 0, legic_mem, len);
OUT:
switch_off();

View File

@@ -242,7 +242,7 @@ void ModThenAcquireRawAdcSamples125k(uint32_t delay_off, uint32_t period_0, uint
// Turn off antenna
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
// tell client we are done
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
}
/* blank r/w tag data stream
@@ -1388,7 +1388,7 @@ void T55xxResetRead(void) {
// Turn the field off
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); // field off
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
LED_A_OFF();
}
@@ -1467,7 +1467,7 @@ void T55xxWriteBlockExt(uint32_t Data, uint8_t Block, uint32_t Pwd, uint8_t arg)
// Write one card block in page 0, no lock
void T55xxWriteBlock(uint32_t Data, uint8_t Block, uint32_t Pwd, uint8_t arg) {
T55xxWriteBlockExt(Data, Block, Pwd, arg);
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
}
// Read one card block in page [page]
@@ -1532,7 +1532,7 @@ void T55xxReadBlock(uint16_t arg0, uint8_t Block, uint32_t Pwd) {
// Turn the field off
if (!brute_mem) {
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
LED_A_OFF();
}
}
@@ -1629,7 +1629,7 @@ void T55xx_ChkPwds() {
OUT:
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
cmd_send(CMD_ACK, ret, candidate, 0, 0, 0);
reply_old(CMD_ACK, ret, candidate, 0, 0, 0);
LEDsoff();
}
@@ -1757,7 +1757,7 @@ void CopyVikingtoT55xx(uint32_t block1, uint32_t block2, uint8_t Q5) {
// Program the data blocks for supplied ID and the block 0 config
WriteT55xx(data, 0, 3);
LED_D_OFF();
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
}
// Define 9bit header for EM410x tags
@@ -2028,7 +2028,7 @@ void EM4xReadWord(uint8_t addr, uint32_t pwd, uint8_t usepwd) {
DoPartialAcquisition(20, true, 6000, 1000);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
LED_A_OFF();
}
@@ -2064,7 +2064,7 @@ void EM4xWriteWord(uint32_t flag, uint32_t data, uint32_t pwd) {
DoPartialAcquisition(20, true, 6000, 1000);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
LED_A_OFF();
}
@@ -2118,7 +2118,7 @@ void Cotag(uint32_t arg0) {
// Turn the field off
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF); // field off
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
LEDsoff();
}

View File

@@ -93,7 +93,7 @@ void MifareReadBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
if (MF_DBGLEVEL >= 2) DbpString("READ BLOCK FINISHED");
LED_B_ON();
cmd_send(CMD_ACK, isOK, 0, 0, dataoutbuf, 16);
reply_old(CMD_ACK, isOK, 0, 0, dataoutbuf, 16);
LED_B_OFF();
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
@@ -129,7 +129,7 @@ void MifareUC_Auth(uint8_t arg0, uint8_t *keybytes) {
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
}
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
}
// Arg0 = BlockNo,
@@ -189,7 +189,7 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain) {
return;
}
cmd_send(CMD_ACK, 1, 0, 0, dataout, 16);
reply_old(CMD_ACK, 1, 0, 0, dataout, 16);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
}
@@ -252,7 +252,7 @@ void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
crypto1_destroy(pcs);
LED_B_ON();
cmd_send(CMD_ACK, isOK, 0, 0, dataoutbuf, 16 * NumBlocksPerSector(sectorNo));
reply_old(CMD_ACK, isOK, 0, 0, dataoutbuf, 16 * NumBlocksPerSector(sectorNo));
LED_B_OFF();
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
@@ -352,7 +352,7 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
countblocks *= 4;
cmd_send(CMD_ACK, 1, countblocks, BigBuf_max_traceLen(), 0, 0);
reply_old(CMD_ACK, 1, countblocks, BigBuf_max_traceLen(), 0, 0);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
BigBuf_free();
@@ -419,7 +419,7 @@ void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
if (MF_DBGLEVEL >= 2) DbpString("WRITE BLOCK FINISHED");
cmd_send(CMD_ACK, isOK, 0, 0, 0, 0);
reply_old(CMD_ACK, isOK, 0, 0, 0, 0);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
@@ -461,7 +461,7 @@ void MifareUWriteBlockCompat(uint8_t arg0, uint8_t *datain)
if (MF_DBGLEVEL >= 2) DbpString("WRITE BLOCK FINISHED");
cmd_send(CMD_ACK,1,0,0,0,0);
reply_old(CMD_ACK,1,0,0,0,0);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
}
@@ -530,7 +530,7 @@ void MifareUWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain) {
if (MF_DBGLEVEL >= 2) DbpString("WRITE BLOCK FINISHED");
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
set_tracing(false);
@@ -603,7 +603,7 @@ void MifareUSetPwd(uint8_t arg0, uint8_t *datain) {
return;
};
cmd_send(CMD_ACK, 1, 0, 0, 0, 0);
reply_old(CMD_ACK, 1, 0, 0, 0, 0);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
set_tracing(false);
@@ -706,7 +706,7 @@ void MifareAcquireNonces(uint32_t arg0, uint32_t arg1, uint32_t flags, uint8_t *
LED_C_OFF();
LED_B_ON();
cmd_send(CMD_ACK, isOK, cuid, num_nonces - 1, buf, sizeof(buf));
reply_old(CMD_ACK, isOK, cuid, num_nonces - 1, buf, sizeof(buf));
LED_B_OFF();
if (MF_DBGLEVEL >= 3) DbpString("AcquireNonces finished");
@@ -834,7 +834,7 @@ void MifareAcquireEncryptedNonces(uint32_t arg0, uint32_t arg1, uint32_t flags,
LED_C_OFF();
crypto1_destroy(pcs);
LED_B_ON();
cmd_send(CMD_ACK, isOK, cuid, num_nonces, buf, sizeof(buf));
reply_old(CMD_ACK, isOK, cuid, num_nonces, buf, sizeof(buf));
LED_B_OFF();
if (MF_DBGLEVEL >= 3) DbpString("AcquireEncryptedNonces finished");
@@ -1054,7 +1054,7 @@ void MifareNested(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain)
memcpy(buf + 16, &target_ks[1], 4);
LED_B_ON();
cmd_send(CMD_ACK, isOK, 0, targetBlockNo + (targetKeyType * 0x100), buf, sizeof(buf));
reply_old(CMD_ACK, isOK, 0, targetBlockNo + (targetKeyType * 0x100), buf, sizeof(buf));
LED_B_OFF();
if (MF_DBGLEVEL >= 3) DbpString("NESTED FINISHED");
@@ -1504,7 +1504,7 @@ OUT:
tmp[488] = bar & 0xFF;
tmp[489] = bar >> 8 & 0xFF;
cmd_send(CMD_ACK, foundkeys, 0, 0, tmp, 480 + 10);
reply_old(CMD_ACK, foundkeys, 0, 0, tmp, 480 + 10);
set_tracing(false);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
@@ -1512,7 +1512,7 @@ OUT:
BigBuf_Clear_ext(false);
} else {
// partial/none keys found
cmd_send(CMD_ACK, foundkeys, 0, 0, 0, 0);
reply_old(CMD_ACK, foundkeys, 0, 0, 0, 0);
}
}
@@ -1592,7 +1592,7 @@ void MifareChkKeys(uint16_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain) {
}
LED_B_ON();
cmd_send(CMD_ACK, isOK, 0, 0, datain + i * 6, 6);
reply_old(CMD_ACK, isOK, 0, 0, datain + i * 6, 6);
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
@@ -1635,7 +1635,7 @@ void MifareEMemGet(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint8_t *datain)
emlGetMem(buf, arg0, arg1); // data, block num, blocks count (max 4)
LED_B_ON();
cmd_send(CMD_ACK, arg0, arg1, 0, buf, USB_CMD_DATA_SIZE);
reply_old(CMD_ACK, arg0, arg1, 0, buf, USB_CMD_DATA_SIZE);
LED_B_OFF();
}
@@ -1841,7 +1841,7 @@ void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) {
} // end while
if (isOK)
cmd_send(CMD_ACK, 1, 0, 0, uid, sizeof(uid));
reply_old(CMD_ACK, 1, 0, 0, uid, sizeof(uid));
else
OnErrorMagic(errormsg);
@@ -1916,7 +1916,7 @@ void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain) {
memcpy(datain, data, sizeof(data));
} else {
if (isOK)
cmd_send(CMD_ACK, 1, 0, 0, data, sizeof(data));
reply_old(CMD_ACK, 1, 0, 0, data, sizeof(data));
else
OnErrorMagic(errormsg);
}
@@ -1975,7 +1975,7 @@ TEST2:
};
OUT:
cmd_send(CMD_ACK, isGen, 0, 0, 0, 0);
reply_old(CMD_ACK, isGen, 0, 0, 0, 0);
// turns off
OnSuccessMagic();
BigBuf_free();
@@ -1988,7 +1988,7 @@ void OnSuccessMagic() {
}
void OnErrorMagic(uint8_t reason) {
// ACK, ISOK, reason,0,0,0
cmd_send(CMD_ACK, 0, reason, 0, 0, 0);
reply_old(CMD_ACK, 0, reason, 0, 0, 0);
OnSuccessMagic();
}
@@ -2042,7 +2042,7 @@ void MifareSetMod(uint8_t mod, uint8_t *key) {
crypto1_destroy(pcs);
LED_B_ON();
cmd_send(CMD_ACK, isOK, 0, 0, 0, 0);
reply_old(CMD_ACK, isOK, 0, 0, 0, 0);
LED_B_OFF();
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
@@ -2075,7 +2075,7 @@ void Mifare_DES_Auth1(uint8_t arg0, uint8_t *datain) {
}
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) DbpString("AUTH 1 FINISHED");
cmd_send(CMD_ACK, 1, cuid, 0, dataout, sizeof(dataout));
reply_old(CMD_ACK, 1, cuid, 0, dataout, sizeof(dataout));
}
void Mifare_DES_Auth2(uint32_t arg0, uint8_t *datain) {
@@ -2096,7 +2096,7 @@ void Mifare_DES_Auth2(uint32_t arg0, uint8_t *datain) {
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) DbpString("AUTH 2 FINISHED");
cmd_send(CMD_ACK, isOK, 0, 0, dataout, sizeof(dataout));
reply_old(CMD_ACK, isOK, 0, 0, dataout, sizeof(dataout));
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
LEDsoff();
set_tracing(false);

View File

@@ -81,7 +81,7 @@ void MifareSendCommand(uint8_t arg0, uint8_t arg1, uint8_t *datain) {
if (flags & DISCONNECT)
OnSuccess();
cmd_send(CMD_ACK, 1, len, 0, resp, len);
reply_old(CMD_ACK, 1, len, 0, resp, len);
}
void MifareDesfireGetInformation() {
@@ -160,7 +160,7 @@ void MifareDesfireGetInformation() {
memcpy(dataout + 7 + 7 + 7, resp + 3, 14);
cmd_send(CMD_ACK, 1, 0, 0, dataout, sizeof(dataout));
reply_old(CMD_ACK, 1, 0, 0, dataout, sizeof(dataout));
// reset the pcb_blocknum,
pcb_blocknum = 0;
@@ -409,9 +409,9 @@ void MifareDES_Auth1(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
OnSuccess();
if (arg1 == 2)
cmd_send(CMD_ACK, 1, 0, 0, skey->data, 16);
reply_old(CMD_ACK, 1, 0, 0, skey->data, 16);
else if (arg1 == 1)
cmd_send(CMD_ACK, 1, 0, 0, skey->data, 8);
reply_old(CMD_ACK, 1, 0, 0, skey->data, 8);
} else {
DbpString("Authentication failed.");
OnError(6);
@@ -494,7 +494,7 @@ void MifareDES_Auth1(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
}
OnSuccess();
cmd_send(CMD_ACK, 1, len, 0, resp, len);
reply_old(CMD_ACK, 1, len, 0, resp, len);
}
// 3 different ISO ways to send data to a DESFIRE (direct, capsuled, capsuled ISO)
@@ -567,6 +567,6 @@ void OnSuccess() {
}
void OnError(uint8_t reason) {
cmd_send(CMD_ACK, 0, reason, 0, 0, 0);
reply_old(CMD_ACK, 0, reason, 0, 0, 0);
OnSuccess();
}

View File

@@ -1219,7 +1219,7 @@ void Mifare1ksim(uint16_t flags, uint8_t exitAfterNReads, uint8_t arg2, uint8_t
if ((flags & FLAG_INTERACTIVE) == FLAG_INTERACTIVE) { // Interactive mode flag, means we need to send ACK
//Send the collected ar_nr in the response
cmd_send(CMD_ACK, CMD_SIMULATE_MIFARE_CARD, button_pushed, 0, &ar_nr_resp, sizeof(ar_nr_resp));
reply_old(CMD_ACK, CMD_SIMULATE_MIFARE_CARD, button_pushed, 0, &ar_nr_resp, sizeof(ar_nr_resp));
}
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);

View File

@@ -190,7 +190,7 @@ void MfSniffInit(void) {
void MfSniffEnd(void) {
LED_B_ON();
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
LED_B_OFF();
}
@@ -316,12 +316,12 @@ void RAMFUNC MfSniffSend() {
while (packlen > 0) {
LED_B_ON();
chunksize = MIN(USB_CMD_DATA_SIZE, packlen); // chunk size 512
cmd_send(CMD_ACK, 1, tracelen, chunksize, data + tracelen - packlen, chunksize);
reply_old(CMD_ACK, 1, tracelen, chunksize, data + tracelen - packlen, chunksize);
packlen -= chunksize;
LED_B_OFF();
}
LED_B_ON();
cmd_send(CMD_ACK, 2, 0, 0, 0, 0); // 2 == data transfer finished.
reply_old(CMD_ACK, 2, 0, 0, 0, 0); // 2 == data transfer finished.
LED_B_OFF();
}

View File

@@ -295,7 +295,7 @@ end:
Dbprintf("-----------------------------------------");
}
cmd_send(CMD_ACK, 0, 0, 0, 0, 0);
reply_old(CMD_ACK, 0, 0, 0, 0, 0);
}
static void RealWritePCF7931(uint8_t *pass, uint16_t init_delay, int32_t l, int32_t p, uint8_t address, uint8_t byte, uint8_t data) {