Mac OS X Leopard has many bugs regardings PC/SC. One of them is that the
returned AT is often padded with 0x00 up to MAX_ATR_SIZE (33) bytes.
The problem is that GnuPG uses a wrong test to check for the ATR size:
if (atrlen >= DIM (reader_table[0].atr))
If the ATR size if exactly the maximum size then the ATR is considered too large.
The solution is to use ">" instead of ">=".
A patch is included.
My patch also replaces:
atrlen = 33;
by
atrlen = sizeof(reader_table[slot].atr);
to make the code more rebust.
The bug was reported on the macgpg bug tracker indicated in the ExtLink field.