smart card driver in linux environment

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

smart card driver in linux environment

Srinivas G.

Dear All,

 

I have asked you about developing smart card driver in Linux environment long back.

I got some information after studying the PC/SC specifications and OpenSC User Manuals. The general smart card architecture as follows

 

 

 

 

From the above architecture I understood that I need to develop the IFD (smart card reader) driver to my PCI card. For this IFD driver I follow the character driver features and I decided to develop a character driver for handling the following features

 

1)                   Power management features

2)                   Parsing the ATR

3)                   Transmitting and receiving functionality between ICC and IFD for T=0 and T=1

4)                   IOCTLs based on the requirement

 

I also understood that I need to develop the IFD Handler that is specific to our IFD.

I have studied the ifhandler.pdf file which explains about the APIs that are generally accessed by the Resource Manager of the PC/SC Lite.

 

 

 

Still I have some doubts in my mind.  Could any one please clarify them?

 

1)         Where can I find the installation procedure for the OpenSC Library under Linux environment?

If I install the OpenSC library, even then I need to install the PC/SC lite on my Linux box?

 

I have gone through the following link, but it gives more information on Windows boxes only.

http://www.opensc.org/files/doc/opensc.html

 

 

2)         How the Resource Manager knows about our IFD Handler and our I/O device driver?

Where/How can we inform the Resource Manager about our IFD Handler and I/O Device Driver?

 

 

3)         I studied in the PART-3 of the PC/SC specification about the following.

            The slot logical device shall support the following ICC-related events:

                        • Card insertion notification

                        • Card removal notification

 

My question is: How the PC/SC Resource Manager will know about the Card Insertion or Card Removal Events?

            I also studied about it like

When one of these events occurs, it is the responsibility of the IFD Handler to notify the ICC Resource Manager layer.

How it will notify the RM of the PC/SC Lite? Should I need to do any thing in the driver on behalf of this?

 

4)         If the system has two different smart card readers (IFDs) then how it will distinguishes the IFD Handlers?

            Like in which slot the user has inserted the smart card?

 

 

5)         My final question is: I need to develop only IFD Handler and I/O device driver for my IFD (smart card reader). Is it correct?

            OR

            I need to develop any other modules other than this.

 

Thanks in advance.

 

Thanks and Regards,

Srinivas G

 

 


_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: smart card driver in linux environment

Andreas Jellinghaus-2
Hi,

> >From the above architecture

hu? that was a blank area in the mail I got.

> >I understood that I need to develop the IFD
> (smart card reader) driver to my PCI card.

PCI card would be a very uncommon choice for a smart card reader.
Usualy people use serial or usb devices, because they are much, much
cheaper to produce than pci cards.

But I don't know much about hardware design :)

> 1) Where can I find the installation procedure for the OpenSC
> Library under Linux environment?

opensc is usualy installed by the linux distribution as package.
for installing from source see the file "QuickStart" in the source.

> If I install the OpenSC library, even then I need to install the PC/SC
> lite on my Linux box?

yes, opensc needs a layer below it:
 - pcsc-lite and a driver in ifdhandler format
 - openct (which contains drivers for many readers, you might need to
   write a new one for your hardware)
 - a driver in ct-api format

one of those will do. ct-api format is not recommended, it is a very
old format from the dos era and doesn't fit into todays multi-user/multi-
application system world.

> I have gone through the following link, but it gives more information on
> Windows boxes only.
>
> http://www.opensc.org/files/doc/opensc.html

that documentation is mostly outdated. see
        http://www.opensc.org/opensc/
for the documentation for the upcoming 0.10.* release.

> 2) How the Resource Manager knows about our IFD Handler and our
> I/O device driver?

pcscd reads its config file, where you put an entry for each reader
you want to load. for usb drivers there is some auto loading magic,
as far as I knoe.

> Where/How can we inform the Resource Manager about our IFD Handler and
> I/O Device Driver?

edit the config file, add an entry.

> My question is: How the PC/SC Resource Manager will know about the Card
> Insertion or Card Removal Events?

not sure, I guess it calls the reader and some function can return that
status, or will return an error if the card has been removed / replaced.

> When one of these events occurs, it is the responsibility of the IFD
> Handler to notify the ICC Resource Manager layer.
>
> How it will notify the RM of the PC/SC Lite? Should I need to do any
> thing in the driver on behalf of this?

as far as I know pcsc is a passive API, so the resource manager calls
functions in the ifdhandler, and you need to return an appropriate answer
or error value.

> 4)         If the system has two different smart card readers (IFDs)
> then how it will distinguishes the IFD Handlers?

the pcsc daemon loads both modules and knows which functions are from
which module, it can handle that.

>             Like in which slot the user has inserted the smart card?

I guess: the pcsc daemon asks the ifdhandler how many slots it has,
and then checks the status of each slot.

> 5)         My final question is: I need to develop only IFD Handler and
> I/O device driver for my IFD (smart card reader). Is it correct?

if you are creating a smart card reader, you only need to write a driver
for your smart card reader. drivers for serial devices or usb devices
are often implemented completely in an ifdhandler and can use the generic
parts of the linux kernel. if you create a pcmcia card, pci card or
something else non-serial/non-ps2/non-usb, you will most likely need
a kernel driver and an ifdhandler.

if you create a new smart card, that is a completely differnt topic
and you would need to write a driver for opensc so it understands your
smart card.

Regards, Andreas
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel