Merge pull request #449 from DidierA/hfsniff-fix
Deploy wiki to GitHub Pages with Jekyll / build (push) Canceled after 0s
Deploy wiki to GitHub Pages with Jekyll / deploy (push) Canceled after 0s
Firmware build / Build firmware (ultra) (push) Canceled after 0s
Firmware build / Build firmware (lite) (push) Canceled after 0s
Firmware build / Build fw-builder Docker image (push) Canceled after 0s
Client build / Build client (Compress-Archive -Path software\dist\* -DestinationPath client-windows.zip , windows, windows-latest, ? . ) (push) Canceled after 0s
Client build / Build client ((cd software/dist && zip -r "$OLDPWD/client-macos.zip" .) , macos, macos-latest, true ) (push) Canceled after 0s
Client build / Build client ((cd software/dist && zip -r "$OLDPWD/client-linux.zip" .) , linux, ubuntu-latest, true ) (push) Canceled after 0s
Push handler / Create dev pre-release with artifacts (push) Canceled after 0s
Push handler / Create tagged release with artifacts (push) Canceled after 0s
Push handler / Start the next PR review cycle (push) Canceled after 0s
Push handler / Build Firmware (push) Canceled after 0s

nfc_tag_14a_event_callback(): Fixes wrong reported length when sniffing
This commit is contained in:
GameTec-live
2026-10-04 10:45:39 +02:00
committed by GitHub
3 changed files with 3 additions and 10 deletions
+1
View File
@@ -3,6 +3,7 @@ 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]
- Fix wrong data reported by hf 14a sniff on frames containing more than 7 parity bits (@DidierA)
- Added MIFARE Ultralight C authentication and emulation (@Foxushka)
## [v2.2.0][2026-07-04]
-3
View File
@@ -2708,14 +2708,12 @@ static data_frame_tx_t *cmd_processor_hf14a_4_reader_apdu(uint16_t cmd, uint16_t
}
/* Copy data portion (strip PCB + CRC), then handle chaining */
uint8_t blk_num = 0;
uint8_t resp_pcb = resp_buf[0];
uint8_t dlen = resp_bytes - 3; /* subtract PCB(1) + CRC(2) */
if (dlen > 0 && resp_chain_len + dlen < sizeof(resp_chain)) {
memcpy(&resp_chain[resp_chain_len], &resp_buf[1], dlen);
resp_chain_len += dlen;
}
blk_num ^= 1;
/* ISO14443-4 chaining: PCB bit5 (0x20) set means more blocks follow */
while (resp_pcb & 0x20) {
@@ -2738,7 +2736,6 @@ static data_frame_tx_t *cmd_processor_hf14a_4_reader_apdu(uint16_t cmd, uint16_t
memcpy(&resp_chain[resp_chain_len], &resp_buf[1], dlen);
resp_chain_len += dlen;
}
blk_num ^= 1;
}
return data_frame_make(cmd, STATUS_HF_TAG_OK, resp_chain_len, resp_chain);
@@ -699,13 +699,8 @@ void nfc_tag_14a_event_callback(nrfx_nfct_evt_t const *p_event) {
uint32_t amt = NRF_NFCT->TXD.AMOUNT;
uint16_t tx_bytes = (amt >> NFCT_TXD_AMOUNT_TXDATABYTES_Pos)
& (NFCT_TXD_AMOUNT_TXDATABYTES_Msk >> NFCT_TXD_AMOUNT_TXDATABYTES_Pos);
uint16_t tx_bits_rem = (amt >> NFCT_TXD_AMOUNT_TXDATABITS_Pos)
& (NFCT_TXD_AMOUNT_TXDATABITS_Msk >> NFCT_TXD_AMOUNT_TXDATABITS_Pos);
uint16_t tx_bits = (tx_bits_rem > 0)
? ((tx_bytes - 1) * 8 + tx_bits_rem)
: (tx_bytes * 8);
if (tx_bits > 0 && tx_bytes <= MAX_NFC_TX_BUFFER_SIZE) {
m_tx_sniff_cb(m_nfc_tx_buffer, tx_bits);
if (amt > 0 && tx_bytes <= MAX_NFC_TX_BUFFER_SIZE) {
m_tx_sniff_cb(m_nfc_tx_buffer, amt);
}
}
break;