cleanup ...

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2018 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-12-15 17:34:15 +00:00
parent bd45a8aef1
commit ed0d949af0
9 changed files with 57 additions and 40 deletions

View File

@ -37,13 +37,13 @@
static const struct sc_card_operations *iso_ops = NULL;
struct sc_card_operations etoken_ops;
struct sc_card_driver etoken_drv = {
static struct sc_card_driver etoken_drv = {
"Siemens CardOS",
"etoken",
&etoken_ops
};
const struct {
static const struct {
const char * atr;
int type;
} etoken_atrs[] = {

View File

@ -47,7 +47,7 @@
#define DES_ecb_encrypt(a,b,c,d) des_ecb_encrypt(a,b,*c,d)
#endif
NTLV_t oberthur_atrs[] = {
static NTLV_t oberthur_atrs[] = {
/* not jet supported
* { "Oberthur 32k", ATR_OBERTHUR_32K, 20,
* "\x3B\x7F\x18\x00\x00\x00\x31\xC0\x73\x9E\x01\x0B\x64\x52\xD9\x04\x00\x82\x90\x00"
@ -71,7 +71,7 @@ NTLV_t oberthur_atrs[] = {
};
NTLV_t oberthur_aids[] = {
static NTLV_t oberthur_aids[] = {
/*
{ "AuthentIC v2", AID_OBERTHUR_V2, 14,
"\xA0\x00\x00\x00\x77\x58\x35\x30\x39\x23\x56\x32\x2E\x30"
@ -500,7 +500,7 @@ check_path(struct sc_card *card, const u8 **pathptr, size_t *pathlen,
return 0;
}
#if 0
static void
auth_cache_path(struct sc_card *card, const struct sc_path *path)
{
@ -536,7 +536,7 @@ auth_cache_path(struct sc_card *card, const struct sc_path *path)
break;
}
}
#endif
static int
select_parent(struct sc_card *card, struct sc_file **file_out)

View File

@ -78,7 +78,7 @@ static int pgp_get_pubkey(sc_card_t *, unsigned int,
static int pgp_get_pubkey_pem(sc_card_t *, unsigned int,
u8 *, size_t);
struct do_info pgp_objects[] = {
static struct do_info pgp_objects[] = {
{ 0x004f, 0, 0, sc_get_data, sc_put_data },
{ 0x005e, 1, 0, sc_get_data, sc_put_data },
{ 0x0065, 1, 0, sc_get_data, sc_put_data },

View File

@ -31,6 +31,8 @@
#include "esteid.h"
int sc_pkcs15emu_esteid_init_ex(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *);
static void
set_string (char **strp, const char *value)
{
@ -52,7 +54,7 @@ select_esteid_df (sc_card_t * card)
return r;
}
int
static int
sc_pkcs15emu_esteid_init (sc_pkcs15_card_t * p15card)
{
sc_card_t *card = p15card->card;
@ -180,7 +182,7 @@ sc_pkcs15emu_esteid_init (sc_pkcs15_card_t * p15card)
"Autentiseerimise v\365ti",
"Allkirjastamise v\365ti"
};
sc_pkcs15_id_t id, auth_id;
sc_pkcs15_id_t auth_id;
id.value[0] = prkey_pin[i];
id.len = 1;

View File

@ -26,6 +26,8 @@
#include <string.h>
#include <stdio.h>
int sc_pkcs15emu_infocamere_init_ex(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *);
static int (*set_security_env)(sc_card_t *, const struct sc_security_env *, int);
static int (*compute_signature)(sc_card_t *, const u8 *, size_t, u8 *, size_t);
@ -50,7 +52,7 @@ set_string(char **strp, const char *value)
*strp = value? strdup(value) : NULL;
}
int
static int
sc_pkcs15emu_infocamere_init(sc_pkcs15_card_t *p15card)
{
const int prkey_usage = SC_PKCS15_PRKEY_USAGE_NONREPUDIATION;

View File

@ -27,6 +27,8 @@
#include <string.h>
#include <stdio.h>
int sc_pkcs15emu_netkey_init_ex(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *);
static void
set_string(char **strp, const char *value)
{
@ -35,7 +37,7 @@ set_string(char **strp, const char *value)
*strp = value? strdup(value) : NULL;
}
int
static int
sc_pkcs15emu_netkey_init(sc_pkcs15_card_t *p15card) {
static struct {
int id;

View File

@ -27,6 +27,8 @@
#include <stdio.h>
#include <assert.h>
int sc_pkcs15emu_openpgp_init_ex(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *);
static char * pgp_pin_name[3] = {
"Signature PIN",
"Encryption PIN",
@ -71,7 +73,7 @@ read_file(sc_card_t *card, const char *path_name, void *buf, size_t len)
return sc_read_binary(card, 0, (u8 *) buf, len, 0);
}
int
static int
sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
{
sc_card_t *card = p15card->card;

View File

@ -26,6 +26,8 @@
#include <string.h>
#include <stdio.h>
int sc_pkcs15emu_postecert_init_ex(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *);
static int (*set_security_env)(sc_card_t *, const struct sc_security_env *, int);
static int (*compute_signature)(sc_card_t *, const u8 *, size_t, u8 *, size_t);
@ -51,7 +53,7 @@ set_string(char **strp, const char *value)
*strp = value? strdup(value) : NULL;
}
int
static int
sc_pkcs15emu_postecert_init(sc_pkcs15_card_t *p15card)
{

View File

@ -28,6 +28,8 @@
#define MANU_ID "Giesecke & Devrient GmbH"
#define STARCERT "StarCertV2201"
int sc_pkcs15emu_starcert_init_ex(sc_pkcs15_card_t *, sc_pkcs15emu_opt_t *);
typedef struct cdata_st {
const char *label;
int authority;
@ -36,14 +38,6 @@ typedef struct cdata_st {
int obj_flags;
} cdata;
const cdata certs[] = {
{"DS certificate", 0, "3F00DF01C000","1", SC_PKCS15_CO_FLAG_MODIFIABLE},
{"CA certificate", 1, "3F00DF01C008","2", SC_PKCS15_CO_FLAG_MODIFIABLE},
{"KE certificate", 0, "3F00DF01C200","3", SC_PKCS15_CO_FLAG_MODIFIABLE},
{"AUT certificate",0, "3F00DF01C500","4", SC_PKCS15_CO_FLAG_MODIFIABLE},
{NULL, 0, NULL, 0, 0}
};
typedef struct pdata_st {
const char *id;
const char *label;
@ -58,14 +52,6 @@ typedef struct pdata_st {
int obj_flags;
} pindata;
const pindata pins[] = {
{ "99", "DS pin", "3F00DF01", 0x99, SC_PKCS15_PIN_TYPE_ASCII_NUMERIC,
8, 8, SC_PKCS15_PIN_FLAG_NEEDS_PADDING | SC_PKCS15_PIN_FLAG_LOCAL,
-1, 0x00,
SC_PKCS15_CO_FLAG_MODIFIABLE | SC_PKCS15_CO_FLAG_PRIVATE },
{ NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0}
};
typedef struct prdata_st {
const char *id;
const char *label;
@ -88,16 +74,6 @@ typedef struct prdata_st {
SC_PKCS15_PRKEY_USAGE_UNWRAP | \
SC_PKCS15_PRKEY_USAGE_SIGN
const prdata prkeys[] = {
{ "1", "DS key", 1024, USAGE_NONREP, "3F00DF01",
0x84, "99", SC_PKCS15_CO_FLAG_PRIVATE},
{ "3", "KE key", 1024, USAGE_KE, "3F00DF01",
0x85, NULL, SC_PKCS15_CO_FLAG_PRIVATE},
{ "4", "AUT key", 1024, USAGE_AUT, "3F00DF01",
0x82, NULL, SC_PKCS15_CO_FLAG_PRIVATE},
{ NULL, NULL, 0, 0, NULL, 0, NULL, 0}
};
static int get_cert_len(sc_card_t *card, sc_path_t *path)
{
int r;
@ -142,8 +118,39 @@ static int starcert_detect_card(sc_pkcs15_card_t *p15card)
return SC_SUCCESS;
}
int sc_pkcs15emu_starcert_init(sc_pkcs15_card_t *p15card)
static int sc_pkcs15emu_starcert_init(sc_pkcs15_card_t *p15card)
{
const cdata certs[] = {
{"DS certificate", 0, "3F00DF01C000","1",
SC_PKCS15_CO_FLAG_MODIFIABLE},
{"CA certificate", 1, "3F00DF01C008","2",
SC_PKCS15_CO_FLAG_MODIFIABLE},
{"KE certificate", 0, "3F00DF01C200","3",
SC_PKCS15_CO_FLAG_MODIFIABLE},
{"AUT certificate",0, "3F00DF01C500","4",
SC_PKCS15_CO_FLAG_MODIFIABLE},
{NULL, 0, NULL, 0, 0}
};
const pindata pins[] = {
{ "99", "DS pin", "3F00DF01", 0x99,
SC_PKCS15_PIN_TYPE_ASCII_NUMERIC,
8, 8, SC_PKCS15_PIN_FLAG_NEEDS_PADDING |
SC_PKCS15_PIN_FLAG_LOCAL, -1, 0x00,
SC_PKCS15_CO_FLAG_MODIFIABLE | SC_PKCS15_CO_FLAG_PRIVATE },
{ NULL, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0}
};
const prdata prkeys[] = {
{ "1", "DS key", 1024, USAGE_NONREP, "3F00DF01",
0x84, "99", SC_PKCS15_CO_FLAG_PRIVATE},
{ "3", "KE key", 1024, USAGE_KE, "3F00DF01",
0x85, NULL, SC_PKCS15_CO_FLAG_PRIVATE},
{ "4", "AUT key", 1024, USAGE_AUT, "3F00DF01",
0x82, NULL, SC_PKCS15_CO_FLAG_PRIVATE},
{ NULL, NULL, 0, 0, NULL, 0, NULL, 0}
};
int r, i;
char buf[256];
struct sc_path path;