To calculate BWI and CWI we must unambiguously detect the parameter for the
requested protocol. This is intended for 'in system' interfaces to SmartCards
where the controlling firmware is part of the main system running in userland.

Signed-off-by: Juergen Beisert <j...@pengutronix.de>

---
 src/ifd/atr.c |    3 ++-
 src/ifd/atr.h |    1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

Index: openct-0.6.20/src/ifd/atr.c
===================================================================
--- openct-0.6.20.orig/src/ifd/atr.c
+++ openct-0.6.20/src/ifd/atr.c
@@ -18,6 +18,7 @@ int ifd_atr_parse(ifd_atr_info_t * info,
        memset(info, 0, sizeof(*info));
        info->default_protocol = -1;
        for (n = 0; n < 3; n++) {
+               info->prot[n] = -1;
                info->TA[n] = -1;
                info->TB[n] = -1;
                info->TC[n] = -1;
@@ -40,7 +41,7 @@ int ifd_atr_parse(ifd_atr_info_t * info,
                if (n != 2) {
                        int prot;
 
-                       prot = TDi & 0x0f;
+                       prot = info->prot[m] = TDi & 0x0f;
                        if (info->default_protocol < 0)
                                info->default_protocol = prot;
                        info->supported_protocols |= (1 << prot);
Index: openct-0.6.20/src/ifd/atr.h
===================================================================
--- openct-0.6.20.orig/src/ifd/atr.h
+++ openct-0.6.20/src/ifd/atr.h
@@ -13,6 +13,7 @@ extern "C" {
 
        typedef struct ifd_atr_info {
                /* The following contain -1 if the field wasn't present */
+               int prot[4];
                int TA[4];
                int TB[4];
                int TC[4];

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

Reply via email to