Attention is currently required from: laforge, lynxis lazus.

dexter has posted comments on this change by lynxis lazus. ( 
https://gerrit.osmocom.org/c/simtrace2/+/43185?usp=email )

Change subject: Add osmo_apdu_segment_in2() to ensure correct parsing of GP GET 
DATA
......................................................................


Patch Set 8: Code-Review+1

(2 comments)

File host/lib/apdu_dispatch.c:

https://gerrit.osmocom.org/c/simtrace2/+/43185/comment/9ca466bb_66366477?usp=email
 :
PS3, Line 120:              ac->hdr.cla & 0x80 && /* check for GP */
> I don't know what I should do here. […]
>From what I can see the behavior is not GP specific. The ETSI TS 102 221 Table 
>7.1 suggests the same behavior. It may be the case that ETSI has followed GP 
>here so that there is no incompatibility. In Annex C you find example 
>transactions that illustrate how the procedure byte mechanism works.

You can also look at pysim/pySim/transport/__init__.py. There we have the 
behavior implemented in __send_apdu_T0. The check is a little different. The 
special handling applies for Case1, Case2 and Case3 here (maybe we should be 
more precise here).

I think the whole idea behind this is that if someone sends a C-APDU that 
generates data on the card and gets the length wrong. Then the card sends 6CXX, 
where XX is the correct length. The terminal then sends a corrected C-APDU and 
everything can continue normally without involving the higher layers.


File host/tests/apdu_dispatch/apdu_dispatch_test.c:

https://gerrit.osmocom.org/c/simtrace2/+/43185/comment/09351065_31d2847d?usp=email
 :
PS3, Line 70:   OSMO_ASSERT(rc == APDU_ACT_TX_CAPDU_TO_CARD);
> I've added a check on apdu_case.
Done



--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/43185?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: Ie238662e7e6a10dd4283ede0c8d8d73bc375c247
Gerrit-Change-Number: 43185
Gerrit-PatchSet: 8
Gerrit-Owner: lynxis lazus <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Attention: laforge <[email protected]>
Gerrit-Attention: lynxis lazus <[email protected]>
Gerrit-Comment-Date: Thu, 13 Aug 2026 11:54:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: lynxis lazus <[email protected]>
Comment-In-Reply-To: dexter <[email protected]>

Reply via email to