fix: recover the SMS-SUBMIT listings in RAM Explore (v3.6.4)
Explore returned partial data (no ELF/module entries, the installed package
missing) and then failed with cntr_low. Two causes, both in the
actual-response SMS-SUBMIT path the card uses for big listings:
- `_find_sms_tpdu` read TLV lengths as a single byte; the FETCH carries
`8B 81 97 ...` (BER long form) for the big pages, so it returned a
corrupted, truncated TPDU.
- `_calc_ud_offset` treated the SMS-SUBMIT relative validity period (VPF=10)
as 7 bytes instead of 1, shifting the UD offset: `_parse_sms_concat` then
read a bogus UDH and reported no concatenation, so the segments never
assembled and the PoR/data was dropped ("RAM RESPONSE-PACKET: empty").
The step was marked failed, the counter did not advance, the same counter
was retried and the card answered `cntr_low`, which also blocked P1=10
(modules) where the installed package appears.
- the captured segments now always store the assembled UD (`submit_ud_hex`);
`_sms_submit_por()` rebuilds the DELIVER-style packet (`02 71 00` + UD) for
`_decode_por`. Verified against the live capture: por_ok, remote SW 6310,
438 hex chars of listing data (the exact bytes of the P1=20 page).
- `spPorAccepted` counts `actual_response_sms_submit` (0x0B) as accepted, so
the counter advances when the data follows via SMS-SUBMIT.
Explore queries follow GP Card Spec v2.3.1 11.4.2.2: compact listings
(P2.b2=0) with the chained GET RESPONSE (`ramGetStatusApdu`, paging P2=00 ->
P2=01), the malformed P2=02 attempt is gone, and the ISD-only query (P1=80)
never pages with next-occurrence (the card shall reject it).
Tests: Python SmsSubmitCaptureTest with the live FETCH bytes (TPDU length,
UD offset, concat reassembly, 027100+UD decode); ram.test.js checks the APDU
builder and the missing P2=02 attempt; cards_counter covers 0x0B.
608 frontend / 492 Python green; version 3.6.4; sw simple-v277.
This commit is contained in:
@@ -294,6 +294,14 @@ segments are sent in order. A packet that would need more than 5 segments
|
||||
is refused (the card's concatenation buffer is the limit). With `sp` a
|
||||
pre-built packet is delivered the same way.
|
||||
|
||||
The card may answer with PoR status `actual_response_sms_submit` (`0x0B`):
|
||||
the real response (a big GET STATUS listing, for example) then arrives as one
|
||||
or more proactive SEND SHORT MESSAGE commands. The server captures those
|
||||
SMS-SUBMIT TPDUs, reassembles the concatenated segments and returns the
|
||||
decoded response in `por` (as if it had arrived in the ENVELOPE), so callers
|
||||
see a normal `por.response_status == "por_ok"` with the remote status word
|
||||
and response data.
|
||||
|
||||
**Request body:**
|
||||
```json
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user