check DF name on SELECT command
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
2012-01-05 Niibe Yutaka <gniibe@fsij.org>
|
||||
|
||||
* src/openpgp.c (cmd_select_file): Check DF name.
|
||||
|
||||
* tool/pinpadtest.py: Rename from pinpad-test.py.
|
||||
|
||||
2011-12-28 Niibe Yutaka <gniibe@fsij.org>
|
||||
|
||||
@@ -417,10 +417,12 @@ do_kgtime_all (uint16_t tag, int with_tag)
|
||||
}
|
||||
|
||||
const uint8_t openpgpcard_aid[] = {
|
||||
0xd2, 0x76, 0x00, 0x01, 0x24, 0x01,
|
||||
0xd2, 0x76, /* D: National, 276: DEU ISO 3166-1 */
|
||||
0x00, 0x01, 0x24, /* Registered Application Provider Identifier */
|
||||
0x01, /* Application: OpenPGPcard */
|
||||
0x02, 0x00, /* Version 2.0 */
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* To be overwritten */
|
||||
/* v. id */ /* serial number */
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, /* To be overwritten */
|
||||
};
|
||||
|
||||
static int
|
||||
|
||||
@@ -529,16 +529,19 @@ cmd_read_binary (void)
|
||||
static void
|
||||
cmd_select_file (void)
|
||||
{
|
||||
if (cmd_APDU[2] == 4) /* Selection by DF name: it must be OpenPGP card */
|
||||
if (cmd_APDU[2] == 4) /* Selection by DF name */
|
||||
{
|
||||
DEBUG_INFO (" - select DF by name\r\n");
|
||||
|
||||
/*
|
||||
* P2 == 0, LC=6, name = D2 76 00 01 24 01
|
||||
*/
|
||||
/* name = D2 76 00 01 24 01 */
|
||||
if (cmd_APDU[4] != 6 || memcmp (openpgpcard_aid, &cmd_APDU[5], 6) != 0)
|
||||
{
|
||||
GPG_NO_FILE()
|
||||
return;
|
||||
}
|
||||
|
||||
file_selection = FILE_DF_OPENPGP;
|
||||
if (cmd_APDU[3] == 0x0c) /* No FCI */
|
||||
if ((cmd_APDU[3] & 0x0c) == 0x0c) /* No FCI */
|
||||
GPG_SUCCESS ();
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user