Hello,

My CCID driver has a bug with the ATR "3B 80 81 1F 07 19". This ATR
defines a TA3 but that is not the IFSC but XI and UI information. My
online parser [1] is correct.

I had a look at OpenCT and the same bug is also present.
openct-0.6.20/src/ifd/ifd-ccid.c:
                                /* TA3 -> IFSC */
                                if (atr_info.TA[2] != -1)
                                        parambuf[5] = atr_info.TA[2];

OpenCT is even less flexible since only TA3 is used as IFSC, not the
first TAi with i>2

The bug should not prevent the communication to happen. But the T=1
blocks will be limited to 7 bytes instead of the default 32 bytes. The
communication speed with the card will be lower.


I implemented a function to get the IFSC value. Feel free to reuse it
(under LGPL v2+)

static int get_IFSC(ATR_t *atr, int *idx)
{
    int i, ifsc, protocol = -1;

    /* default return values */
    ifsc = -1;
    *idx = -1;

    for (i=0; i<ATR_MAX_PROTOCOLS; i++)
    {
        /* protocol T=? */
        if (atr->ib[i][ATR_INTERFACE_BYTE_TD].present)
            protocol = atr->ib[i][ATR_INTERFACE_BYTE_TD].value & 0x0F;

        /* TAi (i>2) present and protocol=1 => IFSC */
        if (i >= 2 && protocol == 1
            && atr->ib[i][ATR_INTERFACE_BYTE_TA].present)
        {
            ifsc = atr->ib[i][ATR_INTERFACE_BYTE_TA].value;
            *idx = i+1;
            /* only the first TAi (i>2) must be used */
            break;
        }
    }

    return ifsc;
} /* get_IFSC */


It is used as in:

        ifsc = get_IFSC(&atr, &i);
        if (ifsc > 0)
        {
            DEBUG_COMM3("IFSC (TA%d) present: %d", i, ifsc);
            param[5] = ifsc;
        }


[1] http://smartcard-atr.appspot.com/parse?ATR=3B80811F0719

-- 
 Dr. Ludovic Rousseau
_______________________________________________
opensc-devel mailing list
[email protected]
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to