Remove unused variables & fix line endings.
git-svn-id: https://www.opensc-project.org/svnp/opensc/branches/martin/0.12@3834 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
e5b644c2f7
commit
b34a1a6128
|
@ -47,24 +47,27 @@ static int myeid_create_pin_internal(sc_profile_t *, sc_card_t *,
|
|||
|
||||
static int myeid_puk_retries(sc_profile_t *profile, sc_pkcs15_pin_info_t *pin_info);
|
||||
|
||||
static int acl_to_byte(const struct sc_acl_entry *e)
|
||||
{
|
||||
switch (e->method) {
|
||||
case SC_AC_NONE:
|
||||
return 0x00;
|
||||
case SC_AC_CHV:
|
||||
case SC_AC_TERM:
|
||||
case SC_AC_AUT:
|
||||
if (e->key_ref == SC_AC_KEY_REF_NONE)
|
||||
return 0x00;
|
||||
if (e->key_ref < 1 || e->key_ref > MYEID_MAX_PINS)
|
||||
return 0x00;
|
||||
return e->key_ref;
|
||||
case SC_AC_NEVER:
|
||||
return 0x0F;
|
||||
}
|
||||
return 0x00;
|
||||
#if 0
|
||||
/* FIXME: Not used, remove */
|
||||
static int acl_to_byte(const struct sc_acl_entry *e)
|
||||
{
|
||||
switch (e->method) {
|
||||
case SC_AC_NONE:
|
||||
return 0x00;
|
||||
case SC_AC_CHV:
|
||||
case SC_AC_TERM:
|
||||
case SC_AC_AUT:
|
||||
if (e->key_ref == SC_AC_KEY_REF_NONE)
|
||||
return 0x00;
|
||||
if (e->key_ref < 1 || e->key_ref > MYEID_MAX_PINS)
|
||||
return 0x00;
|
||||
return e->key_ref;
|
||||
case SC_AC_NEVER:
|
||||
return 0x0F;
|
||||
}
|
||||
return 0x00;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Erase the card.
|
||||
|
@ -91,11 +94,11 @@ static int myeid_erase_card(sc_profile_t *profile, sc_card_t *card)
|
|||
|
||||
data[0]= 0xFF;
|
||||
data[1]= 0xFF;
|
||||
data[2]= 0x11;
|
||||
data[2]= 0x11;
|
||||
data[3]= 0x3F;
|
||||
data[4]= 0xFF;
|
||||
data[5]= 0x11;
|
||||
data[6]= 0xFF;
|
||||
data[5]= 0x11;
|
||||
data[6]= 0xFF;
|
||||
data[7]= 0xFF;
|
||||
|
||||
sc_profile_get_pin_info(profile, SC_PKCS15INIT_USER_PIN, &pin_info);
|
||||
|
@ -106,15 +109,15 @@ static int myeid_erase_card(sc_profile_t *profile, sc_card_t *card)
|
|||
data[3] = (sopin_info.reference << 4) | 0x0F;
|
||||
data[5] = data[2];
|
||||
}
|
||||
|
||||
|
||||
data_obj.P1 = 0x01;
|
||||
data_obj.P2 = 0xE0;
|
||||
data_obj.Data = data;
|
||||
data_obj.DataLen = 0x08;
|
||||
|
||||
sc_debug(card->ctx, "so_pin(%d), user pin (%d)\n",
|
||||
sopin_info.reference, pin_info.reference);
|
||||
|
||||
sopin_info.reference, pin_info.reference);
|
||||
|
||||
r = sc_card_ctl(card, SC_CARDCTL_MYEID_PUTDATA, &data_obj);
|
||||
|
||||
SC_FUNC_RETURN(card->ctx, 1, r);
|
||||
|
@ -124,7 +127,6 @@ static int myeid_init_card(sc_profile_t *profile,
|
|||
sc_card_t *card)
|
||||
{
|
||||
struct sc_path path;
|
||||
sc_file_t *file;
|
||||
int r;
|
||||
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
|
@ -141,7 +143,6 @@ static int myeid_init_card(sc_profile_t *profile,
|
|||
static int myeid_create_dir(sc_profile_t *profile, sc_card_t *card, sc_file_t *df)
|
||||
{
|
||||
int r=0;
|
||||
struct sc_file *file;
|
||||
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
if (!profile || !card || !df)
|
||||
|
@ -163,7 +164,6 @@ static int myeid_create_dir(sc_profile_t *profile, sc_card_t *card, sc_file_t *d
|
|||
static int myeid_select_pin_reference(sc_profile_t *profile, sc_card_t *card,
|
||||
sc_pkcs15_pin_info_t *pin_info)
|
||||
{
|
||||
sc_pkcs15_pin_info_t pin_info_prof;
|
||||
int type;
|
||||
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
|
@ -214,7 +214,7 @@ static int myeid_new_file(sc_profile_t *profile, sc_card_t *card,
|
|||
char name[64], *tag;
|
||||
int r;
|
||||
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
if (type == SC_PKCS15_TYPE_PRKEY_RSA)
|
||||
tag = "private-key";
|
||||
else if (type == SC_PKCS15_TYPE_PUBKEY_RSA)
|
||||
|
@ -311,10 +311,7 @@ static int myeid_generate_store_key(sc_profile_t *profile, sc_card_t *card,
|
|||
sc_pkcs15_prkey_info_t *info)
|
||||
{
|
||||
struct sc_cardctl_myeid_gen_store_key_info args;
|
||||
struct sc_cardctl_myeid_data_obj data_obj;
|
||||
unsigned char raw_pubkey[256];
|
||||
int r;
|
||||
unsigned int mod_len;
|
||||
sc_file_t *prkf = NULL;
|
||||
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
|
@ -398,15 +395,13 @@ static int myeid_create_pin_internal(sc_profile_t *profile, sc_card_t *card,
|
|||
const u8 *puk, size_t puk_len)
|
||||
{
|
||||
u8 data[20];
|
||||
int so_pin_ref;
|
||||
int r,type, puk_tries;
|
||||
struct sc_cardctl_myeid_data_obj data_obj;
|
||||
sc_file_t *pinfile = NULL;
|
||||
|
||||
SC_FUNC_CALLED(card->ctx, 1);
|
||||
sc_debug(card->ctx, "pin (%d), pin_len (%d), puk_len(%d) \n",
|
||||
pin_info->reference, pin_len, puk_len);
|
||||
|
||||
|
||||
if (pin_info->reference >= MYEID_MAX_PINS)
|
||||
return SC_ERROR_INVALID_ARGUMENTS;
|
||||
if (pin == NULL || puk == NULL || pin_len < 4 || puk_len < 4)
|
||||
|
@ -428,7 +423,7 @@ static int myeid_create_pin_internal(sc_profile_t *profile, sc_card_t *card,
|
|||
memcpy(&data[0], (u8 *)pin, pin_len); /* copy pin*/
|
||||
memcpy(&data[8], (u8 *)puk, puk_len); /* copy puk */
|
||||
|
||||
data[16] = 0x00;
|
||||
data[16] = 0x00;
|
||||
data[17] = 0x00;
|
||||
data[18] = 0x00;
|
||||
|
||||
|
|
Loading…
Reference in New Issue