-
Notifications
You must be signed in to change notification settings - Fork 803
Windows changed readers (alternative) #2525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
frankmorgner
merged 3 commits into
OpenSC:master
from
frankmorgner:windows-changed-readers
Apr 19, 2022
Merged
Windows changed readers (alternative) #2525
frankmorgner
merged 3 commits into
OpenSC:master
from
frankmorgner:windows-changed-readers
Apr 19, 2022
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Issue OpenSC#2517 reports that minidriver may be presented with new handles to PCSC, even if card is moved from one reader to another. The previous code assumed a change in handles would always point at same reader. and if reader was changed, caller would do two operations: card is removed from one reader i.e. call CardDeleteContext and some time later when card is inserted, call CardAcquireContext. Thus previous code would not to call reinit_card_for. But this is not the case. So when handles change, the new handles are used to probe the new reader to obtain reader name to compare to old reader name. If they are the same returns to not call reinit_card. If they are different returns to call reinit_card. The assumption is if card is removed, it could be modified on another system then inserted on original system which changed data. pcsc_new_reader will set ctx->flags & SC_CTX_FLAG_TERMINATE so no operations are mistakenly done to old reader and to signal second call to pcsc_new_reader when called to setup the new reader, to free the old reader and reset SC_CTX_FLAG_TERMINATE. Date: Thu Mar 10 10:04:00 2022 -0600 Changes to be committed: modified: src/libopensc/reader-pcsc.c modified: src/minidriver/minidriver.c
On branch windows-changed-readers Changes to be committed: modified: libopensc/opensc.h modified: libopensc/reader-pcsc.c modified: minidriver/minidriver.c
Contributor
|
I have tested this solution: it works correctly in the special case when the card is moved between 2 readers and a running Windows application uses the card's key containers. The minidrives recognizes the need for a reinit_card_for(): |
Member
Author
|
Thank you for testing |
xhanulik
pushed a commit
to xhanulik/OpenSC
that referenced
this pull request
May 11, 2022
Issue OpenSC#2517 reports that minidriver may be presented with new handles to PCSC, even if card is moved from one reader to another. The previous code assumed a change in handles would always point at same reader. and if reader was changed, caller would do two operations: card is removed from one reader i.e. call CardDeleteContext and some time later when card is inserted, call CardAcquireContext. Thus previous code would not to call reinit_card_for. But this is not the case. So when handles change, the new handles are used to probe the new reader to obtain reader name to compare to old reader name. If they are the same returns to not call reinit_card. If they are different returns to call reinit_card. The assumption is if card is removed, it could be modified on another system then inserted on original system which changed data.
AlexandreGonzalo
pushed a commit
to AlexandreGonzalo/OpenSC
that referenced
this pull request
Nov 14, 2022
Issue OpenSC#2517 reports that minidriver may be presented with new handles to PCSC, even if card is moved from one reader to another. The previous code assumed a change in handles would always point at same reader. and if reader was changed, caller would do two operations: card is removed from one reader i.e. call CardDeleteContext and some time later when card is inserted, call CardAcquireContext. Thus previous code would not to call reinit_card_for. But this is not the case. So when handles change, the new handles are used to probe the new reader to obtain reader name to compare to old reader name. If they are the same returns to not call reinit_card. If they are different returns to call reinit_card. The assumption is if card is removed, it could be modified on another system then inserted on original system which changed data.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist