mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
style
This commit is contained in:
parent
239ae6c59e
commit
3c873d34bc
4 changed files with 46 additions and 44 deletions
|
@ -906,7 +906,7 @@ static bool create_legacy_em4x70_bitstream_for_cmd_id(em4x70_command_bitstream_t
|
||||||
memset(out_cmd_bitstream, 0, sizeof(em4x70_command_bitstream_t));
|
memset(out_cmd_bitstream, 0, sizeof(em4x70_command_bitstream_t));
|
||||||
out_cmd_bitstream->command = EM4X70_COMMAND_ID;
|
out_cmd_bitstream->command = EM4X70_COMMAND_ID;
|
||||||
//uint8_t cmd = with_command_parity ? 0x3u : 0x1u;
|
//uint8_t cmd = with_command_parity ? 0x3u : 0x1u;
|
||||||
uint8_t cmd = 0x3u;
|
uint8_t cmd = 0x3u;
|
||||||
result = result && add_nibble_to_bitstream(&out_cmd_bitstream->to_send, cmd, false);
|
result = result && add_nibble_to_bitstream(&out_cmd_bitstream->to_send, cmd, false);
|
||||||
out_cmd_bitstream->to_receive.bitcount = 32;
|
out_cmd_bitstream->to_receive.bitcount = 32;
|
||||||
if (out_cmd_bitstream->to_send.bitcount != expected_bits_to_send) {
|
if (out_cmd_bitstream->to_send.bitcount != expected_bits_to_send) {
|
||||||
|
|
|
@ -451,7 +451,7 @@ void hitag_tag_receive_frame(uint8_t *rx, size_t sizeofrx, size_t *rxlen, uint32
|
||||||
|
|
||||||
// Receive frame, watch for at most T0*EOF periods
|
// Receive frame, watch for at most T0*EOF periods
|
||||||
while (AT91C_BASE_TC1->TC_CV < T0 * HITAG_T_EOF) {
|
while (AT91C_BASE_TC1->TC_CV < T0 * HITAG_T_EOF) {
|
||||||
|
|
||||||
// Check if edge in modulation is detected
|
// Check if edge in modulation is detected
|
||||||
if (AT91C_BASE_TC1->TC_SR & next_edge_event) {
|
if (AT91C_BASE_TC1->TC_SR & next_edge_event) {
|
||||||
next_edge_event = next_edge_event ^ (AT91C_TC_LDRAS | AT91C_TC_LDRBS);
|
next_edge_event = next_edge_event ^ (AT91C_TC_LDRAS | AT91C_TC_LDRBS);
|
||||||
|
|
|
@ -3116,48 +3116,48 @@ int iso14_apdu(uint8_t *cmd, uint16_t cmd_len, bool send_chaining, void *data, u
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
BigBuf_free();
|
BigBuf_free();
|
||||||
return 0; // DATA LINK ERROR
|
return 0; // DATA LINK ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// S-Block WTX
|
// S-Block WTX
|
||||||
while (len && ((data_bytes[0] & 0xF2) == 0xF2)) {
|
while (len && ((data_bytes[0] & 0xF2) == 0xF2)) {
|
||||||
uint32_t save_iso14a_timeout = iso14a_get_timeout();
|
uint32_t save_iso14a_timeout = iso14a_get_timeout();
|
||||||
// temporarily increase timeout
|
// temporarily increase timeout
|
||||||
iso14a_set_timeout(MAX((data_bytes[1] & 0x3f) * save_iso14a_timeout, MAX_ISO14A_TIMEOUT));
|
iso14a_set_timeout(MAX((data_bytes[1] & 0x3f) * save_iso14a_timeout, MAX_ISO14A_TIMEOUT));
|
||||||
// Transmit WTX back
|
// Transmit WTX back
|
||||||
// byte1 - WTXM [1..59]. command FWT=FWT*WTXM
|
// byte1 - WTXM [1..59]. command FWT=FWT*WTXM
|
||||||
data_bytes[1] = data_bytes[1] & 0x3f; // 2 high bits mandatory set to 0b
|
data_bytes[1] = data_bytes[1] & 0x3f; // 2 high bits mandatory set to 0b
|
||||||
// now need to fix CRC.
|
// now need to fix CRC.
|
||||||
AddCrc14A(data_bytes, len - 2);
|
AddCrc14A(data_bytes, len - 2);
|
||||||
// transmit S-Block
|
// transmit S-Block
|
||||||
ReaderTransmit(data_bytes, len, NULL);
|
ReaderTransmit(data_bytes, len, NULL);
|
||||||
// retrieve the result again (with increased timeout)
|
// retrieve the result again (with increased timeout)
|
||||||
data_bytes[0] = 0x00;
|
data_bytes[0] = 0x00;
|
||||||
len = ReaderReceive(data, data_len, parity_array);
|
len = ReaderReceive(data, data_len, parity_array);
|
||||||
data_bytes = data;
|
data_bytes = data;
|
||||||
// restore timeout
|
// restore timeout
|
||||||
iso14a_set_timeout(save_iso14a_timeout);
|
iso14a_set_timeout(save_iso14a_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we received an I- or R(ACK)-Block with a block number equal to the
|
// if we received an I- or R(ACK)-Block with a block number equal to the
|
||||||
// current block number, toggle the current block number
|
// current block number, toggle the current block number
|
||||||
if (len >= 3 // PCB+CRC = 3 bytes
|
if (len >= 3 // PCB+CRC = 3 bytes
|
||||||
&& ((data_bytes[0] & 0xC0) == 0 // I-Block
|
&& ((data_bytes[0] & 0xC0) == 0 // I-Block
|
||||||
|| (data_bytes[0] & 0xD0) == 0x80) // R-Block with ACK bit set to 0
|
|| (data_bytes[0] & 0xD0) == 0x80) // R-Block with ACK bit set to 0
|
||||||
&& (data_bytes[0] & 0x01) == iso14_pcb_blocknum) { // equal block numbers
|
&& (data_bytes[0] & 0x01) == iso14_pcb_blocknum) { // equal block numbers
|
||||||
iso14_pcb_blocknum ^= 1;
|
iso14_pcb_blocknum ^= 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we received I-block with chaining we need to send ACK and receive another block of data
|
// if we received I-block with chaining we need to send ACK and receive another block of data
|
||||||
if (res) {
|
if (res) {
|
||||||
*res = data_bytes[0];
|
*res = data_bytes[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
// crc check
|
// crc check
|
||||||
if (len >= 3 && !CheckCrc14A(data_bytes, len)) {
|
if (len >= 3 && !CheckCrc14A(data_bytes, len)) {
|
||||||
BigBuf_free();
|
BigBuf_free();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
// cut frame byte
|
// cut frame byte
|
||||||
|
|
|
@ -10102,14 +10102,16 @@
|
||||||
"description": "Simulate Hitag S transponder You need to `lf hitag hts eload` first",
|
"description": "Simulate Hitag S transponder You need to `lf hitag hts eload` first",
|
||||||
"notes": [
|
"notes": [
|
||||||
"lf hitag hts sim",
|
"lf hitag hts sim",
|
||||||
"lf hitag hts sim --82xx"
|
"lf hitag hts sim --82xx",
|
||||||
|
"lf hitag hts sim -t 30 -> set threshold to 30"
|
||||||
],
|
],
|
||||||
"offline": false,
|
"offline": false,
|
||||||
"options": [
|
"options": [
|
||||||
"-h, --help This help",
|
"-h, --help This help",
|
||||||
"-8, --82xx simulate 8268/8310"
|
"-8, --82xx simulate 8268/8310",
|
||||||
|
"-t, --threshold <dec> set edge detect threshold (def: 127)"
|
||||||
],
|
],
|
||||||
"usage": "lf hitag hts sim [-h8]"
|
"usage": "lf hitag hts sim [-h8] [-t <dec>]"
|
||||||
},
|
},
|
||||||
"lf hitag hts wrbl": {
|
"lf hitag hts wrbl": {
|
||||||
"command": "lf hitag hts wrbl",
|
"command": "lf hitag hts wrbl",
|
||||||
|
@ -13248,6 +13250,6 @@
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"commands_extracted": 761,
|
"commands_extracted": 761,
|
||||||
"extracted_by": "PM3Help2JSON v1.00",
|
"extracted_by": "PM3Help2JSON v1.00",
|
||||||
"extracted_on": "2025-03-19T08:33:58"
|
"extracted_on": "2025-03-19T10:24:44"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue