- First stab towards standardized card types
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2172 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
956430edaf
commit
32b417cbf3
|
@ -119,8 +119,6 @@ static long t1, t2, tot_read = 0, tot_dur = 0, dur;
|
|||
|
||||
#define BELPIC_VERSION "1.4"
|
||||
|
||||
#define TYPE_BELPIC_EID 1
|
||||
|
||||
/* Most of the #defines here are also present in the pkcs15 files, but
|
||||
* because this driver has no access to them, it's hardcoded here. If
|
||||
* other Belpic cards with other 'settings' appear, we'll have to move
|
||||
|
@ -138,16 +136,16 @@ static size_t next_idx = -1;
|
|||
|
||||
static struct sc_atr_table belpic_atrs[] = {
|
||||
/* Applet V1.1 */
|
||||
{ "3B:98:13:40:0A:A5:03:01:01:01:AD:13:11", NULL, NULL, TYPE_BELPIC_EID },
|
||||
{ "3B:98:13:40:0A:A5:03:01:01:01:AD:13:11", NULL, NULL, SC_CARD_TYPE_BELPIC_EID },
|
||||
/* Applet V1.0 with new EMV-compatible ATR */
|
||||
{ "3B:98:94:40:0A:A5:03:01:01:01:AD:13:10", NULL, NULL, TYPE_BELPIC_EID },
|
||||
{ "3B:98:94:40:0A:A5:03:01:01:01:AD:13:10", NULL, NULL, SC_CARD_TYPE_BELPIC_EID },
|
||||
/* Applet beta 5 + V1.0 */
|
||||
{ "3B:98:94:40:FF:A5:03:01:01:01:AD:13:10", NULL, NULL, TYPE_BELPIC_EID },
|
||||
{ "3B:98:94:40:FF:A5:03:01:01:01:AD:13:10", NULL, NULL, SC_CARD_TYPE_BELPIC_EID },
|
||||
#if 0
|
||||
/* Applet beta 3 + 4 */
|
||||
{ "3B:98:11:40:FF:A5:03:01:01:01:AD:13:04", NULL, NULL, TYPE_BELPIC_EID },
|
||||
{ "3B:98:11:40:FF:A5:03:01:01:01:AD:13:04", NULL, NULL, SC_CARD_TYPE_BELPIC_EID },
|
||||
/* Applet beta 2 */
|
||||
{ "3B:68:00:00:29:05:01:02:01:AD:13:03", NULL, NULL, TYPE_BELPIC_EID },
|
||||
{ "3B:68:00:00:29:05:01:02:01:AD:13:03", NULL, NULL, SC_CARD_TYPE_BELPIC_EID },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
@ -994,14 +992,14 @@ static int belpic_init(struct sc_card *card)
|
|||
sc_debug(card->ctx, "\n");
|
||||
|
||||
if (card->type < 0)
|
||||
card->type = TYPE_BELPIC_EID; /* Unknown card: assume it's the Belpic Card */
|
||||
card->type = SC_CARD_TYPE_BELPIC_EID; /* Unknown card: assume it's the Belpic Card */
|
||||
|
||||
priv = (struct belpic_priv_data *) calloc(1, sizeof(struct belpic_priv_data));
|
||||
if (priv == NULL)
|
||||
return SC_ERROR_OUT_OF_MEMORY;
|
||||
card->drv_data = priv;
|
||||
card->cla = 0x00;
|
||||
if (card->type == TYPE_BELPIC_EID) {
|
||||
if (card->type == SC_CARD_TYPE_BELPIC_EID) {
|
||||
_sc_card_add_rsa_alg(card, 1024,
|
||||
SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASH_NONE, 0);
|
||||
}
|
||||
|
|
|
@ -42,15 +42,15 @@ static struct sc_card_driver etoken_drv = {
|
|||
|
||||
static struct sc_atr_table etoken_atrs[] = {
|
||||
/* 4.0 */
|
||||
{ "3b:e2:00:ff:c1:10:31:fe:55:c8:02:9c", NULL },
|
||||
{ "3b:e2:00:ff:c1:10:31:fe:55:c8:02:9c", NULL, NULL, SC_CARD_TYPE_ETOKEN_GENERIC },
|
||||
/* 4.01 */
|
||||
{ "3b:f2:98:00:ff:c1:10:31:fe:55:c8:03:15", NULL },
|
||||
{ "3b:f2:98:00:ff:c1:10:31:fe:55:c8:03:15", NULL, NULL, SC_CARD_TYPE_ETOKEN_GENERIC },
|
||||
/* 4.01a */
|
||||
{ "3b:f2:98:00:ff:c1:10:31:fe:55:c8:04:12", NULL },
|
||||
{ "3b:f2:98:00:ff:c1:10:31:fe:55:c8:04:12", NULL, NULL, SC_CARD_TYPE_ETOKEN_GENERIC },
|
||||
/* Italian eID card */
|
||||
{ "3b:e9:00:ff:c1:10:31:fe:55:00:64:05:00:c8:02:31:80:00:47", NULL },
|
||||
/* Italian eID card from Infocamere */
|
||||
{ "3b:fb:98:00:ff:c1:10:31:fe:55:00:64:05:20:47:03:31:80:00:90:00:f3", NULL },
|
||||
{ "3b:e9:00:ff:c1:10:31:fe:55:00:64:05:00:c8:02:31:80:00:47", NULL, NULL, SC_CARD_TYPE_ETOKEN_INFOCAMERE },
|
||||
{ "3b:fb:98:00:ff:c1:10:31:fe:55:00:64:05:20:47:03:31:80:00:90:00:f3", NULL, NULL, SC_CARD_TYPE_ETOKEN_INFOCAMERE },
|
||||
/* XXX: Are both of these two 'infocamere' compliant? */
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -63,7 +63,7 @@ static int etoken_match_card(struct sc_card *card)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = _sc_match_atr(card, etoken_atrs, NULL);
|
||||
i = _sc_match_atr(card, etoken_atrs, &card->type);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
|
@ -23,59 +23,53 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TYPE_CRYPTOFLEX 0x0100
|
||||
#define TYPE_MULTIFLEX 0x0200
|
||||
#define TYPE_CYBERFLEX 0x0300
|
||||
|
||||
#define FLAG_KEYGEN 0x0001
|
||||
#define FLAG_FULL_DES 0x0002 /* whatever that means */
|
||||
|
||||
#define TYPE_MASK 0xFF00
|
||||
|
||||
#define IS_CYBERFLEX(card) ((card->type & TYPE_MASK) == TYPE_CYBERFLEX)
|
||||
#define IS_CYBERFLEX(card) (card->type == SC_CARD_TYPE_FLEX_CYBER)
|
||||
|
||||
static struct sc_atr_table flex_atrs[] = {
|
||||
/* Cryptoflex */
|
||||
/* 8k */
|
||||
{ "3B:95:15:40:FF:68:01:02:02:04", NULL, "Cryptoflex 8K", TYPE_CRYPTOFLEX },
|
||||
{ "3B:95:15:40:FF:68:01:02:02:04", NULL, "Cryptoflex 8K", SC_CARD_TYPE_FLEX_CRYPTO, 0 },
|
||||
/* 8k */
|
||||
{ "3B:85:40:20:68:01:01:05:01", NULL, "Cryptoflex 8K", TYPE_CRYPTOFLEX },
|
||||
{ "3B:85:40:20:68:01:01:05:01", NULL, "Cryptoflex 8K", SC_CARD_TYPE_FLEX_CRYPTO, 0 },
|
||||
/* 16k */
|
||||
{ "3B:95:94:40:FF:63:01:01:02:01", NULL, "Cryptoflex 16K", TYPE_CRYPTOFLEX|FLAG_KEYGEN },
|
||||
{ "3B:95:94:40:FF:63:01:01:02:01", NULL, "Cryptoflex 16K", SC_CARD_TYPE_FLEX_CRYPTO, FLAG_KEYGEN },
|
||||
/* 32K v4 */
|
||||
{ "3B:95:18:40:FF:64:02:01:01:02", NULL, "Cryptoflex 32K v4", TYPE_CRYPTOFLEX|FLAG_KEYGEN },
|
||||
{ "3B:95:18:40:FF:64:02:01:01:02", NULL, "Cryptoflex 32K v4", SC_CARD_TYPE_FLEX_CRYPTO, FLAG_KEYGEN },
|
||||
/* 32K e-gate */
|
||||
{ "3B:95:18:40:FF:62:01:02:01:04", NULL, "Cryptoflex 32K e-gate", TYPE_CRYPTOFLEX|FLAG_KEYGEN },
|
||||
{ "3B:95:18:40:FF:62:01:02:01:04", NULL, "Cryptoflex 32K e-gate", SC_CARD_TYPE_FLEX_CRYPTO, FLAG_KEYGEN },
|
||||
/* 32K e-gate v4 */
|
||||
{ "3B:95:18:40:FF:62:04:01:01:05", NULL, "Cryptoflex 32K e-gate v4", TYPE_CRYPTOFLEX|FLAG_KEYGEN },
|
||||
{ "3B:95:18:40:FF:62:04:01:01:05", NULL, "Cryptoflex 32K e-gate v4", SC_CARD_TYPE_FLEX_CRYPTO, FLAG_KEYGEN },
|
||||
|
||||
{ "3B:E2:00:00:40:20:49:06", NULL, "Cryptoflex", TYPE_CRYPTOFLEX },
|
||||
{ "3B:E2:00:00:40:20:49:06", NULL, "Cryptoflex", SC_CARD_TYPE_FLEX_CRYPTO, 0 },
|
||||
/* + full DES option */
|
||||
{ "3B:E2:00:00:40:20:49:05", NULL, "Cryptoflex", TYPE_CRYPTOFLEX|FLAG_FULL_DES },
|
||||
{ "3B:E2:00:00:40:20:49:05", NULL, "Cryptoflex", SC_CARD_TYPE_FLEX_CRYPTO, FLAG_FULL_DES },
|
||||
/* + Key Generation */
|
||||
{ "3B:E2:00:00:40:20:49:07", NULL, "Cryptoflex", TYPE_CRYPTOFLEX|FLAG_KEYGEN },
|
||||
{ "3B:E2:00:00:40:20:49:07", NULL, "Cryptoflex", SC_CARD_TYPE_FLEX_CRYPTO, FLAG_KEYGEN },
|
||||
/* + Key Generation */
|
||||
{ "3B:85:40:20:68:01:01:03:05", NULL, "Cryptoflex", TYPE_CRYPTOFLEX|FLAG_KEYGEN },
|
||||
{ "3B:85:40:20:68:01:01:03:05", NULL, "Cryptoflex", SC_CARD_TYPE_FLEX_CRYPTO, FLAG_KEYGEN },
|
||||
|
||||
/* Multiflex */
|
||||
/* 3K */
|
||||
{ "3B:02:14:50", NULL, "Multiflex 3K", TYPE_MULTIFLEX },
|
||||
{ "3B:02:14:50", NULL, "Multiflex 3K", SC_CARD_TYPE_FLEX_MULTI, 0 },
|
||||
/* 4K */
|
||||
{ "3B:19:14:55:90:01:02:01:00:05:04:B0", NULL, "Multiflex 4K", TYPE_MULTIFLEX },
|
||||
{ "3B:19:14:55:90:01:02:01:00:05:04:B0", NULL, "Multiflex 4K", SC_CARD_TYPE_FLEX_MULTI, 0 },
|
||||
/* 8K */
|
||||
{ "3B:32:15:00:06:80", NULL, "Multiflex 8K", TYPE_MULTIFLEX },
|
||||
{ "3B:32:15:00:06:80", NULL, "Multiflex 8K", SC_CARD_TYPE_FLEX_MULTI, 0 },
|
||||
/* 8K + full DES option */
|
||||
{ "3B:32:15:00:06:95", NULL, "Multiflex 8K", TYPE_MULTIFLEX },
|
||||
{ "3B:32:15:00:06:95", NULL, "Multiflex 8K", SC_CARD_TYPE_FLEX_MULTI, FLAG_FULL_DES },
|
||||
/* 8K */
|
||||
{ "3B:19:14:59:01:01:0F:01:00:05:08:B0", NULL, "Multiflex 8K", TYPE_MULTIFLEX },
|
||||
{ "3B:19:14:59:01:01:0F:01:00:05:08:B0", NULL, "Multiflex 8K", SC_CARD_TYPE_FLEX_MULTI, 0 },
|
||||
/* 8K */
|
||||
{ "3B:19:14:55:90:01:01:01:00:05:08:B0", NULL, "Multiflex 8K", TYPE_MULTIFLEX },
|
||||
{ "3B:19:14:55:90:01:01:01:00:05:08:B0", NULL, "Multiflex 8K", SC_CARD_TYPE_FLEX_MULTI, 0 },
|
||||
|
||||
/* Cyberflex Access */
|
||||
/* Crypto */
|
||||
{ "3B:16:94:81:10:06:01:81:3F", NULL, "Cyberflex Access", TYPE_CYBERFLEX },
|
||||
{ "3B:16:94:81:10:06:01:81:3F", NULL, "Cyberflex Access", SC_CARD_TYPE_FLEX_CYBER, 0 },
|
||||
/* Aug. Crypto */
|
||||
{ "3B:16:94:81:10:06:01:81:2F", NULL, "Cyberflex Access", TYPE_CYBERFLEX },
|
||||
{ "3B:16:94:81:10:06:01:81:2F", NULL, "Cyberflex Access", SC_CARD_TYPE_FLEX_CYBER, 0 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -117,11 +111,12 @@ static int cryptoflex_match_card(struct sc_card *card)
|
|||
i = _sc_match_atr(card, flex_atrs, NULL);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
switch (flex_atrs[i].id & TYPE_MASK) {
|
||||
case TYPE_CRYPTOFLEX:
|
||||
case TYPE_MULTIFLEX:
|
||||
switch (flex_atrs[i].type) {
|
||||
case SC_CARD_TYPE_FLEX_CRYPTO:
|
||||
case SC_CARD_TYPE_FLEX_MULTI:
|
||||
card->name = flex_atrs[i].name;
|
||||
card->type = flex_atrs[i].id;
|
||||
card->type = flex_atrs[i].type;
|
||||
card->flags = flex_atrs[i].flags;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -134,10 +129,11 @@ static int cyberflex_match_card(struct sc_card *card)
|
|||
i = _sc_match_atr(card, flex_atrs, NULL);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
switch (flex_atrs[i].id & TYPE_MASK) {
|
||||
case TYPE_CYBERFLEX:
|
||||
switch (flex_atrs[i].type) {
|
||||
case SC_CARD_TYPE_FLEX_CYBER:
|
||||
card->name = flex_atrs[i].name;
|
||||
card->type = flex_atrs[i].id;
|
||||
card->type = flex_atrs[i].type;
|
||||
card->flags = flex_atrs[i].flags;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -155,8 +151,8 @@ static int flex_init(struct sc_card *card)
|
|||
data->aak_key_ref = 1;
|
||||
|
||||
/* Override Cryptoflex defaults for specific card types */
|
||||
switch (card->type & TYPE_MASK) {
|
||||
case TYPE_CYBERFLEX:
|
||||
switch (card->type) {
|
||||
case SC_CARD_TYPE_FLEX_CYBER:
|
||||
card->cla = 0x00;
|
||||
data->aak_key_ref = 0;
|
||||
break;
|
||||
|
@ -168,7 +164,7 @@ static int flex_init(struct sc_card *card)
|
|||
|
||||
flags = SC_ALGORITHM_RSA_RAW;
|
||||
flags |= SC_ALGORITHM_RSA_HASH_NONE;
|
||||
if (card->type & FLAG_KEYGEN)
|
||||
if (card->flags & FLAG_KEYGEN)
|
||||
flags |= SC_ALGORITHM_ONBOARD_KEY_GEN;
|
||||
|
||||
_sc_card_add_rsa_alg(card, 512, flags, 0);
|
||||
|
@ -1105,11 +1101,11 @@ static int flex_get_default_key(struct sc_card *card,
|
|||
return SC_ERROR_NO_DEFAULT_KEY;
|
||||
|
||||
/* These seem to be the default AAKs used by Schlumberger */
|
||||
switch (card->type & TYPE_MASK) {
|
||||
case TYPE_CRYPTOFLEX:
|
||||
switch (card->type) {
|
||||
case SC_CARD_TYPE_FLEX_CRYPTO:
|
||||
key = "2c:15:e5:26:e9:3e:8a:19";
|
||||
break;
|
||||
case TYPE_CYBERFLEX:
|
||||
case SC_CARD_TYPE_FLEX_CYBER:
|
||||
key = "ad:9f:61:fe:fa:20:ce:63";
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -35,18 +35,6 @@
|
|||
#define DES_ecb3_encrypt(a,b,c,d,e,f) des_ecb3_encrypt(a,b,*c,*d,*e,f)
|
||||
#endif
|
||||
|
||||
/* Gemplus card variants */
|
||||
enum {
|
||||
GPK4000_su256 = 4000,
|
||||
GPK4000_s,
|
||||
GPK4000_sp,
|
||||
GPK4000_sdo,
|
||||
GPK8000 = 8000,
|
||||
GPK8000_8K,
|
||||
GPK8000_16K,
|
||||
GPK16000 = 16000
|
||||
};
|
||||
|
||||
#define GPK_SEL_MF 0x00
|
||||
#define GPK_SEL_DF 0x01
|
||||
#define GPK_SEL_EF 0x02
|
||||
|
@ -102,13 +90,13 @@ static int gpk_get_info(struct sc_card *, u8, u8, u8 *, size_t);
|
|||
* ATRs of GPK4000 cards courtesy of libscez
|
||||
*/
|
||||
static struct sc_atr_table gpk_atrs[] = {
|
||||
{ "3B:27:00:80:65:A2:04:01:01:37", NULL, "GPK 4K", GPK4000_s },
|
||||
{ "3B:27:00:80:65:A2:05:01:01:37", NULL, "GPK 4K", GPK4000_sp },
|
||||
{ "3B:27:00:80:65:A2:0C:01:01:37", NULL, "GPK 4K", GPK4000_su256 },
|
||||
{ "3B:A7:00:40:14:80:65:A2:14:01:01:37", NULL, "GPK 4K", GPK4000_sdo },
|
||||
{ "3B:A7:00:40:18:80:65:A2:08:01:01:52", NULL, "GPK 8K", GPK8000_8K },
|
||||
{ "3B:A7:00:40:18:80:65:A2:09:01:01:52", NULL, "GPK 8K", GPK8000_16K },
|
||||
{ "3B:A7:00:40:18:80:65:A2:09:01:02:52", NULL, "GPK 16K", GPK16000 },
|
||||
{ "3B:27:00:80:65:A2:04:01:01:37", NULL, "GPK 4K", SC_CARD_TYPE_GPK_GPK4000_s },
|
||||
{ "3B:27:00:80:65:A2:05:01:01:37", NULL, "GPK 4K", SC_CARD_TYPE_GPK_GPK4000_sp },
|
||||
{ "3B:27:00:80:65:A2:0C:01:01:37", NULL, "GPK 4K", SC_CARD_TYPE_GPK_GPK4000_su256 },
|
||||
{ "3B:A7:00:40:14:80:65:A2:14:01:01:37", NULL, "GPK 4K", SC_CARD_TYPE_GPK_GPK4000_sdo },
|
||||
{ "3B:A7:00:40:18:80:65:A2:08:01:01:52", NULL, "GPK 8K", SC_CARD_TYPE_GPK_GPK8000_8K },
|
||||
{ "3B:A7:00:40:18:80:65:A2:09:01:01:52", NULL, "GPK 8K", SC_CARD_TYPE_GPK_GPK8000_16K },
|
||||
{ "3B:A7:00:40:18:80:65:A2:09:01:02:52", NULL, "GPK 16K", SC_CARD_TYPE_GPK_GPK16000 },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -146,11 +134,11 @@ gpk_match_card(struct sc_card *card)
|
|||
&& (hist_bytes[1] == 0x65)
|
||||
&& (hist_bytes[2] == 0xa2)) { /* FMN */
|
||||
if (hist_bytes[3] == 0x08) { /* PRN? */
|
||||
card->type = GPK8000;
|
||||
card->type = SC_CARD_TYPE_GPK_GPK8000;
|
||||
return 1;
|
||||
}
|
||||
if (hist_bytes[3] == 0x09) { /* PRN? */
|
||||
card->type = GPK16000;
|
||||
card->type = SC_CARD_TYPE_GPK_GPK16000;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -188,8 +176,8 @@ gpk_init(struct sc_card *card)
|
|||
| SC_ALGORITHM_RSA_HASH_MD5_SHA1;
|
||||
flags |= SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_PAD_ANSI
|
||||
| SC_ALGORITHM_RSA_PAD_ISO9796;
|
||||
exponent = (card->type < 16000)? 0x10001 : 0;
|
||||
kg = (card->type >= 8000)? SC_ALGORITHM_ONBOARD_KEY_GEN : 0;
|
||||
exponent = (card->type < SC_CARD_TYPE_GPK_GPK16000) ? 0x10001 : 0;
|
||||
kg = (card->type >= SC_CARD_TYPE_GPK_GPK8000) ? SC_ALGORITHM_ONBOARD_KEY_GEN : 0;
|
||||
_sc_card_add_rsa_alg(card, 512, flags|kg, exponent);
|
||||
_sc_card_add_rsa_alg(card, 768, flags, exponent);
|
||||
_sc_card_add_rsa_alg(card, 1024, flags|kg, exponent);
|
||||
|
@ -1385,19 +1373,19 @@ gpk_erase_card(struct sc_card *card)
|
|||
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
switch (card->type) {
|
||||
case GPK4000_su256:
|
||||
case GPK4000_sdo:
|
||||
case SC_CARD_TYPE_GPK_GPK4000_su256:
|
||||
case SC_CARD_TYPE_GPK_GPK4000_sdo:
|
||||
offset = 0x6B; /* courtesy gemplus hotline */
|
||||
break;
|
||||
|
||||
case GPK4000_s:
|
||||
case SC_CARD_TYPE_GPK_GPK4000_s:
|
||||
offset = 7;
|
||||
break;
|
||||
|
||||
case GPK8000:
|
||||
case GPK8000_8K:
|
||||
case GPK8000_16K:
|
||||
case GPK16000:
|
||||
case SC_CARD_TYPE_GPK_GPK8000:
|
||||
case SC_CARD_TYPE_GPK_GPK8000_8K:
|
||||
case SC_CARD_TYPE_GPK_GPK8000_16K:
|
||||
case SC_CARD_TYPE_GPK_GPK16000:
|
||||
offset = 0;
|
||||
break;
|
||||
|
||||
|
@ -1718,7 +1706,7 @@ static int gpk_get_serialnr(sc_card_t *card, sc_serial_number_t *serial)
|
|||
u8 rbuf[10];
|
||||
struct sc_apdu apdu;
|
||||
|
||||
if (card->type != GPK16000)
|
||||
if (card->type != SC_CARD_TYPE_GPK_GPK16000)
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
|
||||
if (!serial)
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
static struct sc_atr_table jcop_atrs[] = {
|
||||
{ "3B:E6:00:FF:81:31:FE:45:4A:43:4F:50:33:31:06", NULL },
|
||||
{ "3B:E6:00:FF:81:31:FE:45:4A:43:4F:50:33:31:06", NULL, NULL, SC_CARD_TYPE_JCOP_GENERIC },
|
||||
#if 0
|
||||
/* Requires secure messaging */
|
||||
{ "3B:E6:00:FF:81:31:FE:45:4A:43:4F:50:32:31:06", NULL },
|
||||
{ "3B:E6:00:FF:81:31:FE:45:4A:43:4F:50:32:31:06", NULL, NULL, SC_CARD_TYPE_JCOP_GENERIC },
|
||||
#endif
|
||||
{ NULL }
|
||||
};
|
||||
|
@ -77,7 +77,7 @@ static int jcop_match_card(struct sc_card *card)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = _sc_match_atr(card, jcop_atrs, NULL);
|
||||
i = _sc_match_atr(card, jcop_atrs, &card->type);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
|
@ -30,13 +30,10 @@
|
|||
#include <ctype.h>
|
||||
#include "esteid.h"
|
||||
|
||||
#define TYPE_GENERIC 0
|
||||
#define TYPE_ESTEID 1
|
||||
|
||||
static struct sc_atr_table mcrd_atrs[] = {
|
||||
{ "3B:FF:94:00:FF:80:B1:FE:45:1F:03:00:68:D2:76:00:00:28:FF:05:1E:31:80:00:90:00:23", NULL, "German BMI", TYPE_GENERIC },
|
||||
{ "3B:FE:94:00:FF:80:B1:FA:45:1F:03:45:73:74:45:49:44:20:76:65:72:20:31:2E:30:43", NULL, "EstEID (cold)", TYPE_ESTEID },
|
||||
{ "3B:6E:00:FF:45:73:74:45:49:44:20:76:65:72:20:31:2E:30", NULL, "EstEID (warm)", TYPE_ESTEID },
|
||||
{ "3B:FF:94:00:FF:80:B1:FE:45:1F:03:00:68:D2:76:00:00:28:FF:05:1E:31:80:00:90:00:23", NULL, "German BMI", SC_CARD_TYPE_MCRD_GENERIC },
|
||||
{ "3B:FE:94:00:FF:80:B1:FA:45:1F:03:45:73:74:45:49:44:20:76:65:72:20:31:2E:30:43", NULL, "EstEID (cold)", SC_CARD_TYPE_MCRD_ESTEID },
|
||||
{ "3B:6E:00:FF:45:73:74:45:49:44:20:76:65:72:20:31:2E:30", NULL, "EstEID (warm)", SC_CARD_TYPE_MCRD_ESTEID },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -278,7 +275,7 @@ static int mcrd_init(struct sc_card *card)
|
|||
|
||||
priv->curpath[0] = MFID;
|
||||
priv->curpathlen = 1;
|
||||
if (card->type != TYPE_ESTEID)
|
||||
if (card->type != SC_CARD_TYPE_MCRD_ESTEID)
|
||||
load_special_files (card);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1074,7 +1071,7 @@ static int mcrd_set_security_env(struct sc_card *card,
|
|||
SC_FUNC_CALLED(card->ctx, 2);
|
||||
|
||||
/* special environment handling for esteid, stolen from openpgp */
|
||||
if (card->type == TYPE_ESTEID) {
|
||||
if (card->type == SC_CARD_TYPE_MCRD_ESTEID) {
|
||||
/* some sanity checks */
|
||||
if (env->flags & SC_SEC_ENV_ALG_PRESENT) {
|
||||
if (env->algorithm != SC_ALGORITHM_RSA)
|
||||
|
|
|
@ -24,13 +24,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TYPE_PKI 1
|
||||
|
||||
static struct sc_atr_table miocos_atrs[] = {
|
||||
/* Test card with 32 kB memory */
|
||||
{ "3B:9D:94:40:23:00:68:10:11:4D:69:6F:43:4F:53:00:90:00", NULL, NULL, TYPE_PKI },
|
||||
{ "3B:9D:94:40:23:00:68:10:11:4D:69:6F:43:4F:53:00:90:00", NULL, NULL, SC_CARD_TYPE_MIOCOS_GENERIC },
|
||||
/* Test card with 64 kB memory */
|
||||
{ "3B:9D:94:40:23:00:68:20:01:4D:69:6F:43:4F:53:00:90:00", NULL, NULL, TYPE_PKI },
|
||||
{ "3B:9D:94:40:23:00:68:20:01:4D:69:6F:43:4F:53:00:90:00", NULL, NULL, SC_CARD_TYPE_MIOCOS_GENERIC },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -60,7 +58,8 @@ static int miocos_init(struct sc_card *card)
|
|||
{
|
||||
card->name = "MioCOS";
|
||||
card->cla = 0x00;
|
||||
if (card->type == TYPE_PKI) {
|
||||
|
||||
if (1) {
|
||||
unsigned long flags;
|
||||
|
||||
flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_PAD_PKCS1;
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
#include <ctype.h>
|
||||
#include <openssl/des.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include "card-oberthur.h"
|
||||
|
||||
/* keep OpenSSL 0.9.6 users happy ;-) */
|
||||
#if OPENSSL_VERSION_NUMBER < 0x00907000L
|
||||
|
@ -43,16 +42,49 @@
|
|||
|
||||
static struct sc_atr_table oberthur_atrs[] = {
|
||||
#if 0
|
||||
{ "3B:7F:18:00:00:00:31:C0:73:9E:01:0B:64:52:D9:04:00:82:90:00", NULL, "Oberthur 32k", ATR_OBERTHUR_32K },
|
||||
{ "3B:7F:18:00:00:00:31:C0:73:9E:01:0B:64:52:D9:05:00:82:90:00", NULL, "Oberthur 32k BIO", ATR_OBERTHUR_32K_BIO },
|
||||
{ "3B:7F:18:00:00:00:31:C0:73:9E:01:0B:64:52:D9:04:00:82:90:00", NULL, "Oberthur 32k", SC_CARD_TYPE_OBERTHUR_32K },
|
||||
{ "3B:7F:18:00:00:00:31:C0:73:9E:01:0B:64:52:D9:05:00:82:90:00", NULL, "Oberthur 32k BIO", SC_CARD_TYPE_OBERTHUR_32K_BIO },
|
||||
#endif
|
||||
{ "3B:7D:18:00:00:00:31:80:71:8E:64:77:E3:01:00:82:90:00", NULL, "Oberthur 64k v4/2.1.1", ATR_OBERTHUR_64K },
|
||||
{ "3B:7D:18:00:00:00:31:80:71:8E:64:77:E3:02:00:82:90:00", NULL, "Oberthur 64k v4/2.1.1", ATR_OBERTHUR_64K },
|
||||
{ "3B:7D:11:00:00:00:31:80:71:8E:64:77:E3:01:00:82:90:00", NULL, "Oberthur 64k v5", ATR_OBERTHUR_64K },
|
||||
{ "3B:7D:11:00:00:00:31:80:71:8E:64:77:E3:02:00:82:90:00", NULL, "Oberthur 64k v5/2.2.0", ATR_OBERTHUR_64K },
|
||||
{ "3B:7D:18:00:00:00:31:80:71:8E:64:77:E3:01:00:82:90:00", NULL, "Oberthur 64k v4/2.1.1", SC_CARD_TYPE_OBERTHUR_64K },
|
||||
{ "3B:7D:18:00:00:00:31:80:71:8E:64:77:E3:02:00:82:90:00", NULL, "Oberthur 64k v4/2.1.1", SC_CARD_TYPE_OBERTHUR_64K },
|
||||
{ "3B:7D:11:00:00:00:31:80:71:8E:64:77:E3:01:00:82:90:00", NULL, "Oberthur 64k v5", SC_CARD_TYPE_OBERTHUR_64K },
|
||||
{ "3B:7D:11:00:00:00:31:80:71:8E:64:77:E3:02:00:82:90:00", NULL, "Oberthur 64k v5/2.2.0", SC_CARD_TYPE_OBERTHUR_64K },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
struct NTLV {
|
||||
const char *name;
|
||||
unsigned int tag;
|
||||
size_t len;
|
||||
const unsigned char *value;
|
||||
};
|
||||
typedef struct NTLV NTLV_t;
|
||||
|
||||
struct auth_application_id {
|
||||
unsigned int tag;
|
||||
u8 value[SC_MAX_AID_SIZE];
|
||||
int len;
|
||||
};
|
||||
typedef struct auth_application_id auth_application_id_t;
|
||||
|
||||
struct auth_senv {
|
||||
unsigned int algorithm;
|
||||
int key_file_id;
|
||||
size_t key_size;
|
||||
};
|
||||
typedef struct auth_senv auth_senv_t;
|
||||
|
||||
struct auth_private_data {
|
||||
struct sc_pin_cmd_pin pin_info;
|
||||
long int sn;
|
||||
auth_application_id_t aid;
|
||||
auth_senv_t senv;
|
||||
};
|
||||
typedef struct auth_private_data auth_private_data_t;
|
||||
|
||||
#define AID_OBERTHUR_V2 0x201
|
||||
#define AID_OBERTHUR_V4 0x401
|
||||
#define AID_OBERTHUR_V5 0x501
|
||||
|
||||
static NTLV_t oberthur_aids[] = {
|
||||
#if 0
|
||||
|
@ -69,6 +101,14 @@ static NTLV_t oberthur_aids[] = {
|
|||
{ NULL, 0, 0, NULL }
|
||||
};
|
||||
|
||||
#define AUTH_PIN 1
|
||||
#define AUTH_PUK 2
|
||||
|
||||
#define SC_OBERTHUR_MAX_ATTR_SIZE 8
|
||||
|
||||
#define PUBKEY_512_ASN1_SIZE 0x4A
|
||||
#define PUBKEY_1024_ASN1_SIZE 0x8C
|
||||
#define PUBKEY_2048_ASN1_SIZE 0x10E
|
||||
|
||||
static unsigned char rsa_der[PUBKEY_2048_ASN1_SIZE];
|
||||
static int rsa_der_len = 0;
|
||||
|
@ -82,7 +122,6 @@ static struct sc_card_driver auth_drv = {
|
|||
&auth_ops
|
||||
};
|
||||
|
||||
|
||||
static int auth_get_pin_reference (struct sc_card *card,
|
||||
int type, int reference, int cmd, int *out_ref);
|
||||
static int auth_read_component(sc_card_t *card,
|
||||
|
@ -171,7 +210,7 @@ auth_match_card(struct sc_card *card)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = _sc_match_atr(card, oberthur_atrs, NULL);
|
||||
i = _sc_match_atr(card, oberthur_atrs, &card->type);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <ctype.h>
|
||||
|
||||
static struct sc_atr_table pgp_atrs[] = {
|
||||
{ "3b:fa:13:00:ff:81:31:80:45:00:31:c1:73:c0:01:00:00:90:00:b1", NULL },
|
||||
{ "3b:fa:13:00:ff:81:31:80:45:00:31:c1:73:c0:01:00:00:90:00:b1", NULL, NULL, SC_CARD_TYPE_OPENPGP_GENERIC },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -110,7 +110,7 @@ pgp_match_card(sc_card_t *card)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = _sc_match_atr(card, pgp_atrs, NULL);
|
||||
i = _sc_match_atr(card, pgp_atrs, &card->type);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
|
@ -23,28 +23,24 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define TYPE_GENERIC 0
|
||||
#define TYPE_PKI 1
|
||||
#define TYPE_FINEID 2
|
||||
|
||||
static struct sc_atr_table setcos_atrs[] = {
|
||||
/* some Nokia branded SC */
|
||||
{ "3B:1F:11:00:67:80:42:46:49:53:45:10:52:66:FF:81:90:00", NULL, NULL, TYPE_GENERIC },
|
||||
{ "3B:1F:11:00:67:80:42:46:49:53:45:10:52:66:FF:81:90:00", NULL, NULL, SC_CARD_TYPE_SETCOS_GENERIC },
|
||||
/* RSA SecurID 3100 */
|
||||
{ "3B:9F:94:40:1E:00:67:16:43:46:49:53:45:10:52:66:FF:81:90:00", NULL, NULL, TYPE_PKI },
|
||||
{ "3B:9F:94:40:1E:00:67:16:43:46:49:53:45:10:52:66:FF:81:90:00", NULL, NULL, SC_CARD_TYPE_SETCOS_PKI },
|
||||
|
||||
/* FINEID 1016 (SetCOS 4.3.1B3/PKCS#15, VRK) */
|
||||
{ "3b:9f:94:40:1e:00:67:00:43:46:49:53:45:10:52:66:ff:81:90:00", "ff:ff:ff:ff:ff:ff:ff:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff", NULL, TYPE_FINEID },
|
||||
{ "3b:9f:94:40:1e:00:67:00:43:46:49:53:45:10:52:66:ff:81:90:00", "ff:ff:ff:ff:ff:ff:ff:00:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff", NULL, SC_CARD_TYPE_SETCOS_FINEID },
|
||||
/* FINEID 2032 (EIDApplet/7816-15, VRK test) */
|
||||
{ "3b:6b:00:ff:80:62:00:a2:56:46:69:6e:45:49:44", "ff:ff:00:ff:ff:ff:00:ff:ff:ff:ff:ff:ff:ff:ff", NULL, TYPE_FINEID },
|
||||
{ "3b:6b:00:ff:80:62:00:a2:56:46:69:6e:45:49:44", "ff:ff:00:ff:ff:ff:00:ff:ff:ff:ff:ff:ff:ff:ff", NULL, SC_CARD_TYPE_SETCOS_FINEID },
|
||||
/* FINEID 2132 (EIDApplet/7816-15, OPK/EMV test) */
|
||||
{ "3b:64:00:ff:80:62:00:a2", "ff:ff:00:ff:ff:ff:00:ff", NULL, TYPE_FINEID },
|
||||
{ "3b:64:00:ff:80:62:00:a2", "ff:ff:00:ff:ff:ff:00:ff", NULL, SC_CARD_TYPE_SETCOS_FINEID },
|
||||
/* FINEID 2064 (EIDApplet/7816-15, VRK) */
|
||||
{ "3b:7b:00:00:00:80:62:00:51:56:46:69:6e:45:49:44", "ff:ff:00:ff:ff:ff:ff:f0:ff:ff:ff:ff:ff:ff:ff:ff", NULL, TYPE_FINEID },
|
||||
{ "3b:7b:00:00:00:80:62:00:51:56:46:69:6e:45:49:44", "ff:ff:00:ff:ff:ff:ff:f0:ff:ff:ff:ff:ff:ff:ff:ff", NULL, SC_CARD_TYPE_SETCOS_FINEID },
|
||||
/* FINEID 2164 (EIDApplet/7816-15, OPK/EMV) */
|
||||
{ "3b:64:00:00:80:62:00:51", "ff:ff:ff:ff:ff:ff:f0:ff", NULL, TYPE_FINEID },
|
||||
{ "3b:64:00:00:80:62:00:51", "ff:ff:ff:ff:ff:ff:f0:ff", NULL, SC_CARD_TYPE_SETCOS_FINEID },
|
||||
/* FINEID 2264 (EIDApplet/7816-15, OPK/EMV/AVANT) */
|
||||
{ "3b:6e:00:00:00:62:00:00:57:41:56:41:4e:54:10:81:90:00", NULL, NULL, TYPE_FINEID },
|
||||
{ "3b:6e:00:00:00:62:00:00:57:41:56:41:4e:54:10:81:90:00", NULL, NULL, SC_CARD_TYPE_SETCOS_FINEID },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -87,11 +83,11 @@ static int setcos_match_card(struct sc_card *card)
|
|||
if (i < 0) {
|
||||
/* Unknown card, but has the FinEID application for sure */
|
||||
if (match_hist_bytes(card, "FinEID", 0)) {
|
||||
card->type = TYPE_FINEID;
|
||||
card->type = SC_CARD_TYPE_SETCOS_FINEID;
|
||||
return 1;
|
||||
}
|
||||
if (match_hist_bytes(card, "FISE", 0)) {
|
||||
card->type = TYPE_GENERIC;
|
||||
card->type = SC_CARD_TYPE_SETCOS_GENERIC;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -120,19 +116,19 @@ static int setcos_init(struct sc_card *card)
|
|||
|
||||
/* Handle unknown or forced cards */
|
||||
if (card->type < 0) {
|
||||
#if 1
|
||||
#if 0
|
||||
/* Hmm. For now, assume it's a bank card with FinEID application */
|
||||
if (match_hist_bytes(card, "AVANT", 0)) {
|
||||
card->type = TYPE_FINEID;
|
||||
card->type = SC_CARD_TYPE_SETCOS_FINEID;
|
||||
} else
|
||||
#endif
|
||||
card->type = TYPE_GENERIC;
|
||||
card->type = SC_CARD_TYPE_SETCOS_GENERIC;
|
||||
}
|
||||
if (card->type == TYPE_FINEID) {
|
||||
if (card->type == SC_CARD_TYPE_SETCOS_FINEID) {
|
||||
card->cla = 0x00;
|
||||
select_fineid_app(card);
|
||||
}
|
||||
if (card->type == TYPE_PKI || card->type == TYPE_FINEID) {
|
||||
if (card->type == SC_CARD_TYPE_SETCOS_PKI || card->type == SC_CARD_TYPE_SETCOS_FINEID) {
|
||||
unsigned long flags;
|
||||
|
||||
flags = SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_PAD_PKCS1;
|
||||
|
@ -302,7 +298,8 @@ static int setcos_set_security_env(struct sc_card *card,
|
|||
sc_error(card->ctx, "Only RSA algorithm supported.\n");
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
if (card->type != TYPE_PKI) {
|
||||
if (!(card->type == SC_CARD_TYPE_SETCOS_PKI ||
|
||||
card->type == SC_CARD_TYPE_SETCOS_FINEID)) {
|
||||
sc_error(card->ctx, "Card does not support RSA.\n");
|
||||
return SC_ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include <string.h>
|
||||
|
||||
static struct sc_atr_table starcos_atrs[] = {
|
||||
{ "3B:B7:94:00:c0:24:31:fe:65:53:50:4b:32:33:90:00:b4", NULL },
|
||||
{ "3B:B7:94:00:81:31:fe:65:53:50:4b:32:33:90:00:d1", NULL },
|
||||
{ "3B:B7:94:00:c0:24:31:fe:65:53:50:4b:32:33:90:00:b4", NULL, NULL, SC_CARD_TYPE_STARCOS_GENERIC },
|
||||
{ "3B:B7:94:00:81:31:fe:65:53:50:4b:32:33:90:00:d1", NULL, NULL, SC_CARD_TYPE_STARCOS_GENERIC },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -70,7 +70,7 @@ static int starcos_match_card(struct sc_card *card)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = _sc_match_atr(card, starcos_atrs, NULL);
|
||||
i = _sc_match_atr(card, starcos_atrs, &card->type);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
|
@ -29,11 +29,11 @@
|
|||
|
||||
static struct sc_atr_table tcos_atrs[] = {
|
||||
/* SLE44 */
|
||||
{ "3B:BA:13:00:81:31:86:5D:00:64:05:0A:02:01:31:80:90:00:8B", NULL },
|
||||
{ "3B:BA:13:00:81:31:86:5D:00:64:05:0A:02:01:31:80:90:00:8B", NULL, NULL, SC_CARD_TYPE_TCOS_GENERIC },
|
||||
/* SLE66S */
|
||||
{ "3B:BA:14:00:81:31:86:5D:00:64:05:14:02:02:31:80:90:00:91", NULL },
|
||||
{ "3B:BA:14:00:81:31:86:5D:00:64:05:14:02:02:31:80:90:00:91", NULL, NULL, SC_CARD_TYPE_TCOS_GENERIC },
|
||||
/* SLE66P */
|
||||
{ "3B:BA:96:00:81:31:86:5D:00:64:05:60:02:03:31:80:90:00:66", NULL },
|
||||
{ "3B:BA:96:00:81:31:86:5D:00:64:05:60:02:03:31:80:90:00:66", NULL, NULL, SC_CARD_TYPE_TCOS_GENERIC },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
|
@ -60,7 +60,7 @@ static int tcos_match_card(struct sc_card *card)
|
|||
{
|
||||
int i;
|
||||
|
||||
i = _sc_match_atr(card, tcos_atrs, NULL);
|
||||
i = _sc_match_atr(card, tcos_atrs, &card->type);
|
||||
if (i < 0)
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
|
@ -906,7 +906,7 @@ struct sc_algorithm_info * _sc_card_find_rsa_alg(struct sc_card *card,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
int _sc_match_atr(struct sc_card *card, struct sc_atr_table *table, int *id_out)
|
||||
int _sc_match_atr(struct sc_card *card, struct sc_atr_table *table, int *type_out)
|
||||
{
|
||||
struct sc_context *ctx = card->ctx;
|
||||
char card_atr[3 * SC_MAX_ATR_SIZE];
|
||||
|
@ -956,8 +956,8 @@ int _sc_match_atr(struct sc_card *card, struct sc_atr_table *table, int *id_out)
|
|||
if (strncasecmp(tatr, card_atr, tatr_len) != 0)
|
||||
continue;
|
||||
}
|
||||
if (id_out != NULL)
|
||||
*id_out = table[i].id;
|
||||
if (type_out != NULL)
|
||||
*type_out = table[i].type;
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
|
@ -992,7 +992,7 @@ int _sc_add_atr(struct sc_context *ctx, struct sc_card_driver *driver, struct sc
|
|||
} else {
|
||||
dst->name = NULL;
|
||||
}
|
||||
dst->id = src->id;
|
||||
dst->type = src->type;
|
||||
dst->flags = src->flags;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -205,8 +205,7 @@ static int esteid_detect_card(sc_pkcs15_card_t *p15card)
|
|||
/* check if we have the correct card OS */
|
||||
if (strcmp(card->name, "MICARDO 2.1"))
|
||||
return SC_ERROR_WRONG_CARD;
|
||||
/* Assume type == 1 is just for EstEID cards */
|
||||
if (card->type == 1)
|
||||
if (card->type == SC_CARD_TYPE_MCRD_ESTEID)
|
||||
return SC_SUCCESS;
|
||||
return SC_ERROR_WRONG_CARD;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#endif
|
||||
#include <opensc/opensc.h>
|
||||
#include <opensc/cardctl.h>
|
||||
#include <opensc/cards.h>
|
||||
#include <opensc/log.h>
|
||||
#include "pkcs15-init.h"
|
||||
#include "profile.h"
|
||||
|
@ -611,10 +612,10 @@ gpk_pkfile_init_public(sc_profile_t *profile, sc_card_t *card, sc_file_t *file,
|
|||
sc_file_t *tmp = NULL;
|
||||
u8 sysrec[7], buffer[256];
|
||||
unsigned int n, npins;
|
||||
int r, gpkclass;
|
||||
int r, card_type;
|
||||
|
||||
/* Find out what sort of GPK we're using */
|
||||
if ((r = sc_card_ctl(card, SC_CARDCTL_GPK_VARIANT, &gpkclass)) < 0)
|
||||
if ((r = sc_card_ctl(card, SC_CARDCTL_GPK_VARIANT, &card_type)) < 0)
|
||||
return r;
|
||||
|
||||
/* Set up the system record */
|
||||
|
@ -680,7 +681,7 @@ gpk_pkfile_init_public(sc_profile_t *profile, sc_card_t *card, sc_file_t *file,
|
|||
|
||||
/* compute checksum - yet another slightly different
|
||||
* checksum algorithm courtesy of Gemplus */
|
||||
if (gpkclass >= 8000) {
|
||||
if (card_type >= SC_CARD_TYPE_GPK_GPK8000) {
|
||||
/* This is according to the gpk reference manual */
|
||||
sysrec[6] = 0xA5;
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue