Add support for standard USB Smartcard Readers

* add PCSC interface (pcsc.c and pcsc.h)
* new command 'sc select' to choose an USB Smartcard Reader
* updated CI/.travis.yml accordingly
This commit is contained in:
pwpiwi 2019-01-08 08:05:58 +01:00
commit 2472a76bad
12 changed files with 365 additions and 18 deletions

View file

@ -26,7 +26,7 @@ before_install:
echo $REPOSITORY_EP; echo $REPOSITORY_EP;
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get update -qq; sudo apt-get update -qq;
sudo apt-get install -y gcc-arm-none-eabi; sudo apt-get install -y gcc-arm-none-eabi libpcsclite-dev;
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update; brew update;
if [[ "$REPOSITORY_EP" == "" ]]; then if [[ "$REPOSITORY_EP" == "" ]]; then

View file

@ -34,6 +34,7 @@
#include "LCD.h" #include "LCD.h"
#endif #endif
static uint32_t hw_capabilities;
// Craig Young - 14a stand-alone code // Craig Young - 14a stand-alone code
#ifdef WITH_ISO14443a #ifdef WITH_ISO14443a
@ -312,8 +313,22 @@ extern struct version_information version_information;
extern char *_bootphase1_version_pointer, _flash_start, _flash_end, _bootrom_start, _bootrom_end, __data_src_start__; extern char *_bootphase1_version_pointer, _flash_start, _flash_end, _bootrom_start, _bootrom_end, __data_src_start__;
void set_hw_capabilities(void)
{
if (I2C_is_available()) {
hw_capabilities |= HAS_SMARTCARD_SLOT;
}
if (false) { // TODO: implement a test
hw_capabilities |= HAS_EXTRA_FLASH_MEM;
}
}
void SendVersion(void) void SendVersion(void)
{ {
set_hw_capabilities();
char temp[USB_CMD_DATA_SIZE]; /* Limited data payload in USB packets */ char temp[USB_CMD_DATA_SIZE]; /* Limited data payload in USB packets */
char VersionString[USB_CMD_DATA_SIZE] = { '\0' }; char VersionString[USB_CMD_DATA_SIZE] = { '\0' };
@ -347,7 +362,7 @@ void SendVersion(void)
// Send Chip ID and used flash memory // 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 text_and_rodata_section_size = (uint32_t)&__data_src_start__ - (uint32_t)&_flash_start;
uint32_t compressed_data_section_size = common_area.arg1; 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)); cmd_send(CMD_ACK, *(AT91C_DBGU_CIDR), text_and_rodata_section_size + compressed_data_section_size, hw_capabilities, VersionString, strlen(VersionString));
} }
// measure the USB Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time. // measure the USB Speed by sending SpeedTestBufferSize bytes to client and measuring the elapsed time.

View file

@ -35,13 +35,22 @@ APP_CFLAGS =
include ../common/Makefile_Enabled_Options.common include ../common/Makefile_Enabled_Options.common
CFLAGS += $(APP_CFLAGS) CFLAGS += $(APP_CFLAGS)
ifneq (,$(findstring WITH_SMARTCARD,$(APP_CFLAGS))) ifneq (,$(findstring WITH_SMARTCARD,$(APP_CFLAGS)))
SRC_SMARTCARD = cmdsmartcard.c SRC_SMARTCARD = cmdsmartcard.c pcsc.c
else else
SRC_SMARTCARD = SRC_SMARTCARD =
endif endif
LUAPLATFORM = generic
platform = $(shell uname) platform = $(shell uname)
ifneq (,$(findstring MINGW,$(platform)))
PCSC_INCLUDES :=
PCSC_LIBS = -lwinscard
else
PCSC_INCLUDES := $(shell pkg-config --cflags libpcsclite)
PCSC_LIBS := $(shell pkg-config --libs libpcsclite)
endif
LUAPLATFORM = generic
ifneq (,$(findstring MINGW,$(platform))) ifneq (,$(findstring MINGW,$(platform)))
LUAPLATFORM = mingw LUAPLATFORM = mingw
else else
@ -258,7 +267,7 @@ all: lua_build jansson_build mbedtls_build cbor_build $(BINS)
all-static: LDLIBS:=-static $(LDLIBS) all-static: LDLIBS:=-static $(LDLIBS)
all-static: proxmark3 flasher fpga_compress all-static: proxmark3 flasher fpga_compress
proxmark3: LDLIBS+=$(LUALIB) $(JANSSONLIB) $(MBEDTLSLIB) $(CBORLIB) $(QTLDLIBS) proxmark3: LDLIBS+=$(LUALIB) $(JANSSONLIB) $(MBEDTLSLIB) $(CBORLIB) $(QTLDLIBS) $(PCSC_LIBS)
proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(ZLIBOBJS) lualibs/usb_cmd.lua proxmark3: $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(ZLIBOBJS) lualibs/usb_cmd.lua
$(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(ZLIBOBJS) $(LDLIBS) -o $@ $(LD) $(LDFLAGS) $(OBJDIR)/proxmark3.o $(COREOBJS) $(CMDOBJS) $(OBJCOBJS) $(QTGUIOBJS) $(MULTIARCHOBJS) $(ZLIBOBJS) $(LDLIBS) -o $@
@ -327,7 +336,7 @@ $(OBJDIR)/%_AVX512.o : %.c $(OBJDIR)/%.d
%.o: %.c %.o: %.c
$(OBJDIR)/%.o : %.c $(OBJDIR)/%.d $(OBJDIR)/%.o : %.c $(OBJDIR)/%.d
$(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) -c -o $@ $< $(CC) $(DEPFLAGS) $(CFLAGS) $(ZLIBFLAGS) $(PCSC_INCLUDES) -c -o $@ $<
$(POSTCOMPILE) $(POSTCOMPILE)
%.o: %.cpp %.o: %.cpp

View file

@ -20,7 +20,8 @@
#include "cmdmain.h" #include "cmdmain.h"
#include "cmddata.h" #include "cmddata.h"
/* low-level hardware control */
static uint32_t hw_capabilities = 0;
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
@ -403,6 +404,10 @@ int CmdTune(const char *Cmd)
return CmdTuneSamples(Cmd); return CmdTuneSamples(Cmd);
} }
bool PM3hasSmartcardSlot(void) {
return (hw_capabilities & HAS_SMARTCARD_SLOT);
}
int CmdVersion(const char *Cmd) int CmdVersion(const char *Cmd)
{ {
@ -411,10 +416,11 @@ int CmdVersion(const char *Cmd)
UsbCommand resp = {0, {0, 0, 0}}; UsbCommand resp = {0, {0, 0, 0}};
SendCommand(&c); SendCommand(&c);
if (WaitForResponseTimeout(CMD_ACK,&resp,1000)) { if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
PrintAndLog("Prox/RFID mark3 RFID instrument"); PrintAndLog("Prox/RFID mark3 RFID instrument");
PrintAndLog((char*)resp.d.asBytes); PrintAndLog((char*)resp.d.asBytes);
lookupChipID(resp.arg[0], resp.arg[1]); lookupChipID(resp.arg[0], resp.arg[1]);
hw_capabilities = resp.arg[2];
} }
return 0; return 0;
} }

View file

@ -11,6 +11,8 @@
#ifndef CMDHW_H__ #ifndef CMDHW_H__
#define CMDHW_H__ #define CMDHW_H__
#include <stdbool.h>
int CmdHW(const char *Cmd); int CmdHW(const char *Cmd);
int CmdDetectReader(const char *Cmd); int CmdDetectReader(const char *Cmd);
@ -23,5 +25,6 @@ int CmdSetDivisor(const char *Cmd);
int CmdSetMux(const char *Cmd); int CmdSetMux(const char *Cmd);
int CmdTune(const char *Cmd); int CmdTune(const char *Cmd);
int CmdVersion(const char *Cmd); int CmdVersion(const char *Cmd);
bool PM3hasSmartcardSlot(void);
#endif #endif

View file

