Skip to content

Add support for multiple smart cards#2

Merged
Jakuje merged 8 commits intomasterfrom
multi
Apr 7, 2025
Merged

Add support for multiple smart cards#2
Jakuje merged 8 commits intomasterfrom
multi

Conversation

@Jakuje
Copy link
Owner

@Jakuje Jakuje commented Mar 31, 2025

This adds support for more smart cards by utilizing more ports exposed by vpcd.

Fixes: #1 (on its 4th year anniversary)

@Jakuje
Copy link
Owner Author

Jakuje commented Mar 31, 2025

It looks like it does something, but not the right thing. Looks like content of both slot is now the same content so I guess I will have to investigate a bit further if we do something wrong here or if there is some mix up in the vpcd ...

@frankmorgner
Copy link

I verified that having two instances of vicc is working as expected (vicc -P 35963 -vvv, vicc -P 35964 -vvv): opensc-tool -n -r0 connects to the first instance, where opensc-tool -n -r1 connects to the second one.

The code changes are looking straight forward. Did you also try to test with opensc-tool? Maybe there is some identification problem in OpenSC's PKCS#11 layer.

@Jakuje
Copy link
Owner Author

Jakuje commented Apr 1, 2025

I verified that having two instances of vicc is working as expected (vicc -P 35963 -vvv, vicc -P 35964 -vvv): opensc-tool -n -r0 connects to the first instance, where opensc-tool -n -r1 connects to the second one.

The code changes are looking straight forward. Did you also try to test with opensc-tool? Maybe there is some identification problem in OpenSC's PKCS#11 layer.

Yes, the test I added is doing the pkcs11-tool calls, see the bottom of the pipeline output:

https://github.com/Jakuje/virt_cacard/actions/runs/14176177074/job/39711520736?pr=2

I will double-check what the vicc does to see if there is something I missed in the communication.

@frankmorgner
Copy link

Maybe you should also use strtoul() instead of atoi(), because it gives you error handling and it returns the unsigned integer that you need for calculating the port.

@Jakuje
Copy link
Owner Author

Jakuje commented Apr 1, 2025

Maybe you should also use strtoul() instead of atoi(), because it gives you error handling and it returns the unsigned integer that you need for calculating the port.

Yeah, that would be good place to add some bounds. But it wont be the issue.

Running the tests locally, it sounds like it will be likely the test issue as I can see some stale data from yesterday in virt_cacard. Will have to figure out what is going on there.

@Jakuje
Copy link
Owner Author

Jakuje commented Apr 1, 2025

Gotcha! Its the OpenSC file caching as both cards have the same ATR and serial number. I will have to look if I can figure out a way to make it randomized/deterministic or just disable file caching.

@Jakuje Jakuje force-pushed the multi branch 2 times, most recently from a4ecabe to 7027272 Compare April 1, 2025 14:46
@Jakuje Jakuje merged commit 2fc77e9 into master Apr 7, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for multiply virtual cards

2 participants