mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
scd:p15: Add basic support for AET JCOP cards.
* scd/app-p15.c (CARD_TYPE_AET): New. (cardtype2str): Add string. (card_atr_list): Add corresponding ATR. (app_local_s): New flag no_extended_mode. Turn two other flags into bit flags. (select_ef_by_path): Hack to handle the 3FFF thing. (readcert_by_cdf): Do not use extended mode for AET. (app_select_p15): Set no_extended_mode. --- Signed-off-by: Werner Koch <wk@gnupg.org> (cherry picked from commit 544ec7872aed24c296ea34fac777eca287f7bb47)
This commit is contained in:
parent
d9a8d3353a
commit
80cf64c651
@ -74,6 +74,7 @@ typedef enum
|
|||||||
CARD_TYPE_MICARDO,
|
CARD_TYPE_MICARDO,
|
||||||
CARD_TYPE_CARDOS_50,
|
CARD_TYPE_CARDOS_50,
|
||||||
CARD_TYPE_CARDOS_53,
|
CARD_TYPE_CARDOS_53,
|
||||||
|
CARD_TYPE_AET, /* A.E.T. Europe JCOP card. */
|
||||||
CARD_TYPE_BELPIC /* Belgian eID card specs. */
|
CARD_TYPE_BELPIC /* Belgian eID card specs. */
|
||||||
}
|
}
|
||||||
card_type_t;
|
card_type_t;
|
||||||
@ -120,6 +121,9 @@ static struct
|
|||||||
CARD_TYPE_CARDOS_50 }, /* CardOS 5.0 */
|
CARD_TYPE_CARDOS_50 }, /* CardOS 5.0 */
|
||||||
{ 11, X("\x3b\xd2\x18\x00\x81\x31\xfe\x58\xc9\x03\x16"),
|
{ 11, X("\x3b\xd2\x18\x00\x81\x31\xfe\x58\xc9\x03\x16"),
|
||||||
CARD_TYPE_CARDOS_53 }, /* CardOS 5.3 */
|
CARD_TYPE_CARDOS_53 }, /* CardOS 5.3 */
|
||||||
|
{ 24, X("\x3b\xfe\x18\x00\x00\x80\x31\xfe\x45\x53\x43\x45"
|
||||||
|
"\x36\x30\x2d\x43\x44\x30\x38\x31\x2d\x6e\x46\xa9"),
|
||||||
|
CARD_TYPE_AET },
|
||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
#undef X
|
#undef X
|
||||||
@ -436,11 +440,14 @@ struct app_local_s
|
|||||||
/* The vendor's product. */
|
/* The vendor's product. */
|
||||||
card_product_t card_product;
|
card_product_t card_product;
|
||||||
|
|
||||||
|
/* Flag indicating that extedned_mode is not supported. */
|
||||||
|
unsigned int no_extended_mode : 1;
|
||||||
|
|
||||||
/* Flag indicating whether we may use direct path selection. */
|
/* Flag indicating whether we may use direct path selection. */
|
||||||
int direct_path_selection;
|
unsigned int direct_path_selection : 1;
|
||||||
|
|
||||||
/* Flag indicating whether the card has any key with a gpgusage set. */
|
/* Flag indicating whether the card has any key with a gpgusage set. */
|
||||||
int any_gpgusage;
|
unsigned int any_gpgusage : 1;
|
||||||
|
|
||||||
/* Structure with the EFIDs of the objects described in the ODF
|
/* Structure with the EFIDs of the objects described in the ODF
|
||||||
file. */
|
file. */
|
||||||
@ -512,6 +519,7 @@ cardtype2str (card_type_t cardtype)
|
|||||||
case CARD_TYPE_CARDOS_50: return "CardOS 5.0";
|
case CARD_TYPE_CARDOS_50: return "CardOS 5.0";
|
||||||
case CARD_TYPE_CARDOS_53: return "CardOS 5.3";
|
case CARD_TYPE_CARDOS_53: return "CardOS 5.3";
|
||||||
case CARD_TYPE_BELPIC: return "Belgian eID";
|
case CARD_TYPE_BELPIC: return "Belgian eID";
|
||||||
|
case CARD_TYPE_AET: return "AET";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -763,6 +771,27 @@ select_ef_by_path (app_t app, const unsigned short *path, size_t pathlen)
|
|||||||
goto err_print_path;
|
goto err_print_path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (pathlen > 1 && path[0] == 0x3fff)
|
||||||
|
{
|
||||||
|
err = iso7816_select_file (app_get_slot (app), 0x3f00, 0);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
log_error ("p15: error selecting part %d from path ", 0);
|
||||||
|
goto err_print_path;
|
||||||
|
}
|
||||||
|
path++;
|
||||||
|
pathlen--;
|
||||||
|
for (i=0; i < pathlen; i++)
|
||||||
|
{
|
||||||
|
err = iso7816_select_file (app_get_slot (app),
|
||||||
|
path[i], (i+1 == pathlen)? 2 : 1);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
log_error ("p15: error selecting part %d from path ", i);
|
||||||
|
goto err_print_path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pathlen && *path != 0x3f00 )
|
if (pathlen && *path != 0x3f00 )
|
||||||
@ -4209,8 +4238,12 @@ readcert_by_cdf (app_t app, cdf_object_t cdf,
|
|||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
|
|
||||||
err = iso7816_read_binary_ext (app_get_slot (app), 1, cdf->off, cdf->len,
|
if (app->app_local->no_extended_mode)
|
||||||
&buffer, &buflen, NULL);
|
err = iso7816_read_binary_ext (app_get_slot (app), 0, cdf->off, 0,
|
||||||
|
&buffer, &buflen, NULL);
|
||||||
|
else
|
||||||
|
err = iso7816_read_binary_ext (app_get_slot (app), 1, cdf->off, cdf->len,
|
||||||
|
&buffer, &buflen, NULL);
|
||||||
if (!err && (!buflen || *buffer == 0xff))
|
if (!err && (!buflen || *buffer == 0xff))
|
||||||
err = gpg_error (GPG_ERR_NOT_FOUND);
|
err = gpg_error (GPG_ERR_NOT_FOUND);
|
||||||
if (err)
|
if (err)
|
||||||
@ -6040,7 +6073,12 @@ app_select_p15 (app_t app)
|
|||||||
if (s && n == 2)
|
if (s && n == 2)
|
||||||
def_home_df = buf16_to_ushort (s);
|
def_home_df = buf16_to_ushort (s);
|
||||||
else
|
else
|
||||||
log_error ("p15: select(AID) did not return the DF\n");
|
{
|
||||||
|
if (fcilen)
|
||||||
|
log_printhex (fci, fcilen, "fci:");
|
||||||
|
log_info ("p15: select did not return the DF - using default\n");
|
||||||
|
def_home_df = DEFAULT_HOME_DF;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
app->app_local->home_df = def_home_df;
|
app->app_local->home_df = def_home_df;
|
||||||
|
|
||||||
@ -6057,6 +6095,9 @@ app_select_p15 (app_t app)
|
|||||||
case CARD_TYPE_CARDOS_53:
|
case CARD_TYPE_CARDOS_53:
|
||||||
direct = 1;
|
direct = 1;
|
||||||
break;
|
break;
|
||||||
|
case CARD_TYPE_AET:
|
||||||
|
app->app_local->no_extended_mode = 1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
/* Use whatever has been determined above. */
|
/* Use whatever has been determined above. */
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user