@ -18,14 +18,18 @@
#include "smartcard.h" #include "smartcard.h"
#include "comms.h" #include "comms.h"
#include "protocols.h" #include "protocols.h"
#include "cmdhw.h"
#include "cmdhflist.h" #include "cmdhflist.h"
#include "emv/apduinfo.h" // APDUcode description #include "emv/apduinfo.h" // APDUcode description
#include "emv/emvcore.h" // decodeTVL #include "emv/emvcore.h" // decodeTVL
#include "crypto/libpcrypto.h" // sha512hash #include "crypto/libpcrypto.h" // sha512hash
#include "emv/dump.h" // dump_buffer #include "emv/dump.h" // dump_buffer
#include "pcsc.h"
#define SC_UPGRADE_FILES_DIRECTORY "sc_upgrade_firmware/" #define SC_UPGRADE_FILES_DIRECTORY "sc_upgrade_firmware/"
static bool UseAlternativeSmartcardReader = false; // default: use PM3 RDV40 Smartcard Slot (if available)
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
static int usage_sm_raw(void) { static int usage_sm_raw(void) {
@ -44,6 +48,17 @@ static int usage_sm_raw(void) {
return 0; return 0;
} }
static int usage_sm_select(void) {
PrintAndLogEx(NORMAL, "Usage: sc select [h|<reader name>] ");
PrintAndLogEx(NORMAL, " h : this help");
PrintAndLogEx(NORMAL, " <reader name> : a card reader's name, wildcards allowed, leave empty to pick from available readers");
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(NORMAL, "Examples:");
PrintAndLogEx(NORMAL, " sc select : list available card readers and pick");
PrintAndLogEx(NORMAL, " sc select Gemalto* : select a connected Gemalto card reader" );
return 0;
}
static int usage_sm_reader(void) { static int usage_sm_reader(void) {
PrintAndLogEx(NORMAL, "Usage: sc reader [h|s]"); PrintAndLogEx(NORMAL, "Usage: sc reader [h|s]");
PrintAndLogEx(NORMAL, " h : this help"); PrintAndLogEx(NORMAL, " h : this help");
@ -379,6 +394,32 @@ static int smart_response(uint8_t *data) {
return datalen; return datalen;
} }
int CmdSmartSelect(const char *Cmd) {
const char *readername;
if (tolower(param_getchar(Cmd, 0)) == 'h') {
return usage_sm_select();
}
if (!PM3hasSmartcardSlot() && !pcscCheckForCardReaders()) {
PrintAndLogEx(WARNING, "No Smartcard Readers available");
UseAlternativeSmartcardReader = false;
return 1;
}
int bg, en;
if (param_getptr(Cmd, &bg, &en, 0)) {
UseAlternativeSmartcardReader = pcscSelectAlternativeCardReader(NULL);
} else {
readername = Cmd + bg;
UseAlternativeSmartcardReader = pcscSelectAlternativeCardReader(readername);
}
return 0;
}
int CmdSmartRaw(const char *Cmd) { int CmdSmartRaw(const char *Cmd) {
int hexlen = 0; int hexlen = 0;
@ -584,7 +625,7 @@ int CmdSmartUpgrade(const char *Cmd) {
return 1; return 1;
} }
char sha512filename[FILE_PATH_SIZE]; char sha512filename[FILE_PATH_SIZE] = {'\0'};
char *bin_extension = filename; char *bin_extension = filename;
char *dot_position = NULL; char *dot_position = NULL;
while ((dot_position = strchr(bin_extension, '.')) != NULL) { while ((dot_position = strchr(bin_extension, '.')) != NULL) {
@ -595,7 +636,7 @@ int CmdSmartUpgrade(const char *Cmd) {
|| !strcmp(bin_extension, "bin") || !strcmp(bin_extension, "bin")
#endif #endif
) { ) {
strncpy(sha512filename, filename, strlen(filename) - strlen("bin")); memcpy(sha512filename, filename, strlen(filename) - strlen("bin"));
strcat(sha512filename, "sha512.txt"); strcat(sha512filename, "sha512.txt");
} else { } else {
PrintAndLogEx(FAILED, "Filename extension of Firmware Upgrade File must be .BIN"); PrintAndLogEx(FAILED, "Filename extension of Firmware Upgrade File must be .BIN");
@ -970,6 +1011,7 @@ int CmdSmartBruteforceSFI(const char *Cmd) {
static command_t CommandTable[] = { static command_t CommandTable[] = {
{"help", CmdHelp, 1, "This help"}, {"help", CmdHelp, 1, "This help"},
{"select", CmdSmartSelect, 1, "Select the Smartcard Reader to use"},
{"list", CmdSmartList, 0, "List ISO 7816 history"}, {"list", CmdSmartList, 0, "List ISO 7816 history"},
{"info", CmdSmartInfo, 0, "Tag information"}, {"info", CmdSmartInfo, 0, "Tag information"},
{"reader", CmdSmartReader, 0, "Act like an IS07816 reader"}, {"reader", CmdSmartReader, 0, "Act like an IS07816 reader"},

228
client/pcsc.c Normal file
View file

@ -0,0 +1,228 @@
//-----------------------------------------------------------------------------
// Copyright (C) 2019 piwi
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// PCSC functions to use alternative Smartcard Readers
//-----------------------------------------------------------------------------
#include "pcsc.h"
#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "util.h"
#ifdef __APPLE__
#include <PCSC/winscard.h>
#include <PCSC/wintypes.h>
#else
#include <winscard.h>
#endif
#include "ui.h"
static SCARDCONTEXT hContext;
static char* AlternativeSmartcardReader = NULL;
char *getAlternativeSmartcardReader(void)
{
return AlternativeSmartcardReader;
}
bool pcscCheckForCardReaders(void)
{
int res = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
if (res != SCARD_S_SUCCESS) {
return false;
}
DWORD pcchReaders;
res = SCardListReaders(hContext, NULL, NULL, &pcchReaders);
if (res != SCARD_S_SUCCESS) {
SCardReleaseContext(hContext);
return false;
}
if (res == SCARD_E_NO_READERS_AVAILABLE || res == SCARD_E_NO_SERVICE) {
SCardReleaseContext(hContext);
return false;
}
return true;
}
static char *pickReader(LPTSTR readerlist)
{
PrintAndLogEx(NORMAL, "Please select one of these:");
PrintAndLogEx(NORMAL, " [0] PM3 RDV40 Smartcard Slot");
int num = 1;
for (LPTSTR p = readerlist; *p != '\0'; ) {
PrintAndLogEx(NORMAL, " [%1d] %s", num++, p);
while (*p++ != '\0') ; // advance to next entry
}
num--;
if (num == 1) {
printf("Your choice (0 or 1)?");
} else {
printf("Your choice (0...%d)? ", num);
}
int selection = getch() - '0';
printf("\n");
if (selection == 0) {
PrintAndLogEx(INFO, "Selected RDV40 Smartcard Slot");
return NULL;
}
if (selection >= 1 && selection <= num) {
LPTSTR p = readerlist;
for (int i = 1; i < selection; i++) {
while (*p++ != '\0') ; // advance to next entry
}
PrintAndLogEx(INFO, "Selected %s", p);
return p;
}
PrintAndLogEx(INFO, "Invalid selection. Using RDV40 Smartcard Slot");
return NULL;
}
char *matchString(LPTSTR readerlist, const char *readername)
{
return pickReader(readerlist);
}
bool pcscSelectAlternativeCardReader(const char *readername)
{
DWORD readerlist_len;
int res = SCardListReaders(hContext, NULL, NULL, &readerlist_len);
if (res != SCARD_S_SUCCESS) {
return false;
}
LPTSTR readerlist = calloc(readerlist_len, sizeof(char));
res = SCardListReaders(hContext, NULL, readerlist, &readerlist_len);
if (res != SCARD_S_SUCCESS) {
free(readerlist);
return false;
}
char *selected_readername = NULL;
if (readername) {
selected_readername = matchString(readerlist, readername);
} else {
selected_readername = pickReader(readerlist);
}
if (selected_readername == NULL) {
free(readerlist);
return false;
}
free(AlternativeSmartcardReader);
AlternativeSmartcardReader = malloc((strlen(selected_readername) + 1) * sizeof(char));
strcpy(AlternativeSmartcardReader, selected_readername);
return true;
}
/*
int main(void)
{
LONG rv;
SCARDCONTEXT hContext;
LPTSTR mszReaders;
SCARDHANDLE hCard;
DWORD dwReaders, dwActiveProtocol, dwRecvLength;
SCARD_IO_REQUEST pioSendPci;
BYTE pbRecvBuffer[258];
BYTE cmd1[] = { 0x00, 0xA4, 0x04, 0x00, 0x0A, 0xA0,
0x00, 0x00, 0x00, 0x62, 0x03, 0x01, 0x0C, 0x06, 0x01 };
BYTE cmd2[] = { 0x00, 0x00, 0x00, 0x00 };
unsigned int i;
rv = SCardEstablishContext(SCARD_SCOPE_SYSTEM, NULL, NULL, &hContext);
CHECK("SCardEstablishContext", rv)
#ifdef SCARD_AUTOALLOCATE
dwReaders = SCARD_AUTOALLOCATE;
rv = SCardListReaders(hContext, NULL, (LPTSTR)&mszReaders, &dwReaders);
CHECK("SCardListReaders", rv)
#else
CHECK("SCardListReaders", rv)
mszReaders = calloc(dwReaders, sizeof(char));
rv = SCardListReaders(hContext, NULL, mszReaders, &dwReaders);
CHECK("SCardListReaders", rv)
#endif
printf("reader name: %s\n", mszReaders);
rv = SCardConnect(hContext, mszReaders, SCARD_SHARE_SHARED,
SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1, &hCard, &dwActiveProtocol);
CHECK("SCardConnect", rv)
switch(dwActiveProtocol)
{
case SCARD_PROTOCOL_T0:
pioSendPci = *SCARD_PCI_T0;
break;
case SCARD_PROTOCOL_T1:
pioSendPci = *SCARD_PCI_T1;
break;
}
dwRecvLength = sizeof(pbRecvBuffer);
rv = SCardTransmit(hCard, &pioSendPci, cmd1, sizeof(cmd1),
NULL, pbRecvBuffer, &dwRecvLength);
CHECK("SCardTransmit", rv)
printf("response: ");
for(i=0; i<dwRecvLength; i++)
printf("%02X ", pbRecvBuffer[i]);
printf("\n");
dwRecvLength = sizeof(pbRecvBuffer);
rv = SCardTransmit(hCard, &pioSendPci, cmd2, sizeof(cmd2),
NULL, pbRecvBuffer, &dwRecvLength);
CHECK("SCardTransmit", rv)
printf("response: ");
for(i=0; i<dwRecvLength; i++)
printf("%02X ", pbRecvBuffer[i]);
printf("\n");
rv = SCardDisconnect(hCard, SCARD_LEAVE_CARD);
CHECK("SCardDisconnect", rv)
#ifdef SCARD_AUTOALLOCATE
rv = SCardFreeMemory(hContext, mszReaders);
CHECK("SCardFreeMemory", rv)
#else
free(mszReaders);
#endif
rv = SCardReleaseContext(hContext);
CHECK("SCardReleaseContext", rv)
return 0;
}
*/

20
client/pcsc.h Normal file
View file

@ -0,0 +1,20 @@
//-----------------------------------------------------------------------------
// Copyright (C) 2019 piwi
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//-----------------------------------------------------------------------------
// PCSC functions to use alternative Smartcard Readers
//-----------------------------------------------------------------------------
#ifndef PCSC_H__
#define PCSC_H__
#include <stdbool.h>
char *getAlternativeSmartcardReader(void);
bool pcscCheckForCardReaders(void);
bool pcscSelectAlternativeCardReader(const char *readername);
#endif

View file

@ -28,6 +28,8 @@
#include "cmdhw.h" #include "cmdhw.h"
#include "whereami.h" #include "whereami.h"
#include "comms.h" #include "comms.h"
#include "pcsc.h"
void void
#ifdef __has_attribute #ifdef __has_attribute
@ -48,6 +50,7 @@ main_loop(char *script_cmds_file, char *script_cmd, bool usb_present) {
SetOffline(true); SetOffline(true);
} }
// file with script // file with script
FILE *script_file = NULL; FILE *script_file = NULL;
char script_cmd_buf[256] = {0}; // iceman, needs lua script the same file_path_buffer as the rest char script_cmd_buf[256] = {0}; // iceman, needs lua script the same file_path_buffer as the rest

View file

@ -52,7 +52,22 @@ int ukbhit(void)
return ( error == 0 ? cnt : -1 ); return ( error == 0 ? cnt : -1 );
} }
#else char getch(void)
{
char c;
int error;
struct termios Otty, Ntty;
if ( tcgetattr(STDIN_FILENO, &Otty) == -1 ) return -1;
Ntty = Otty;
Ntty.c_lflag &= ~ICANON; /* disable buffered i/o */
if (0 == (error = tcsetattr(STDIN_FILENO, TCSANOW, &Ntty))) { // set new attributes
c = getchar();
error += tcsetattr(STDIN_FILENO, TCSANOW, &Otty); // reset attributes
}
return ( error == 0 ? c : -1 );
}
#else // _WIN32
#include <conio.h> #include <conio.h>
int ukbhit(void) { int ukbhit(void) {

View file

@ -76,6 +76,11 @@
#endif #endif
extern int ukbhit(void); extern int ukbhit(void);
#ifndef _WIN32
extern char getch(void);
#else
#include <conio.h>
#endif
extern void AddLogLine(char *fileName, char *extData, char *c); extern void AddLogLine(char *fileName, char *extData, char *c);
extern void AddLogHex(char *fileName, char *extData, const uint8_t * data, const size_t len); extern void AddLogHex(char *fileName, char *extData, const uint8_t * data, const size_t len);

View file

@ -33,6 +33,7 @@ typedef struct {
uint32_t asDwords[USB_CMD_DATA_SIZE/4]; uint32_t asDwords[USB_CMD_DATA_SIZE/4];
} d; } d;
} PACKED UsbCommand; } PACKED UsbCommand;
// A struct used to send sample-configs over USB // A struct used to send sample-configs over USB
typedef struct{ typedef struct{
uint8_t decimation; uint8_t decimation;
@ -63,6 +64,9 @@ typedef struct{
#define CMD_STATUS 0x0108 #define CMD_STATUS 0x0108
#define CMD_PING 0x0109 #define CMD_PING 0x0109
// controlling the ADC input multiplexer
#define CMD_SET_ADC_MUX 0x020F
// RDV40, Smart card operations // RDV40, Smart card operations
#define CMD_SMART_RAW 0x0140 #define CMD_SMART_RAW 0x0140
#define CMD_SMART_UPGRADE 0x0141 #define CMD_SMART_UPGRADE 0x0141
@ -86,7 +90,6 @@ typedef struct{
#define CMD_HID_SIM_TAG 0x020C #define CMD_HID_SIM_TAG 0x020C
#define CMD_SET_LF_DIVISOR 0x020D #define CMD_SET_LF_DIVISOR 0x020D
#define CMD_LF_SIMULATE_BIDIR 0x020E #define CMD_LF_SIMULATE_BIDIR 0x020E
#define CMD_SET_ADC_MUX 0x020F
#define CMD_HID_CLONE_TAG 0x0210 #define CMD_HID_CLONE_TAG 0x0210
#define CMD_EM410X_WRITE_TAG 0x0211 #define CMD_EM410X_WRITE_TAG 0x0211
#define CMD_INDALA_CLONE_TAG 0x0212 #define CMD_INDALA_CLONE_TAG 0x0212
@ -112,12 +115,8 @@ typedef struct{
#define CMD_VIKING_CLONE_TAG 0x0223 #define CMD_VIKING_CLONE_TAG 0x0223
#define CMD_T55XX_WAKEUP 0x0224 #define CMD_T55XX_WAKEUP 0x0224
#define CMD_COTAG 0x0225 #define CMD_COTAG 0x0225
// misc extra
#define CMD_PARADOX_CLONE_TAG 0x0226 #define CMD_PARADOX_CLONE_TAG 0x0226
/* CMD_SET_ADC_MUX: ext1 is 0 for lopkd, 1 for loraw, 2 for hipkd, 3 for hiraw */
// For the 13.56 MHz tags // For the 13.56 MHz tags
#define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693 0x0300 #define CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_15693 0x0300
#define CMD_READ_SRI512_TAG 0x0303 #define CMD_READ_SRI512_TAG 0x0303
@ -136,7 +135,6 @@ typedef struct{
#define CMD_SNOOP_HITAG 0x0370 #define CMD_SNOOP_HITAG 0x0370
#define CMD_SIMULATE_HITAG 0x0371 #define CMD_SIMULATE_HITAG 0x0371
#define CMD_READER_HITAG 0x0372 #define CMD_READER_HITAG 0x0372
#define CMD_SIMULATE_HITAG_S 0x0368 #define CMD_SIMULATE_HITAG_S 0x0368
#define CMD_TEST_HITAGS_TRACES 0x0367 #define CMD_TEST_HITAGS_TRACES 0x0367
#define CMD_READ_HITAG_S 0x0373 #define CMD_READ_HITAG_S 0x0373
@ -144,7 +142,6 @@ typedef struct{
#define CMD_WR_HITAG_S 0x0375 #define CMD_WR_HITAG_S 0x0375
#define CMD_EMU_HITAG_S 0x0376 #define CMD_EMU_HITAG_S 0x0376
#define CMD_SIMULATE_TAG_ISO_14443B 0x0381 #define CMD_SIMULATE_TAG_ISO_14443B 0x0381
#define CMD_SNOOP_ISO_14443B 0x0382 #define CMD_SNOOP_ISO_14443B 0x0382
#define CMD_SNOOP_ISO_14443a 0x0383 #define CMD_SNOOP_ISO_14443a 0x0383
@ -251,6 +248,10 @@ typedef struct{
#define FLAG_TUNE_HF 2 #define FLAG_TUNE_HF 2
#define FLAG_TUNE_ALL 3 #define FLAG_TUNE_ALL 3
// Hardware capabilities
#define HAS_EXTRA_FLASH_MEM (1 << 0)
#define HAS_SMARTCARD_SLOT (1 << 1)
// CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions: // CMD_DEVICE_INFO response packet has flags in arg[0], flag definitions:
/* Whether a bootloader that understands the common_area is present */ /* Whether a bootloader that understands the common_area is present */