mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-05-12 11:18:11 -07:00
@@ -3,6 +3,8 @@ All notable changes to this project will be documented in this file.
|
||||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Add low level support for 14b' aka Innovatron (@doegox)
|
||||
- Add doc/cliparser.md (@mwalker33)
|
||||
- Add `hf 14b apdu` - send APDU over ISO14443B (@iceman1001)
|
||||
- Add `lf t55xx chk e <EM4100> option` - Checks calculated password based on the EM4100 id from some white cloners forumla by paleopterix (@mwalker33)
|
||||
- Add `lf t55xx sniff` to allow extracting commands and passwords used be cloners. (@mwalker33)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|[Notes on file formats used with Proxmark3](/doc/extensions_notes.md)|[Notes on MFU binary format](/doc/mfu_binary_format_notes.md)|[Notes on FPGA & ARM](/doc/fpga_arm_notes.md)|
|
||||
|[Developing standalone mode](/armsrc/Standalone/readme.md)|[Wiki about standalone mode](https://github.com/RfidResearchGroup/proxmark3/wiki/Standalone-mode)|[Notes on Magic cards](/doc/magic_cards_notes.md)|
|
||||
|[Notes on Color usage](/doc/colors_notes.md)|[Makefile vs CMake](/doc/md/Development/Makefile-vs-CMake.md)|[Notes on Cloner guns](/doc/cloner_notes.md)|
|
||||
|
||||
|[Notes on cliparser usage](/doc/cliparser.md)|||
|
||||
|
||||
## Build for non-RDV4 Proxmark3 platforms
|
||||
|
||||
|
||||
+1
-2
@@ -1126,11 +1126,10 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
break;
|
||||
}
|
||||
case CMD_HF_ISO14443B_SIMULATE: {
|
||||
SimulateIso14443bTag(packet->oldarg[0]);
|
||||
SimulateIso14443bTag(packet->data.asBytes);
|
||||
break;
|
||||
}
|
||||
case CMD_HF_ISO14443B_COMMAND: {
|
||||
//SendRawCommand14443B(packet->oldarg[0],packet->oldarg[1],packet->oldarg[2],packet->data.asBytes);
|
||||
SendRawCommand14443B_Ex(packet);
|
||||
break;
|
||||
}
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
#include "commonutil.h"
|
||||
#include "dbprint.h"
|
||||
#include "ticks.h"
|
||||
#include "mifare.h"
|
||||
#include "iso18.h"
|
||||
|
||||
// FeliCa timings
|
||||
// minimum time between the start bits of consecutive transfers from reader to tag: 6800 carrier (13.56MHz) cycles
|
||||
|
||||
+172
-66
@@ -274,8 +274,7 @@ static struct {
|
||||
enum {
|
||||
DEMOD_UNSYNCD,
|
||||
DEMOD_PHASE_REF_TRAINING,
|
||||
DEMOD_AWAITING_FALLING_EDGE_OF_SOF,
|
||||
DEMOD_GOT_FALLING_EDGE_OF_SOF,
|
||||
WAIT_FOR_RISING_EDGE_OF_SOF,
|
||||
DEMOD_AWAITING_START_BIT,
|
||||
DEMOD_RECEIVING_DATA
|
||||
} state;
|
||||
@@ -531,7 +530,7 @@ static void TransmitFor14443b_AsTag(uint8_t *response, uint16_t len) {
|
||||
// Main loop of simulated tag: receive commands from reader, decide what
|
||||
// response to send, and send it.
|
||||
//-----------------------------------------------------------------------------
|
||||
void SimulateIso14443bTag(uint32_t pupi) {
|
||||
void SimulateIso14443bTag(uint8_t *pupi) {
|
||||
|
||||
LED_A_ON();
|
||||
// the only commands we understand is WUPB, AFI=0, Select All, N=1:
|
||||
@@ -554,15 +553,15 @@ void SimulateIso14443bTag(uint32_t pupi) {
|
||||
0x5e, 0xd7
|
||||
};
|
||||
|
||||
// response to HLTB and ATTRIB
|
||||
static const uint8_t respOK[] = {0x00, 0x78, 0xF0};
|
||||
|
||||
// ...PUPI/UID supplied from user. Adjust ATQB response accordingly
|
||||
if (pupi > 0) {
|
||||
num_to_bytes(pupi, 4, respATQB + 1);
|
||||
if (memcmp("\x00\x00\x00\x00", pupi, 4) != 0) {
|
||||
memcpy(respATQB + 1, pupi, 4);
|
||||
AddCrc14B(respATQB, 12);
|
||||
}
|
||||
|
||||
// response to HLTB and ATTRIB
|
||||
static const uint8_t respOK[] = {0x00, 0x78, 0xF0};
|
||||
|
||||
// setup device.
|
||||
FpgaDownloadAndGo(FPGA_BITSTREAM_HF);
|
||||
|
||||
@@ -724,6 +723,13 @@ void SimulateIso14443bTag(uint32_t pupi) {
|
||||
// tag's response, which we leave in the buffer to be demodulated on the
|
||||
// PC side.
|
||||
//=============================================================================
|
||||
// We support both 14b framing and 14b' framing.
|
||||
// 14b framing looks like:
|
||||
// xxxxxxxx1111111111111111-000000000011-0........1-0........1-0........1-1-0........1-0........1-1000000000011xxxxxx
|
||||
// TR1 SOF 10*0+2*1 start-stop ^^^^^^^^byte ^ occasional stuff bit EOF 10*0+N*1
|
||||
// 14b' framing looks like:
|
||||
// xxxxxxxxxxxxxxxx111111111111111111111-0........1-0........1-0........1-1-0........1-0........1-000000000000xxxxxxx
|
||||
// SOF? start-stop ^^^^^^^^byte ^ occasional stuff bit EOF
|
||||
|
||||
/*
|
||||
* Handles reception of a bit from the tag
|
||||
@@ -774,57 +780,33 @@ static RAMFUNC int Handle14443bSamplesFromTag(int ci, int cq) {
|
||||
break;
|
||||
}
|
||||
case DEMOD_PHASE_REF_TRAINING: {
|
||||
if (Demod.posCount < 8) {
|
||||
if (AMPLITUDE(ci, cq) > SUBCARRIER_DETECT_THRESHOLD) {
|
||||
// set the reference phase (will code a logic '1') by averaging over 32 1/fs.
|
||||
// note: synchronization time > 80 1/fs
|
||||
Demod.sumI += ci;
|
||||
Demod.sumQ += cq;
|
||||
Demod.posCount++;
|
||||
// While we get a constant signal
|
||||
if (AMPLITUDE(ci, cq) > SUBCARRIER_DETECT_THRESHOLD) {
|
||||
if (((ABS(Demod.sumI) > ABS(Demod.sumQ)) && (((ci > 0) && (Demod.sumI > 0)) || ((ci < 0) && (Demod.sumI < 0)))) || // signal closer to horizontal, polarity check based on on I
|
||||
((ABS(Demod.sumI) <= ABS(Demod.sumQ)) && (((cq > 0) && (Demod.sumQ > 0)) || ((cq < 0) && (Demod.sumQ < 0))))) { // signal closer to vertical, polarity check based on on Q
|
||||
if (Demod.posCount < 10) { // refine signal approximation during first 10 samples
|
||||
Demod.sumI += ci;
|
||||
Demod.sumQ += cq;
|
||||
}
|
||||
Demod.posCount += 1;
|
||||
} else {
|
||||
// subcarrier lost
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
// transition
|
||||
if (Demod.posCount < 10) {
|
||||
// subcarrier lost
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
break;
|
||||
} else {
|
||||
// at this point it can be start of 14b' data or start of 14b SOF
|
||||
MAKE_SOFT_DECISION();
|
||||
Demod.posCount = 1; // this was the first half
|
||||
Demod.thisBit = v;
|
||||
Demod.shiftReg = 0;
|
||||
Demod.state = DEMOD_RECEIVING_DATA;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Demod.state = DEMOD_AWAITING_FALLING_EDGE_OF_SOF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DEMOD_AWAITING_FALLING_EDGE_OF_SOF: {
|
||||
|
||||
MAKE_SOFT_DECISION();
|
||||
|
||||
if (v < 0) { // logic '0' detected
|
||||
Demod.state = DEMOD_GOT_FALLING_EDGE_OF_SOF;
|
||||
Demod.posCount = 0; // start of SOF sequence
|
||||
} else {
|
||||
if (Demod.posCount > 200/4) { // maximum length of TR1 = 200 1/fs
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
}
|
||||
}
|
||||
Demod.posCount++;
|
||||
break;
|
||||
}
|
||||
case DEMOD_GOT_FALLING_EDGE_OF_SOF: {
|
||||
|
||||
Demod.posCount++;
|
||||
MAKE_SOFT_DECISION();
|
||||
|
||||
if (v > 0) {
|
||||
if (Demod.posCount < 9 * 2) { // low phase of SOF too short (< 9 etu). Note: spec is >= 10, but FPGA tends to "smear" edges
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
} else {
|
||||
LED_C_ON(); // Got SOF
|
||||
Demod.posCount = 0;
|
||||
Demod.bitCount = 0;
|
||||
Demod.len = 0;
|
||||
Demod.state = DEMOD_AWAITING_START_BIT;
|
||||
}
|
||||
} else {
|
||||
if (Demod.posCount > 12 * 2) { // low phase of SOF too long (> 12 etu)
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
LED_C_OFF();
|
||||
}
|
||||
// subcarrier lost
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -848,6 +830,28 @@ static RAMFUNC int Handle14443bSamplesFromTag(int ci, int cq) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WAIT_FOR_RISING_EDGE_OF_SOF: {
|
||||
|
||||
Demod.posCount++;
|
||||
MAKE_SOFT_DECISION();
|
||||
if (v > 0) {
|
||||
if (Demod.posCount < 9 * 2) { // low phase of SOF too short (< 9 etu). Note: spec is >= 10, but FPGA tends to "smear" edges
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
} else {
|
||||
LED_C_ON(); // Got SOF
|
||||
Demod.posCount = 0;
|
||||
Demod.bitCount = 0;
|
||||
Demod.len = 0;
|
||||
Demod.state = DEMOD_AWAITING_START_BIT;
|
||||
}
|
||||
} else {
|
||||
if (Demod.posCount > 12 * 2) { // low phase of SOF too long (> 12 etu)
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
LED_C_OFF();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DEMOD_RECEIVING_DATA: {
|
||||
|
||||
MAKE_SOFT_DECISION();
|
||||
@@ -874,12 +878,35 @@ static RAMFUNC int Handle14443bSamplesFromTag(int ci, int cq) {
|
||||
Demod.bitCount = 0;
|
||||
Demod.state = DEMOD_AWAITING_START_BIT;
|
||||
} else {
|
||||
Demod.state = DEMOD_AWAITING_FALLING_EDGE_OF_SOF;
|
||||
LED_C_OFF();
|
||||
if (s == 0x000) {
|
||||
// This is EOF (start, stop and all data bits == '0'
|
||||
return true;
|
||||
if (Demod.len > 0) {
|
||||
LED_C_OFF();
|
||||
// This is EOF (start, stop and all data bits == '0'
|
||||
return true;
|
||||
} else {
|
||||
// Zeroes but no data acquired yet?
|
||||
// => Still in SOF of 14b, wait for raising edge
|
||||
Demod.posCount = 10 * 2;
|
||||
Demod.bitCount = 0;
|
||||
Demod.len = 0;
|
||||
Demod.state = WAIT_FOR_RISING_EDGE_OF_SOF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (AMPLITUDE(ci, cq) < SUBCARRIER_DETECT_THRESHOLD) {
|
||||
LED_C_OFF();
|
||||
// subcarrier lost
|
||||
Demod.state = DEMOD_UNSYNCD;
|
||||
if (Demod.len > 0) { // no EOF but no signal anymore and we got data, e.g. ASK CTx
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// we have still signal but no proper byte or EOF? this shouldn't happen
|
||||
//Demod.posCount = 10 * 2;
|
||||
Demod.bitCount = 0;
|
||||
Demod.len = 0;
|
||||
Demod.state = WAIT_FOR_RISING_EDGE_OF_SOF;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Demod.posCount = 0;
|
||||
@@ -1230,6 +1257,79 @@ int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, uint8
|
||||
return len;
|
||||
}
|
||||
|
||||
/**
|
||||
* ASK CTS initialise.
|
||||
*/
|
||||
static int iso14443b_select_cts_card(iso14b_cts_card_select_t *card) {
|
||||
// INITIATE command: wake up the tag using the INITIATE
|
||||
uint8_t cmdINIT[] = {ASK_REQT, 0xF9, 0xE0};
|
||||
uint8_t cmdMSBUID[] = {ASK_SELECT, 0xFF, 0xFF, 0x00, 0x00};
|
||||
uint8_t cmdLSBUID[] = {0xC4, 0x00, 0x00};
|
||||
|
||||
AddCrc14B(cmdMSBUID, 3);
|
||||
AddCrc14B(cmdLSBUID, 1);
|
||||
|
||||
uint8_t r[8];
|
||||
|
||||
uint32_t start_time = 0;
|
||||
uint32_t eof_time = 0;
|
||||
CodeAndTransmit14443bAsReader(cmdINIT, sizeof(cmdINIT), &start_time, &eof_time);
|
||||
|
||||
eof_time += DELAY_ISO14443B_VCD_TO_VICC_READER;
|
||||
int retlen = Get14443bAnswerFromTag(r, sizeof(r), ISO14443B_READER_TIMEOUT, &eof_time);
|
||||
FpgaDisableTracing();
|
||||
|
||||
if (retlen != 4) {
|
||||
return -1;
|
||||
}
|
||||
if (check_crc(CRC_14443_B, r, retlen) == false) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (card) {
|
||||
// pc. fc Product code, Facility code
|
||||
card->pc = r[0];
|
||||
card->fc = r[1];
|
||||
}
|
||||
|
||||
start_time = eof_time + DELAY_ISO14443B_VICC_TO_VCD_READER;
|
||||
CodeAndTransmit14443bAsReader(cmdMSBUID, sizeof(cmdMSBUID), &start_time, &eof_time);
|
||||
|
||||
eof_time += DELAY_ISO14443B_VCD_TO_VICC_READER;
|
||||
retlen = Get14443bAnswerFromTag(r, sizeof(r), ISO14443B_READER_TIMEOUT, &eof_time);
|
||||
FpgaDisableTracing();
|
||||
|
||||
if (retlen != 4) {
|
||||
return -1;
|
||||
}
|
||||
if (check_crc(CRC_14443_B, r, retlen) == false) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (card) {
|
||||
memcpy(card->uid, r, 2);
|
||||
}
|
||||
|
||||
start_time = eof_time + DELAY_ISO14443B_VICC_TO_VCD_READER;
|
||||
CodeAndTransmit14443bAsReader(cmdLSBUID, sizeof(cmdLSBUID), &start_time, &eof_time);
|
||||
|
||||
eof_time += DELAY_ISO14443B_VCD_TO_VICC_READER;
|
||||
retlen = Get14443bAnswerFromTag(r, sizeof(r), ISO14443B_READER_TIMEOUT, &eof_time);
|
||||
FpgaDisableTracing();
|
||||
|
||||
if (retlen != 4) {
|
||||
return -1;
|
||||
}
|
||||
if (check_crc(CRC_14443_B, r, retlen) == false) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (card) {
|
||||
memcpy(card->uid + 2, r, 2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* SRx Initialise.
|
||||
*/
|
||||
@@ -1248,8 +1348,9 @@ static int iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||
int retlen = Get14443bAnswerFromTag(r_init, sizeof(r_init), ISO14443B_READER_TIMEOUT, &eof_time);
|
||||
FpgaDisableTracing();
|
||||
|
||||
if (retlen <= 0)
|
||||
if (retlen <= 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Randomly generated Chip ID
|
||||
if (card) {
|
||||
@@ -1272,8 +1373,6 @@ static int iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||
if (retlen != 3) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Check the CRC of the answer:
|
||||
if (!check_crc(CRC_14443_B, r_select, retlen)) {
|
||||
return -2;
|
||||
}
|
||||
@@ -1298,8 +1397,6 @@ static int iso14443b_select_srx_card(iso14b_card_select_t *card) {
|
||||
if (retlen != 10) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// The check the CRC of the answer
|
||||
if (!check_crc(CRC_14443_B, r_papid, retlen)) {
|
||||
return -2;
|
||||
}
|
||||
@@ -1692,7 +1789,7 @@ void SniffIso14443b(void) {
|
||||
expect_tag_answer = false;
|
||||
tag_is_active = false;
|
||||
} else {
|
||||
tag_is_active = (Demod.state > DEMOD_GOT_FALLING_EDGE_OF_SOF);
|
||||
tag_is_active = (Demod.state > WAIT_FOR_RISING_EDGE_OF_SOF);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1770,6 +1867,15 @@ void SendRawCommand14443B_Ex(PacketCommandNG *c) {
|
||||
if (status > 0) goto out;
|
||||
}
|
||||
|
||||
if ((param & ISO14B_SELECT_CTS) == ISO14B_SELECT_CTS) {
|
||||
iso14b_cts_card_select_t cts;
|
||||
sendlen = sizeof(iso14b_cts_card_select_t);
|
||||
status = iso14443b_select_cts_card(&cts);
|
||||
reply_mix(CMD_HF_ISO14443B_COMMAND, status, sendlen, 0, (uint8_t *)&cts, 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, (param & ISO14B_SEND_CHAINING), buf, sizeof(buf));
|
||||
sendlen = MIN(Demod.len, PM3_CMD_DATA_SIZE);
|
||||
|
||||
+2
-2
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#include "mifare.h"
|
||||
#include "iso14b.h"
|
||||
#include "pm3_cmd.h"
|
||||
|
||||
#ifndef AddCrc14A
|
||||
@@ -32,7 +32,7 @@ int iso14443b_apdu(uint8_t const *msg, size_t msg_len, bool send_chaining, uint8
|
||||
int iso14443b_select_card(iso14b_card_select_t *card);
|
||||
int iso14443b_select_card_srx(iso14b_card_select_t *card);
|
||||
|
||||
void SimulateIso14443bTag(uint32_t pupi);
|
||||
void SimulateIso14443bTag(uint8_t *pupi);
|
||||
void AcquireRawAdcSamplesIso14443b(uint32_t parameter);
|
||||
void ReadSTMemoryIso14443b(uint16_t numofblocks);
|
||||
void SniffIso14443b(void);
|
||||
|
||||
@@ -236,8 +236,8 @@ static int usage_hf_14a_sim(void) {
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
static int usage_hf_14a_sniff(void) {
|
||||
PrintAndLogEx(NORMAL, "It get data from the field and saves it into command buffer.");
|
||||
PrintAndLogEx(NORMAL, "Buffer accessible from command 'hf list 14a'");
|
||||
PrintAndLogEx(NORMAL, "Collect data from the field and save into command buffer.");
|
||||
PrintAndLogEx(NORMAL, "Buffer accessible from command 'hf 14a list'");
|
||||
PrintAndLogEx(NORMAL, "Usage: hf 14a sniff [c][r]");
|
||||
PrintAndLogEx(NORMAL, "c - triggered by first data from card");
|
||||
PrintAndLogEx(NORMAL, "r - triggered by first 7-bit request from reader (REQ,WUP,...)");
|
||||
|
||||
+276
-226
File diff suppressed because it is too large
Load Diff
@@ -19,6 +19,7 @@
|
||||
#include "crc16.h"
|
||||
#include "cmdhf14a.h"
|
||||
#include "protocols.h" // definitions of ISO14B protocol
|
||||
#include "iso14b.h"
|
||||
|
||||
#define TIMEOUT 2000
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "crc16.h"
|
||||
#include "util.h"
|
||||
#include "ui.h"
|
||||
#include "mifare.h" // felica_card_select_t struct
|
||||
#include "iso18.h" // felica_card_select_t struct
|
||||
#include "des.h"
|
||||
#define AddCrc(data, len) compute_crc(CRC_FELICA, (data), (len), (data)+(len)+1, (data)+(len))
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#define CMDHFFELICA_H__
|
||||
|
||||
#include "common.h"
|
||||
#include "mifare.h"
|
||||
#include "iso18.h"
|
||||
|
||||
int CmdHFFelica(const char *Cmd);
|
||||
int readFelicaUid(bool verbose);
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
# Cliparser
|
||||
|
||||
The old style with mixed custom commandline parsing of user parameters or options was messy and confusing. You can find all kinds in the Proxmark3 client.
|
||||
Samples
|
||||
```
|
||||
data xxxx h
|
||||
script run x.lua -h
|
||||
hf 14a raw -h
|
||||
hf 14b raw -ss
|
||||
lf search 1
|
||||
lf config h H
|
||||
```
|
||||
In order to counter this and unify it, there was discussion over at the official repository a few years ago (link to issue) and there it became clear a change is needed. Among the different solutions suggested @merlokk's idea of using the lib cliparser was agreed upon. The lib was adapted and implemented for commands like
|
||||
```
|
||||
emv
|
||||
hf fido
|
||||
```
|
||||
And then it fell into silence since it wasn't well documented how to use the cliparser. Looking at source code wasn't very efficient. However the need of a better cli parsing was still there. Fast forward today, where more commands has used the cliparser but it still wasn't the natural way when adding a new client command to the Proxmark3 client. After more discussions among @doegox, @iceman1001 and @mrwalker the concept became more clear on how to use the cliparser lib in the _preferred_ way. The aftermath was a design and layout specfied which lead to a simpler implemtentation of the cliparser in the client source code while still unfiy all helptexts with the new colours support and a defined layout. As seen below, the simplicity and clearness.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
## cliparser setup and use
|
||||
|
||||
The parser will format and color and layout as needed.
|
||||
It will also add the `-h --help` option automatic.
|
||||
|
||||
## design comments
|
||||
|
||||
* where possiable all options should be lowercase.
|
||||
* extended options preceeded with -- should be short
|
||||
* options provided directly (without an option identifier) should be avoided.
|
||||
* -vv for extra verbos should be avoided; use of debug level is prefered.
|
||||
* with --options the equal is not needed (will work with and without) so dont use '='
|
||||
e.g. cmd --cn 12345
|
||||
|
||||
|
||||
|
||||
## common options
|
||||
-h --help : help
|
||||
--cn : card number
|
||||
--fn : facility number
|
||||
--q5 : target is lf q5 card
|
||||
--raw : raw data
|
||||
-k --key : key supplied
|
||||
-n --keyno : key number to use
|
||||
-v --verbose : flag when output should provide more information, not conidered debug.
|
||||
-1 --buffer : use the sample buffer
|
||||
|
||||
|
||||
|
||||
## How to implement in source code
|
||||
|
||||
### setup the parser data structure
|
||||
Header file to include
|
||||
|
||||
#include "cliparser.h"
|
||||
|
||||
In the command function, setup the context
|
||||
|
||||
CLIParserContext *ctx;
|
||||
|
||||
|
||||
### define the text
|
||||
CLIParserInit (\<context\>, \<description\>, \<notes\n examples ... \>);
|
||||
|
||||
use -> to seperate example and example comment and \\n to seperate examples.
|
||||
e.g. lf indala clone -r a0000000a0002021 -> this uses .....
|
||||
|
||||
CLIParserInit(&ctx, "lf indala clone",
|
||||
"clone INDALA UID to T55x7 or Q5/T5555 tag",
|
||||
"lf indala clone --heden 888\n"
|
||||
"lf indala clone --fc 123 --cn 1337\n"
|
||||
"lf indala clone -r a0000000a0002021\n"
|
||||
"lf indala clone -l -r 80000001b23523a6c2e31eba3cbee4afb3c6ad1fcf649393928c14e5");
|
||||
|
||||
### define the options
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
arg_lit0("l", "long", "optional - long UID 224 bits"),
|
||||
arg_int0("c", "heden", "<decimal>", "Cardnumber for Heden 2L format"),
|
||||
arg_strx0("r", "raw", "<hex>", "raw bytes"),
|
||||
arg_lit0("q", "Q5", "optional - specify writing to Q5/T5555 tag"),
|
||||
arg_int0(NULL, "fc", "<decimal>", "Facility Code (26 bit format)"),
|
||||
arg_int0(NULL, "cn", "<decimal>", "Cardnumber (26 bit format)"),
|
||||
arg_param_end
|
||||
};
|
||||
|
||||
_All options has a parameter index, since `-h --help` is added automatic, it will be assigned index 0.
|
||||
Hence all options you add will start at index 1 and upwards._
|
||||
|
||||
**Notes:**
|
||||
booleen : arg_lit0 ("\<short option\>", "\<long option\>", \["\<format\>",\] \<"description"\>)
|
||||
|
||||
**integer**
|
||||
optional integer : arg_int0 ("\<short option\>", "\<long option\>", \["\<format\>",\] \<"description"\>)\
|
||||
required integer : arg_int1 ("\<short option\>", "\<long option\>", \["\<format\>",\] \<"description"\>)
|
||||
|
||||
**Strings 0 or 1**
|
||||
optional string : arg_str0("\<short option\>", "\<long option\>", \["\<format\>",\] \<"description"\>)\
|
||||
required string : arg_str1("\<short option\>", "\<long option\>", \["\<format\>",\] \<"description"\>)
|
||||
|
||||
**Strings x to 250**
|
||||
optional string : arg_strx0 ("\<short option\>", "\<long option\>", \["\<format\>",\] \<"description"\>)\
|
||||
required string : arg_strx1 ("\<short option\>", "\<long option\>", \["\<format\>",\] \<"description"\>)
|
||||
|
||||
**if an option does not have a short or long option, use NULL in its place**
|
||||
|
||||
### show the menu
|
||||
CLIExecWithReturn(\<context\>, \<command line to parse\>, \<arg/opt table\>, \<return on error\>);
|
||||
|
||||
CLIExecWithReturn(ctx, Cmd, argtable, false);
|
||||
|
||||
### clean up
|
||||
Once you have extracted the options, cleanup the context.
|
||||
|
||||
CLIParserFree(ctx);
|
||||
|
||||
### retreiving options
|
||||
**bool option**
|
||||
arg_get_lit(\<context\>, \<opt index\>);
|
||||
|
||||
is_long_uid = arg_get_lit(ctx, 1);
|
||||
|
||||
**int option**
|
||||
arg_get_int_def(\<context\>, \<opt index\>, \<default value\>);
|
||||
|
||||
cardnumber = arg_get_int_def(ctx, 2, -1);
|
||||
|
||||
**hex option**
|
||||
CLIGetHexWithReturn(\<context\>, \<opt index\>, \<store variable\>, \<ptr to stored length\>);
|
||||
?? as an array of uint_8 ??
|
||||
|
||||
uint8_t aid[2] = {0};
|
||||
int aidlen;
|
||||
CLIGetHexWithReturn(ctx, 2, aid, &aidlen);
|
||||
|
||||
**hex option returning ???**
|
||||
|
||||
uint8_t key[24] = {0};
|
||||
int keylen = 0;
|
||||
int res_klen = CLIParamHexToBuf(arg_get_str(ctx, 3), key, 24, &keylen);
|
||||
quick test : seems res_keylen == 0 when ok so not key len ???
|
||||
|
||||
**string option**
|
||||
CLIGetStrWithReturn(\<context\>,\<opt index\>, \<unsigned char \*\>, \<int \*\>);
|
||||
|
||||
uint8_t Buffer[100];
|
||||
int BufLen;
|
||||
CLIGetStrWithReturn(ctx,7, Buffer, &BufLen);
|
||||
|
||||
+5
-3
@@ -92,7 +92,8 @@ module fpga_hf(
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Attempt to write up how its hooked up. Iceman 2020.
|
||||
Attempt to write up how its hooked up.
|
||||
/ Iceman, 2020
|
||||
|
||||
Communication between ARM / FPGA is done inside armsrc/fpgaloader.c see: function FpgaSendCommand()
|
||||
Send 16 bit command / data pair to FPGA
|
||||
@@ -108,8 +109,9 @@ module fpga_hf(
|
||||
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||
-----+-------------------------------------------
|
||||
cmd | x x x x
|
||||
major| x x x
|
||||
opt | x x x
|
||||
major| x x x
|
||||
opt | x x x x
|
||||
sub | x x
|
||||
divi | x x x x x x x x
|
||||
thres| x x x x x x x x
|
||||
-----+-------------------------------------------
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ module fpga_lf(
|
||||
lf_ed_threshold = 8bits threshold value.
|
||||
|
||||
conf_word 12bits
|
||||
conf_word[7:5] = 3bit major mode.
|
||||
conf_word[8:6] = 3bit major mode.
|
||||
conf_word[0] = 1bit lf_field
|
||||
conf_word[1] = 1bit lf_ed_toggle_mode
|
||||
conf_word[7:0] = 8bit divisor
|
||||
@@ -110,7 +110,7 @@ module fpga_lf(
|
||||
bit | 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||
-----+-------------------------------------------
|
||||
cmd | x x x x
|
||||
major| x x x
|
||||
major| x x x
|
||||
opt | x x
|
||||
divi | x x x x x x x x
|
||||
thres| x x x x x x x x
|
||||
|
||||
+4
-3
@@ -39,6 +39,7 @@ wire disabl = mod_type[0];
|
||||
// Most off, oe4 for modulation;
|
||||
// Trying reader emulation (would presumably just require switching power on, but I am not sure)
|
||||
assign pwr_lo = 1'b0;
|
||||
assign pwr_oe2 = 1'b0;
|
||||
|
||||
// 512x64/fc -wait before ts0, 32768 ticks
|
||||
// tslot: 256*64/fc
|
||||
@@ -339,7 +340,6 @@ end
|
||||
//put modulation here to maintain the correct clock. Seems that some readers are sensitive to that
|
||||
reg pwr_hi;
|
||||
reg pwr_oe1;
|
||||
reg pwr_oe2;
|
||||
reg pwr_oe3;
|
||||
reg pwr_oe4;
|
||||
|
||||
@@ -351,7 +351,6 @@ begin
|
||||
begin
|
||||
pwr_hi <= ck_1356meg;
|
||||
pwr_oe1 <= 1'b0;//mod;
|
||||
pwr_oe2 <= 1'b0;//mod;
|
||||
pwr_oe3 <= 1'b0;//mod;
|
||||
pwr_oe4 <= mod;//1'b0;
|
||||
end
|
||||
@@ -359,10 +358,12 @@ begin
|
||||
begin
|
||||
pwr_hi <= 1'b0;
|
||||
pwr_oe1 <= 1'b0;
|
||||
pwr_oe2 <= 1'b0;
|
||||
pwr_oe3 <= 1'b0;
|
||||
pwr_oe4 <= mod;
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
endmodule
|
||||
|
||||
+2
-5
@@ -540,16 +540,14 @@ begin
|
||||
bit_to_arm = sendbit;
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
assign ssp_din = bit_to_arm;
|
||||
|
||||
// Subcarrier (adc_clk/16, for FPGA_HF_ISO14443A_TAGSIM_MOD only).
|
||||
wire sub_carrier;
|
||||
assign sub_carrier = ~sub_carrier_cnt[3];
|
||||
|
||||
// in FPGA_HF_ISO14443A_READER_MOD: drop carrier for mod_sig_coil==1 (pause); in FPGA_HF_ISO14443A_READER_LISTEN: carrier always on; in other modes: carrier always off
|
||||
// in FPGA_HF_ISO14443A_READER_MOD: drop carrier for mod_sig_coil == 1 (pause);
|
||||
// in FPGA_HF_ISO14443A_READER_LISTEN: carrier always on; in other modes: carrier always off
|
||||
assign pwr_hi = (ck_1356meg & (((mod_type == `FPGA_HF_ISO14443A_READER_MOD) & ~mod_sig_coil) || (mod_type == `FPGA_HF_ISO14443A_READER_LISTEN)));
|
||||
|
||||
|
||||
@@ -566,7 +564,6 @@ assign pwr_oe4 = mod_sig_coil & sub_carrier & (mod_type == `FPGA_HF_ISO14443A_TA
|
||||
assign pwr_oe2 = 1'b0;
|
||||
assign pwr_lo = 1'b0;
|
||||
|
||||
|
||||
assign dbg = negedge_cnt[3];
|
||||
|
||||
endmodule
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// (c) 2020 Iceman
|
||||
//
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
// ISO 14443B type prototyping
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _ISO14B_H_
|
||||
#define _ISO14B_H_
|
||||
|
||||
#include "common.h"
|
||||
typedef struct {
|
||||
uint8_t uid[10];
|
||||
uint8_t uidlen;
|
||||
uint8_t atqb[7];
|
||||
uint8_t chipid;
|
||||
uint8_t cid;
|
||||
} PACKED iso14b_card_select_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t uid[4];
|
||||
uint8_t pc;
|
||||
uint8_t fc;
|
||||
} PACKED iso14b_cts_card_select_t;
|
||||
|
||||
typedef enum ISO14B_COMMAND {
|
||||
ISO14B_CONNECT = (1 << 0),
|
||||
ISO14B_DISCONNECT = (1 << 1),
|
||||
ISO14B_APDU = (1 << 2),
|
||||
ISO14B_RAW = (1 << 3),
|
||||
ISO14B_REQUEST_TRIGGER = (1 << 4),
|
||||
ISO14B_APPEND_CRC = (1 << 5),
|
||||
ISO14B_SELECT_STD = (1 << 6),
|
||||
ISO14B_SELECT_SR = (1 << 7),
|
||||
ISO14B_SET_TIMEOUT = (1 << 8),
|
||||
ISO14B_SEND_CHAINING = (1 << 9),
|
||||
ISO14B_SELECT_CTS = (1 << 10),
|
||||
} iso14b_command_t;
|
||||
|
||||
#endif // _ISO14B_H_
|
||||
@@ -0,0 +1,33 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// (c) 2020 Iceman
|
||||
//
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
// ISO 15693 type prototyping
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef _ISO15_H_
|
||||
#define _ISO15_H_
|
||||
|
||||
#include "common.h"
|
||||
typedef struct {
|
||||
uint8_t uid[10];
|
||||
uint8_t uidlen;
|
||||
uint8_t atqb[7];
|
||||
uint8_t chipid;
|
||||
uint8_t cid;
|
||||
} PACKED iso14b_card_select_t;
|
||||
|
||||
typedef enum ISO15_COMMAND {
|
||||
ISO15_CONNECT = (1 << 0),
|
||||
ISO15_NO_DISCONNECT = (1 << 1),
|
||||
ISO15_RAW = (1 << 2),
|
||||
ISO15_APPEND_CRC = (1 << 3),
|
||||
ISO15_HIGH_SPEED = (1 << 4),
|
||||
ISO15_READ_RESPONSE = (1 << 5)
|
||||
} iso15_command_t;
|
||||
|
||||
|
||||
#endif // _ISO15_H_
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// (c) 2020 Iceman
|
||||
//
|
||||
// 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.
|
||||
//-----------------------------------------------------------------------------
|
||||
// ISO 18002 / FeliCa type prototyping
|
||||
//-----------------------------------------------------------------------------
|
||||
#ifndef _ISO18_H_
|
||||
#define _ISO18_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
typedef enum FELICA_COMMAND {
|
||||
FELICA_CONNECT = (1 << 0),
|
||||
FELICA_NO_DISCONNECT = (1 << 1),
|
||||
FELICA_RAW = (1 << 3),
|
||||
FELICA_APPEND_CRC = (1 << 5),
|
||||
FELICA_NO_SELECT = (1 << 6),
|
||||
} felica_command_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// FeliCa
|
||||
//-----------------------------------------------------------------------------
|
||||
// IDm = ID manufacturer
|
||||
// mc = manufactureCode
|
||||
// mc1 mc2 u1 u2 u3 u4 u5 u6
|
||||
// PMm = Product manufacturer
|
||||
// icCode =
|
||||
// ic1 = ROM
|
||||
// ic2 = IC
|
||||
// maximum response time =
|
||||
// B3(request service)
|
||||
// B4(request response)
|
||||
// B5(authenticate)
|
||||
// B6(read)
|
||||
// B7(write)
|
||||
// B8()
|
||||
|
||||
// ServiceCode 2bytes (access-rights)
|
||||
// FileSystem = 1 Block = 16 bytes
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t IDm[8];
|
||||
uint8_t code[2];
|
||||
uint8_t uid[6];
|
||||
uint8_t PMm[8];
|
||||
uint8_t iccode[2];
|
||||
uint8_t mrt[6];
|
||||
uint8_t servicecode[2];
|
||||
} PACKED felica_card_select_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t sync[2];
|
||||
uint8_t length[1];
|
||||
uint8_t cmd_code[1];
|
||||
uint8_t IDm[8];
|
||||
} PACKED felica_frame_response_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t status_flag1[1];
|
||||
uint8_t status_flag2[1];
|
||||
} PACKED felica_status_flags_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t node_number[1];
|
||||
uint8_t node_key_versions[2];
|
||||
} PACKED felica_request_service_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t mode[1];
|
||||
} PACKED felica_request_request_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
felica_status_flags_t status_flags;
|
||||
uint8_t number_of_block[1];
|
||||
uint8_t block_data[16];
|
||||
uint8_t block_element_number[1];
|
||||
} PACKED felica_read_without_encryption_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
felica_status_flags_t status_flags;
|
||||
} PACKED felica_status_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t number_of_systems[1];
|
||||
uint8_t system_code_list[32];
|
||||
} PACKED felica_syscode_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
felica_status_flags_t status_flags;
|
||||
uint8_t format_version[1];
|
||||
uint8_t basic_version[2];
|
||||
uint8_t number_of_option[1];
|
||||
uint8_t option_version_list[4];
|
||||
} PACKED felica_request_spec_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t m2c[8];
|
||||
uint8_t m3c[8];
|
||||
} PACKED felica_auth1_response_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t code[1];
|
||||
uint8_t IDtc[8];
|
||||
uint8_t IDi[8];
|
||||
uint8_t PMi[8];
|
||||
} PACKED felica_auth2_response_t;
|
||||
|
||||
#endif // _ISO18_H_
|
||||
+7
-143
@@ -94,40 +94,6 @@ typedef enum {
|
||||
MFDES_ALGO_AES = 4
|
||||
} mifare_des_authalgo_t;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ISO 14443B
|
||||
//-----------------------------------------------------------------------------
|
||||
typedef struct {
|
||||
uint8_t uid[10];
|
||||
uint8_t uidlen;
|
||||
uint8_t atqb[7];
|
||||
uint8_t chipid;
|
||||
uint8_t cid;
|
||||
} PACKED iso14b_card_select_t;
|
||||
|
||||
typedef enum ISO14B_COMMAND {
|
||||
ISO14B_CONNECT = (1 << 0),
|
||||
ISO14B_DISCONNECT = (1 << 1),
|
||||
ISO14B_APDU = (1 << 2),
|
||||
ISO14B_RAW = (1 << 3),
|
||||
ISO14B_REQUEST_TRIGGER = (1 << 4),
|
||||
ISO14B_APPEND_CRC = (1 << 5),
|
||||
ISO14B_SELECT_STD = (1 << 6),
|
||||
ISO14B_SELECT_SR = (1 << 7),
|
||||
ISO14B_SET_TIMEOUT = (1 << 8),
|
||||
ISO14B_SEND_CHAINING = (1 << 9),
|
||||
} iso14b_command_t;
|
||||
|
||||
typedef enum ISO15_COMMAND {
|
||||
ISO15_CONNECT = (1 << 0),
|
||||
ISO15_NO_DISCONNECT = (1 << 1),
|
||||
ISO15_RAW = (1 << 2),
|
||||
ISO15_APPEND_CRC = (1 << 3),
|
||||
ISO15_HIGH_SPEED = (1 << 4),
|
||||
ISO15_READ_RESPONSE = (1 << 5)
|
||||
} iso15_command_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// "hf 14a sim x", "hf mf sim x" attacks
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -158,116 +124,14 @@ typedef struct {
|
||||
} PACKED smart_card_atr_t;
|
||||
|
||||
typedef enum SMARTCARD_COMMAND {
|
||||
SC_CONNECT = (1 << 0),
|
||||
SC_NO_DISCONNECT = (1 << 1),
|
||||
SC_RAW = (1 << 2),
|
||||
SC_SELECT = (1 << 3),
|
||||
SC_RAW_T0 = (1 << 4),
|
||||
SC_CLEARLOG = (1 << 5),
|
||||
SC_LOG = (1 << 6),
|
||||
SC_CONNECT = (1 << 0),
|
||||
SC_NO_DISCONNECT = (1 << 1),
|
||||
SC_RAW = (1 << 2),
|
||||
SC_SELECT = (1 << 3),
|
||||
SC_RAW_T0 = (1 << 4),
|
||||
SC_CLEARLOG = (1 << 5),
|
||||
SC_LOG = (1 << 6),
|
||||
} smartcard_command_t;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// FeliCa
|
||||
//-----------------------------------------------------------------------------
|
||||
// IDm = ID manufacturer
|
||||
// mc = manufactureCode
|
||||
// mc1 mc2 u1 u2 u3 u4 u5 u6
|
||||
// PMm = Product manufacturer
|
||||
// icCode =
|
||||
// ic1 = ROM
|
||||
// ic2 = IC
|
||||
// maximum response time =
|
||||
// B3(request service)
|
||||
// B4(request response)
|
||||
// B5(authenticate)
|
||||
// B6(read)
|
||||
// B7(write)
|
||||
// B8()
|
||||
|
||||
// ServiceCode 2bytes (access-rights)
|
||||
// FileSystem = 1 Block = 16 bytes
|
||||
typedef struct {
|
||||
uint8_t IDm[8];
|
||||
uint8_t code[2];
|
||||
uint8_t uid[6];
|
||||
uint8_t PMm[8];
|
||||
uint8_t iccode[2];
|
||||
uint8_t mrt[6];
|
||||
uint8_t servicecode[2];
|
||||
} PACKED felica_card_select_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t sync[2];
|
||||
uint8_t length[1];
|
||||
uint8_t cmd_code[1];
|
||||
uint8_t IDm[8];
|
||||
} PACKED felica_frame_response_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t status_flag1[1];
|
||||
uint8_t status_flag2[1];
|
||||
} PACKED felica_status_flags_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t node_number[1];
|
||||
uint8_t node_key_versions[2];
|
||||
} PACKED felica_request_service_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t mode[1];
|
||||
} PACKED felica_request_request_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
felica_status_flags_t status_flags;
|
||||
uint8_t number_of_block[1];
|
||||
uint8_t block_data[16];
|
||||
uint8_t block_element_number[1];
|
||||
} PACKED felica_read_without_encryption_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
felica_status_flags_t status_flags;
|
||||
} PACKED felica_status_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t number_of_systems[1];
|
||||
uint8_t system_code_list[32];
|
||||
} PACKED felica_syscode_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
felica_status_flags_t status_flags;
|
||||
uint8_t format_version[1];
|
||||
uint8_t basic_version[2];
|
||||
uint8_t number_of_option[1];
|
||||
uint8_t option_version_list[4];
|
||||
} PACKED felica_request_spec_response_t;
|
||||
|
||||
typedef struct {
|
||||
felica_frame_response_t frame_response;
|
||||
uint8_t m2c[8];
|
||||
uint8_t m3c[8];
|
||||
} PACKED felica_auth1_response_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t code[1];
|
||||
uint8_t IDtc[8];
|
||||
uint8_t IDi[8];
|
||||
uint8_t PMi[8];
|
||||
} PACKED felica_auth2_response_t;
|
||||
|
||||
|
||||
typedef enum FELICA_COMMAND {
|
||||
FELICA_CONNECT = (1 << 0),
|
||||
FELICA_NO_DISCONNECT = (1 << 1),
|
||||
FELICA_RAW = (1 << 3),
|
||||
FELICA_APPEND_CRC = (1 << 5),
|
||||
FELICA_NO_SELECT = (1 << 6),
|
||||
} felica_command_t;
|
||||
|
||||
#endif // _MIFARE_H_
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user