mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-18 14:17:03 +01:00
scd: Improve reading of binary records.
* scd/iso7816.c (iso7816_read_binary_ext): Handle the 0x6a86 SW the same as 6b00. * scd/apdu.c (apdu_get_atr): Modify debug messages. * scd/app-p15.c (app_select_p15): Print FCI on error. (read_p15_info): Clean up diag in presence of debug options. -- Some cards return 6a86 instead of 6b00. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
7718244168
commit
44f977d0e3
11
scd/apdu.c
11
scd/apdu.c
@ -2614,19 +2614,16 @@ apdu_get_atr (int slot, size_t *atrlen)
|
||||
{
|
||||
unsigned char *buf;
|
||||
|
||||
if (DBG_READER)
|
||||
log_debug ("enter: apdu_get_atr: slot=%d\n", slot);
|
||||
|
||||
if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used )
|
||||
{
|
||||
if (DBG_READER)
|
||||
log_debug ("leave: apdu_get_atr => NULL (bad slot)\n");
|
||||
log_debug ("apdu_get_atr => NULL (bad slot)\n");
|
||||
return NULL;
|
||||
}
|
||||
if (!reader_table[slot].atrlen)
|
||||
{
|
||||
if (DBG_READER)
|
||||
log_debug ("leave: apdu_get_atr => NULL (no ATR)\n");
|
||||
log_debug ("apdu_get_atr => NULL (no ATR)\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -2634,13 +2631,11 @@ apdu_get_atr (int slot, size_t *atrlen)
|
||||
if (!buf)
|
||||
{
|
||||
if (DBG_READER)
|
||||
log_debug ("leave: apdu_get_atr => NULL (out of core)\n");
|
||||
log_debug ("apdu_get_atr => NULL (out of core)\n");
|
||||
return NULL;
|
||||
}
|
||||
memcpy (buf, reader_table[slot].atr, reader_table[slot].atrlen);
|
||||
*atrlen = reader_table[slot].atrlen;
|
||||
if (DBG_READER)
|
||||
log_debug ("leave: apdu_get_atr => atrlen=%zu\n", *atrlen);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
@ -3791,8 +3791,8 @@ read_p15_info (app_t app)
|
||||
log_printf ("\n");
|
||||
}
|
||||
|
||||
log_info ("p15: atr ..........: ");
|
||||
atr = apdu_get_atr (app_get_slot (app), &atrlen);
|
||||
log_info ("p15: atr ..........: ");
|
||||
if (!atr)
|
||||
log_printf ("[error]\n");
|
||||
else
|
||||
@ -6040,7 +6040,11 @@ app_select_p15 (app_t app)
|
||||
if (s && n == 2)
|
||||
def_home_df = buf16_to_ushort (s);
|
||||
else
|
||||
log_error ("p15: select(AID) did not return the DF\n");
|
||||
{
|
||||
if (fcilen)
|
||||
log_printhex (fci, fcilen, "fci:");
|
||||
log_error ("p15: select(AID) did not return the DF\n");
|
||||
}
|
||||
}
|
||||
app->app_local->home_df = def_home_df;
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ iso7816_read_binary_ext (int slot, int extended_mode,
|
||||
if (r_sw)
|
||||
*r_sw = sw;
|
||||
|
||||
if (*result && sw == SW_BAD_P0_P1)
|
||||
if (*result && (sw == SW_BAD_P0_P1 || sw == SW_INCORRECT_P0_P1))
|
||||
{
|
||||
/* Bad Parameter means that the offset is outside of the
|
||||
EF. When reading all data we take this as an indication
|
||||
|
Loading…
x
Reference in New Issue
Block a user