Repository navigation
Answer partial (RID) application selection - #49
FlorianFranzen wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Not related to this PR, but I wonder why we have the Command::Select variant at all. SELECT should be handled by apdu-dispatch and never reach the normal command implementation in the app.
Anyway, in the PR description you mention the problem of AID prefix collisions and refer to trussed-dev/apdu-dispatch#17, but the issue describes a different problem. But I did not find a matching issue either. Can you clarify?
Besides the collision problem, I think the implementation of truncated AIDs is flawed in iso7816/apdu-dispatch (trussed-dev/iso7816#37). We should review that before merging this PR.
|
Sorry, added the reference to the wrong PR indeed. Please just ignore it. And it is a valid point that the Also good point to fix this in the upper layers first. Once the apdu dispatch fix lands, I will just keep the truncation changes and tests and drop the rest. |
Interesting. How did you run the tests? Are you sure you hit |
|
Select does get sent to the application through |
|
|
Nevermind, that’s the path I had in mind but it never triggers the AID handling in piv-authenticator. I still don’t see how it could be called over apdu-dispatch. |
b45e0e6 to
81c9886
Compare
|
It is constructed via the vpicc path: That is the path of To be sure I just replayed it: with It also means the existing If you want Happy to do that as a follow-up once 0.2.2 is in. |
|
I see, thanks for the explanation. Probably it would make sense to mirror the adpu-dispatch behavior in |
81c9886 to
c7b2575
Compare
- c7b2575 Answer partial (RID) application selection
Yubico ecosystem clients (ykman, yubico-piv-tool, piv-go, yubikey.rs) select PIV with only the 5 byte RID
A0 00 00 03 08. The truncatable AID stopped at 9 bytes, so both the app's own SELECT parsing and the apdu-dispatch routing (which runsAid::matchesbefore the app parses anything) answered the RID select with 6A82. This showed up as soon as the app ran behind a real CCID interface.With the stricter
Aid::matchesof iso7816 0.2.2 (a candidate must be a prefix of the full AID and at least the truncated length), truncating at the RID is all that is needed: a different PIX under the same RID is rejected by the matcher itself. This PR bumps iso7816 to 0.2.2, changes the truncation length and adds the tests (bare RID select, full AID select, other PIX refused).It also fixes the existing SELECT test, which sent
00 A4 04 00 0C <AID> 00: Lc 0C with the Le byte folded into the data (SP 800-73-4 has Lc 0B and Le 00). The old matcher accepted the 12-byte candidate because it only compared a prefix; the new one correctly refuses it.