"Douglas E. Engert" <deeng...@anl.gov> a écrit sur 01/02/2011 22:25:04 :
> [image supprimée] > > Re: Some basic questions about the reader-pcscs.c modifications for cardmod > > Douglas E. Engert > > A : > > OpenSC-devel, François Leblanc > > 01/02/2011 22:27 > > I have been doing some more testing. > > The current cardmod code is assuming the PCSC card handles are > set at the CardAcquireContext and not changed. The cardmod then I'm not agree, new memory allocation for the structure is made at each call of CryptAcquireContext, so each call define a new memory zone initialized with card handle/context provided by baseCSP... You have as structure with diffrents parameters as call to CryptAcquireContext... > initializes OpenSC, and and connects to the card, and calls > sc_pkcs15_bind, and reads objects off the card. > > But if the card is removed and a new card inserted, the BaseCSP may > establish a second context, then uses the first context again but > pass in new handles! Cardmod does not update its cached information. > This is the situation where the user inserted the wrong card, and > then inserted a different card. > > Other CSPs that use OpenSC pkcs11 , don't try and pass in the > provided handles but let reader-pcsc find the readers and cards using > reader-pcsc.c using new PCSC handles. If there is only one reader this > can work. But if there are more then one reader, some additional code > is need in the CSP to get the reader name from the BaseCSP handles, > and pass in the reader name to OpenSC so the same reader is used. > > So what is the better way to do this? Use the PCSC handles passed > from the BaseCSP, or get the reader name, and get pkcs11 to use > this reader? You can't, I've tested this BAseCSP module locks the card for itself so if you try to access the card other than provided context/handle you will be bloked. moreover (and I think it's for securities) you can't change handle and context in the BaseCSP (I've crash doing this if I remember...) Unfortunatly the reader name only can't let you retreive the handle of card... (but for security it's a good find!) > > I hope to test this week changes to have cardmod detect the change > in handles, and do the right thing. > > > On 1/28/2011 4:24 PM, Douglas E. Engert wrote: > > > > Other CSPs have been able to use the OpenSC opensc-pkcs11.dll > > which uses the standard reader-pcsc.c code. This would imply that > > they let reader-pcsc.c get its own handles to the card, and don't > > use the one provided by the caller of the CSP. > > > > So why does cardmod require so many modifications to reader-pcsc.c? > > And to answer some of my own questions... > I guess so that the handles are not lost. But this ads a lot of extra > code to reader-pcsc.c > > > > > The modifications also turn off: detect_card_presents, lock unlock, > > release, wait_for_event and reset. I would expect some of these to > > be critical to any CSP or mini-driver? > > Some of these functions like card removal must be being done by the > BaseCSP. Locking and reset may not be. > > > > > Why does the cardmod reader-pcsc.c need to load the constant > > winscard.dll, when the normal pcsc code loads the DEFAULT_PCSC_PROVIDER > > that is defined in the Configure/Makefiles as winscard.dll? > > > > I think more of the reader-pcsc.c code be shared. > > -- > > Douglas E. Engert <deeng...@anl.gov> > Argonne National Laboratory > 9700 South Cass Avenue > Argonne, Illinois 60439 > (630) 252-5444 Regards, François. _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel