Hello,

On Sep 23, 2010, at 3:37 PM, francois.lebl...@cev-sa.com wrote:
>  #ifdef ENABLE_PCSC 
>          ctx->reader_driver = sc_get_pcsc_driver(); 
> +        #ifdef ENABLE_CARDMOD 
> +        if(strcmp(ctx->app_name, "cardmod") == 0) { 
> +                ctx->reader_driver = sc_get_cardmod_driver(); 
> +        } 
> +        #endif 
>  #elif ENABLE_CTAPI 
>          ctx->reader_driver = sc_get_ctapi_driver(); 
>  #elif ENABLE_OPENCT 
> 
> it's quite ugly but let us use cardmod driver and continue to improve it... 
Please describe how the driver is used by the minidriver, how it differs from 
"normal" OpenSC use, what are the biggest and most important  differences 
between the "normal" pcsc code and the cardmod code.

Minidriver code calls sc_create_context like other applications, with the 
difference that a card handle is already present in the minidriver code and 
does not need to be fetched via libopensc calls and connected to with a 
sc_connect

So you decided you pass the handles around to the libopensc instance in windows 
registry (not environment variables as was in another incarnation of OpenSC + 
BaseCSP).
This means a single instance of an OpenSC based card and reader by default. Why 
not use the context creation parameters to pass in the necessary handles? There 
is no IPC present and necessary modifications to the context creation 
functionality to accommodate BaseCSP requirements is perfectly reasonable 
argument to change those structures and add code. Especially now, when it is 
not exposed to outside world. 

Having a single reader driver greatly simplifies the architecture of OpenSC. It 
also simplifies the proper modifications needed for the "cardmod" driver.  You 
are free to patch the libopensc instance at runtime any way you want to get 
what you need. This means overloading the not needed functions from pcsc driver 
with NULL. And adding necessary logic to the rest of PC/SC functions to return 
early as needed.

As is the case with the rest of reader driver, the decision what to build 
happens not at runtime, but at compile time. There are several restrictions to 
what can be put inside a minidriver, so I would build it as a single static dll 
instead.


-- 
@MartinPaljak.net
+3725156495

_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to