API fixup: use defined type instead of struct for exposed structs (part 2)

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2233 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
bert 2005-03-09 00:04:44 +00:00
parent 2d97002824
commit eb4717ea17
26 changed files with 206 additions and 206 deletions

View File

@ -15,7 +15,7 @@
#include "openscd.h" #include "openscd.h"
static struct openscd_card * find_card(struct openscd_context *dctx, static struct openscd_card * find_card(struct openscd_context *dctx,
struct sc_reader *reader, sc_reader_t *reader,
int slot_id) int slot_id)
{ {
int i; int i;
@ -44,12 +44,12 @@ static struct openscd_card * find_card_by_id(struct openscd_context *dctx,
} }
static void card_inserted(struct openscd_context *dctx, static void card_inserted(struct openscd_context *dctx,
struct sc_reader *reader, sc_reader_t *reader,
int slot_id) int slot_id)
{ {
int n = dctx->card_count; int n = dctx->card_count;
int r; int r;
struct sc_card *card; sc_card_t *card;
struct sc_pkcs15_card *p15card; struct sc_pkcs15_card *p15card;
dctx->cards = (struct openscd_card *) realloc(dctx->cards, (n + 1) * sizeof(struct openscd_card)); dctx->cards = (struct openscd_card *) realloc(dctx->cards, (n + 1) * sizeof(struct openscd_card));
@ -222,8 +222,8 @@ static void * sc_thread(void *arg)
{ {
struct openscd_thread_arg *targ = (struct openscd_thread_arg *) arg; struct openscd_thread_arg *targ = (struct openscd_thread_arg *) arg;
struct openscd_context *dctx = targ->dctx; struct openscd_context *dctx = targ->dctx;
struct sc_reader *reader = targ->reader; sc_reader_t *reader = targ->reader;
struct sc_context *ctx = dctx->ctx; sc_context_t *ctx = dctx->ctx;
const int sleep_time = 200; const int sleep_time = 200;
int r; int r;

View File

@ -2107,7 +2107,7 @@ static int pkcs15_dobj_get_value(struct sc_pkcs11_session *session,
struct pkcs15_fw_data *fw_data = struct pkcs15_fw_data *fw_data =
(struct pkcs15_fw_data *) session->slot->card->fw_data; (struct pkcs15_fw_data *) session->slot->card->fw_data;
struct pkcs15_slot_data *data = slot_data(session->slot->fw_data); struct pkcs15_slot_data *data = slot_data(session->slot->fw_data);
struct sc_card *card = session->slot->card->card; sc_card_t *card = session->slot->card->card;
int reader = session->slot->card->reader; int reader = session->slot->card->reader;
if (!out_data) if (!out_data)

View File

@ -308,7 +308,7 @@ CK_RV attr_find_var(CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount,
return attr_extract(pTemplate, ptr, sizep); return attr_extract(pTemplate, ptr, sizep);
} }
void load_pkcs11_parameters(struct sc_pkcs11_config *conf, struct sc_context *ctx) void load_pkcs11_parameters(struct sc_pkcs11_config *conf, sc_context_t *ctx)
{ {
scconf_block *conf_block = NULL, **blocks; scconf_block *conf_block = NULL, **blocks;
int i; int i;

View File

@ -22,7 +22,7 @@
#include <string.h> #include <string.h>
#include "sc-pkcs11.h" #include "sc-pkcs11.h"
struct sc_context *context = NULL; sc_context_t *context = NULL;
struct sc_pkcs11_pool session_pool; struct sc_pkcs11_pool session_pool;
struct sc_pkcs11_slot virtual_slots[SC_PKCS11_MAX_VIRTUAL_SLOTS]; struct sc_pkcs11_slot virtual_slots[SC_PKCS11_MAX_VIRTUAL_SLOTS];
struct sc_pkcs11_card card_table[SC_PKCS11_MAX_READERS]; struct sc_pkcs11_card card_table[SC_PKCS11_MAX_READERS];
@ -340,7 +340,7 @@ CK_RV C_WaitForSlotEvent(CK_FLAGS flags, /* blocking/nonblocking flag */
CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */ CK_SLOT_ID_PTR pSlot, /* location that receives the slot ID */
CK_VOID_PTR pReserved) /* reserved. Should be NULL_PTR */ CK_VOID_PTR pReserved) /* reserved. Should be NULL_PTR */
{ {
struct sc_reader *reader, *readers[SC_MAX_SLOTS * SC_MAX_READERS]; sc_reader_t *reader, *readers[SC_MAX_SLOTS * SC_MAX_READERS];
int slots[SC_MAX_SLOTS * SC_MAX_READERS]; int slots[SC_MAX_SLOTS * SC_MAX_READERS];
int i, j, k, r, found; int i, j, k, r, found;
unsigned int mask, events; unsigned int mask, events;

View File

@ -52,7 +52,7 @@ static CK_RV init_spy(void)
{ {
const char *mspec = NULL, *file = NULL, *env = NULL; const char *mspec = NULL, *file = NULL, *env = NULL;
scconf_block *conf_block = NULL, **blocks; scconf_block *conf_block = NULL, **blocks;
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
int rv = CKR_OK, r, i; int rv = CKR_OK, r, i;
/* Allocates and initializes the pkcs11_spy structure */ /* Allocates and initializes the pkcs11_spy structure */

View File

@ -50,8 +50,8 @@ static int cflex_get_keyfiles(sc_profile_t *, sc_card_t *,
static int static int
cflex_delete_file(sc_profile_t *profile, sc_card_t *card, sc_file_t *df) cflex_delete_file(sc_profile_t *profile, sc_card_t *card, sc_file_t *df)
{ {
struct sc_path path; sc_path_t path;
struct sc_file *parent; sc_file_t *parent;
int r = 0; int r = 0;
/* Select the parent DF */ /* Select the parent DF */
path = df->path; path = df->path;
@ -81,9 +81,9 @@ cflex_delete_file(sc_profile_t *profile, sc_card_t *card, sc_file_t *df)
/* /*
* Erase the card via rm * Erase the card via rm
*/ */
static int cflex_erase_card(struct sc_profile *profile, struct sc_card *card) static int cflex_erase_card(struct sc_profile *profile, sc_card_t *card)
{ {
struct sc_file *df = profile->df_info->file, *dir, *userpinfile; sc_file_t *df = profile->df_info->file, *dir, *userpinfile;
int r; int r;
/* Delete EF(DIR). This may not be very nice /* Delete EF(DIR). This may not be very nice

View File

@ -60,7 +60,7 @@ static int etoken_store_pin(sc_profile_t *profile, sc_card_t *card,
const u8 *pin, size_t pin_len); const u8 *pin, size_t pin_len);
static int etoken_create_sec_env(sc_profile_t *, sc_card_t *, static int etoken_create_sec_env(sc_profile_t *, sc_card_t *,
unsigned int, unsigned int); unsigned int, unsigned int);
static int etoken_put_key(struct sc_profile *, struct sc_card *, static int etoken_put_key(struct sc_profile *, sc_card_t *,
int, sc_pkcs15_prkey_info_t *, int, sc_pkcs15_prkey_info_t *,
struct sc_pkcs15_prkey_rsa *); struct sc_pkcs15_prkey_rsa *);
static int etoken_key_algorithm(unsigned int, int *); static int etoken_key_algorithm(unsigned int, int *);
@ -124,7 +124,7 @@ tlv_len(struct tlv *tlv)
* it's close enough to be useful. * it's close enough to be useful.
*/ */
static int static int
etoken_erase(struct sc_profile *profile, struct sc_card *card) etoken_erase(struct sc_profile *profile, sc_card_t *card)
{ {
return sc_pkcs15init_erase_card_recursively(card, profile, -1); return sc_pkcs15init_erase_card_recursively(card, profile, -1);
} }
@ -460,7 +460,7 @@ etoken_store_pin(sc_profile_t *profile, sc_card_t *card,
* Create an empty security environment * Create an empty security environment
*/ */
static int static int
etoken_create_sec_env(struct sc_profile *profile, struct sc_card *card, etoken_create_sec_env(struct sc_profile *profile, sc_card_t *card,
unsigned int se_id, unsigned int key_id) unsigned int se_id, unsigned int key_id)
{ {
struct sc_cardctl_etoken_obj_info args; struct sc_cardctl_etoken_obj_info args;
@ -520,7 +520,7 @@ etoken_key_algorithm(unsigned int usage, int *algop)
#define ETOKEN_KEY_OPTIONS 0x02 #define ETOKEN_KEY_OPTIONS 0x02
#define ETOKEN_KEY_FLAGS 0x00 #define ETOKEN_KEY_FLAGS 0x00
static int static int
etoken_store_key_component(struct sc_card *card, etoken_store_key_component(sc_card_t *card,
int algorithm, int algorithm,
unsigned int key_id, unsigned int pin_id, unsigned int key_id, unsigned int pin_id,
unsigned int num, unsigned int num,
@ -608,7 +608,7 @@ etoken_put_key(sc_profile_t *profile, sc_card_t *card,
* GENERATE KEY PAIR * GENERATE KEY PAIR
*/ */
static int static int
etoken_extract_pubkey(struct sc_card *card, int nr, u8 tag, etoken_extract_pubkey(sc_card_t *card, int nr, u8 tag,
sc_pkcs15_bignum_t *bn) sc_pkcs15_bignum_t *bn)
{ {
u8 buf[256]; u8 buf[256];

View File

@ -75,8 +75,8 @@ static int gpk_encode_rsa_key(sc_profile_t *, sc_card_t *,
static int gpk_encode_dsa_key(sc_profile_t *, sc_card_t *, static int gpk_encode_dsa_key(sc_profile_t *, sc_card_t *,
struct sc_pkcs15_prkey_dsa *, struct pkdata *, struct sc_pkcs15_prkey_dsa *, struct pkdata *,
struct sc_pkcs15_prkey_info *); struct sc_pkcs15_prkey_info *);
static int gpk_store_pk(struct sc_profile *, struct sc_card *, static int gpk_store_pk(struct sc_profile *, sc_card_t *,
struct sc_file *, struct pkdata *); sc_file_t *, struct pkdata *);
static int gpk_init_pinfile(sc_profile_t *, sc_card_t *, sc_file_t *); static int gpk_init_pinfile(sc_profile_t *, sc_card_t *, sc_file_t *);
static int gpk_pkfile_init_public(sc_profile_t *, sc_card_t *, static int gpk_pkfile_init_public(sc_profile_t *, sc_card_t *,
sc_file_t *, unsigned int, unsigned int, unsigned int); sc_file_t *, unsigned int, unsigned int, unsigned int);
@ -88,7 +88,7 @@ static int gpk_read_rsa_key(sc_card_t *, struct sc_pkcs15_pubkey_rsa *);
* Erase the card * Erase the card
*/ */
static int static int
gpk_erase_card(struct sc_profile *pro, struct sc_card *card) gpk_erase_card(struct sc_profile *pro, sc_card_t *card)
{ {
int locked; int locked;
@ -253,7 +253,7 @@ gpk_create_pin(sc_profile_t *profile, sc_card_t *card, sc_file_t *df,
* Lock a file operation * Lock a file operation
*/ */
static int static int
gpk_lock(struct sc_card *card, struct sc_file *file, unsigned int op) gpk_lock(sc_card_t *card, sc_file_t *file, unsigned int op)
{ {
struct sc_cardctl_gpk_lock args; struct sc_cardctl_gpk_lock args;
@ -266,8 +266,8 @@ gpk_lock(struct sc_card *card, struct sc_file *file, unsigned int op)
* Lock the pin file * Lock the pin file
*/ */
static int static int
gpk_lock_pinfile(struct sc_profile *profile, struct sc_card *card, gpk_lock_pinfile(struct sc_profile *profile, sc_card_t *card,
struct sc_file *pinfile) sc_file_t *pinfile)
{ {
struct sc_path path; struct sc_path path;
struct sc_file *parent = NULL; struct sc_file *parent = NULL;
@ -295,10 +295,10 @@ gpk_lock_pinfile(struct sc_profile *profile, struct sc_card *card,
* Initialize pin file * Initialize pin file
*/ */
static int static int
gpk_init_pinfile(struct sc_profile *profile, struct sc_card *card, gpk_init_pinfile(struct sc_profile *profile, sc_card_t *card,
struct sc_file *file) sc_file_t *file)
{ {
const struct sc_acl_entry *acl; const sc_acl_entry_t *acl;
unsigned char buffer[GPK_MAX_PINS * 8], *blk; unsigned char buffer[GPK_MAX_PINS * 8], *blk;
struct sc_file *pinfile; struct sc_file *pinfile;
unsigned int so_attempts[2], user_attempts[2]; unsigned int so_attempts[2], user_attempts[2];
@ -608,7 +608,7 @@ gpk_pkfile_init_public(sc_profile_t *profile, sc_card_t *card, sc_file_t *file,
unsigned int algo, unsigned int bits, unsigned int algo, unsigned int bits,
unsigned int usage) unsigned int usage)
{ {
const struct sc_acl_entry *acl; const sc_acl_entry_t *acl;
sc_file_t *tmp = NULL; sc_file_t *tmp = NULL;
u8 sysrec[7], buffer[256]; u8 sysrec[7], buffer[256];
unsigned int n, npins; unsigned int n, npins;
@ -715,7 +715,7 @@ out: if (tmp)
static int static int
gpk_pkfile_update_public(struct sc_profile *profile, gpk_pkfile_update_public(struct sc_profile *profile,
struct sc_card *card, struct pkpart *part) sc_card_t *card, struct pkpart *part)
{ {
struct pkcomp *pe; struct pkcomp *pe;
unsigned char buffer[256]; unsigned char buffer[256];
@ -776,8 +776,8 @@ gpk_pkfile_update_public(struct sc_profile *profile,
} }
static int static int
gpk_pkfile_init_private(struct sc_card *card, gpk_pkfile_init_private(sc_card_t *card,
struct sc_file *file, unsigned int privlen) sc_file_t *file, unsigned int privlen)
{ {
struct sc_cardctl_gpk_pkinit args; struct sc_cardctl_gpk_pkinit args;
@ -787,7 +787,7 @@ gpk_pkfile_init_private(struct sc_card *card,
} }
static int static int
gpk_pkfile_load_private(struct sc_card *card, struct sc_file *file, gpk_pkfile_load_private(sc_card_t *card, sc_file_t *file,
u8 *data, unsigned int len, unsigned int datalen) u8 *data, unsigned int len, unsigned int datalen)
{ {
struct sc_cardctl_gpk_pkload args; struct sc_cardctl_gpk_pkload args;
@ -801,7 +801,7 @@ gpk_pkfile_load_private(struct sc_card *card, struct sc_file *file,
static int static int
gpk_pkfile_update_private(struct sc_profile *profile, gpk_pkfile_update_private(struct sc_profile *profile,
struct sc_card *card, struct sc_file *file, sc_card_t *card, sc_file_t *file,
struct pkpart *part) struct pkpart *part)
{ {
unsigned int m, size, nb, cks; unsigned int m, size, nb, cks;
@ -1038,8 +1038,8 @@ gpk_encode_dsa_key(sc_profile_t *profile, sc_card_t *card,
} }
static int static int
gpk_store_pk(struct sc_profile *profile, struct sc_card *card, gpk_store_pk(struct sc_profile *profile, sc_card_t *card,
struct sc_file *file, struct pkdata *p) sc_file_t *file, struct pkdata *p)
{ {
size_t fsize; size_t fsize;
int r; int r;

View File

@ -40,7 +40,7 @@
* Erase the card * Erase the card
*/ */
static int static int
jcop_erase_card(struct sc_profile *pro, struct sc_card *card) { jcop_erase_card(struct sc_profile *pro, sc_card_t *card) {
/* later */ /* later */
return SC_ERROR_NOT_SUPPORTED; return SC_ERROR_NOT_SUPPORTED;
} }
@ -143,7 +143,7 @@ jcop_create_key(sc_profile_t *profile, sc_card_t *card, sc_pkcs15_object_t *obj
) )
{ {
sc_pkcs15_prkey_info_t *key_info = (sc_pkcs15_prkey_info_t *) obj->data; sc_pkcs15_prkey_info_t *key_info = (sc_pkcs15_prkey_info_t *) obj->data;
struct sc_file *keyfile = NULL; sc_file_t *keyfile = NULL;
size_t bytes, mod_len, exp_len, prv_len, pub_len; size_t bytes, mod_len, exp_len, prv_len, pub_len;
int r; int r;

View File

@ -73,18 +73,18 @@
#define DEFAULT_DATA_FLAGS 0x02 #define DEFAULT_DATA_FLAGS 0x02
/* Handle encoding of PKCS15 on the card */ /* Handle encoding of PKCS15 on the card */
typedef int (*pkcs15_encoder)(struct sc_context *, typedef int (*pkcs15_encoder)(sc_context_t *,
struct sc_pkcs15_card *, u8 **, size_t *); struct sc_pkcs15_card *, u8 **, size_t *);
static int sc_pkcs15init_store_data(struct sc_pkcs15_card *, static int sc_pkcs15init_store_data(struct sc_pkcs15_card *,
struct sc_profile *, sc_pkcs15_object_t *, struct sc_profile *, sc_pkcs15_object_t *,
sc_pkcs15_id_t *, sc_pkcs15_id_t *,
sc_pkcs15_der_t *, struct sc_path *); sc_pkcs15_der_t *, sc_path_t *);
static size_t sc_pkcs15init_keybits(sc_pkcs15_bignum_t *); static size_t sc_pkcs15init_keybits(sc_pkcs15_bignum_t *);
static int sc_pkcs15init_update_dir(struct sc_pkcs15_card *, static int sc_pkcs15init_update_dir(struct sc_pkcs15_card *,
struct sc_profile *profile, struct sc_profile *profile,
struct sc_app_info *app); sc_app_info_t *app);
static int sc_pkcs15init_update_tokeninfo(struct sc_pkcs15_card *, static int sc_pkcs15init_update_tokeninfo(struct sc_pkcs15_card *,
struct sc_profile *profile); struct sc_profile *profile);
static int sc_pkcs15init_update_odf(struct sc_pkcs15_card *, static int sc_pkcs15init_update_odf(struct sc_pkcs15_card *,
@ -105,8 +105,8 @@ static int set_so_pin_from_card(struct sc_pkcs15_card *,
struct sc_profile *); struct sc_profile *);
static int set_user_pin_from_authid(struct sc_pkcs15_card *, static int set_user_pin_from_authid(struct sc_pkcs15_card *,
struct sc_profile *, struct sc_pkcs15_id *); struct sc_profile *, struct sc_pkcs15_id *);
static int do_select_parent(struct sc_profile *, struct sc_card *, static int do_select_parent(struct sc_profile *, sc_card_t *,
struct sc_file *, struct sc_file **); sc_file_t *, sc_file_t **);
static int sc_pkcs15init_create_pin(sc_pkcs15_card_t *, sc_profile_t *, static int sc_pkcs15init_create_pin(sc_pkcs15_card_t *, sc_profile_t *,
sc_pkcs15_object_t *, struct sc_pkcs15init_pinargs *); sc_pkcs15_object_t *, struct sc_pkcs15init_pinargs *);
static int check_key_compatibility(struct sc_pkcs15_card *, static int check_key_compatibility(struct sc_pkcs15_card *,
@ -165,9 +165,9 @@ sc_pkcs15init_set_callbacks(struct sc_pkcs15init_callbacks *cb)
* in the config file, or 0 otherwise. * in the config file, or 0 otherwise.
*/ */
static int static int
get_profile_from_config(struct sc_card *card, char *buffer, size_t size) get_profile_from_config(sc_card_t *card, char *buffer, size_t size)
{ {
struct sc_context *ctx = card->ctx; sc_context_t *ctx = card->ctx;
const char *tmp; const char *tmp;
scconf_block **blocks, *blk; scconf_block **blocks, *blk;
int i; int i;
@ -220,7 +220,7 @@ static const char *find_library(sc_context_t *ctx, const char *name)
return libname; return libname;
} }
static void *load_dynamic_driver(struct sc_context *ctx, void **dll, static void *load_dynamic_driver(sc_context_t *ctx, void **dll,
const char *name) const char *name)
{ {
const char *version, *libname; const char *version, *libname;
@ -262,7 +262,7 @@ static void *load_dynamic_driver(struct sc_context *ctx, void **dll,
* Set up profile * Set up profile
*/ */
int int
sc_pkcs15init_bind(struct sc_card *card, const char *name, sc_pkcs15init_bind(sc_card_t *card, const char *name,
const char *profile_option, const char *profile_option,
struct sc_profile **result) struct sc_profile **result)
{ {
@ -366,7 +366,7 @@ sc_pkcs15init_set_lifecycle(sc_card_t *card, int lcycle)
* Erase the card * Erase the card
*/ */
int int
sc_pkcs15init_erase_card(struct sc_card *card, struct sc_profile *profile) sc_pkcs15init_erase_card(sc_card_t *card, struct sc_profile *profile)
{ {
if (profile->ops->erase_card == NULL) if (profile->ops->erase_card == NULL)
return SC_ERROR_NOT_SUPPORTED; return SC_ERROR_NOT_SUPPORTED;
@ -374,7 +374,7 @@ sc_pkcs15init_erase_card(struct sc_card *card, struct sc_profile *profile)
} }
int int
sc_pkcs15init_erase_card_recursively(struct sc_card *card, sc_pkcs15init_erase_card_recursively(sc_card_t *card,
struct sc_profile *profile, struct sc_profile *profile,
int so_pin_ref) int so_pin_ref)
{ {
@ -435,8 +435,8 @@ out: /* Forget any cached keys, the objects on card are all gone. */
* references a pin other than the SO pin. * references a pin other than the SO pin.
*/ */
int int
sc_pkcs15init_rmdir(struct sc_card *card, struct sc_profile *profile, sc_pkcs15init_rmdir(sc_card_t *card, struct sc_profile *profile,
struct sc_file *df) sc_file_t *df)
{ {
u8 buffer[1024]; u8 buffer[1024];
struct sc_path path; struct sc_path path;
@ -508,7 +508,7 @@ sc_pkcs15init_rmdir(struct sc_card *card, struct sc_profile *profile,
} }
int int
sc_pkcs15init_finalize_card(struct sc_card *card, struct sc_profile *profile) sc_pkcs15init_finalize_card(sc_card_t *card, struct sc_profile *profile)
{ {
if (profile->ops->finalize_card == NULL) if (profile->ops->finalize_card == NULL)
return SC_ERROR_NOT_SUPPORTED; return SC_ERROR_NOT_SUPPORTED;
@ -519,13 +519,13 @@ sc_pkcs15init_finalize_card(struct sc_card *card, struct sc_profile *profile)
* Initialize the PKCS#15 application * Initialize the PKCS#15 application
*/ */
int int
sc_pkcs15init_add_app(struct sc_card *card, struct sc_profile *profile, sc_pkcs15init_add_app(sc_card_t *card, struct sc_profile *profile,
struct sc_pkcs15init_initargs *args) struct sc_pkcs15init_initargs *args)
{ {
sc_pkcs15_card_t *p15spec = profile->p15_spec; sc_pkcs15_card_t *p15spec = profile->p15_spec;
sc_pkcs15_pin_info_t pin_info, puk_info; sc_pkcs15_pin_info_t pin_info, puk_info;
sc_pkcs15_object_t *pin_obj = NULL; sc_pkcs15_object_t *pin_obj = NULL;
struct sc_app_info *app; sc_app_info_t *app;
sc_file_t *df = profile->df_info->file; sc_file_t *df = profile->df_info->file;
int r; int r;
@ -634,7 +634,7 @@ sc_pkcs15init_add_app(struct sc_card *card, struct sc_profile *profile,
* all sorts of assumptions about DF and EF names, and * all sorts of assumptions about DF and EF names, and
* doesn't work if secure messaging is required for the * doesn't work if secure messaging is required for the
* MF (which is the case with the GPK) */ * MF (which is the case with the GPK) */
app = (struct sc_app_info *) calloc(1, sizeof(*app)); app = (sc_app_info_t *) calloc(1, sizeof(*app));
if (app == NULL) if (app == NULL)
return SC_ERROR_OUT_OF_MEMORY; return SC_ERROR_OUT_OF_MEMORY;
app->path = p15spec->file_app->path; app->path = p15spec->file_app->path;
@ -1180,7 +1180,7 @@ sc_pkcs15init_store_private_key(struct sc_pkcs15_card *p15card,
} }
} else { } else {
sc_pkcs15_der_t encoded, wrapped, *der = &encoded; sc_pkcs15_der_t encoded, wrapped, *der = &encoded;
struct sc_context *ctx = p15card->card->ctx; sc_context_t *ctx = p15card->card->ctx;
/* DER encode the private key */ /* DER encode the private key */
encoded.value = wrapped.value = NULL; encoded.value = wrapped.value = NULL;
@ -1553,7 +1553,7 @@ sc_pkcs15init_store_data(struct sc_pkcs15_card *p15card,
struct sc_profile *profile, struct sc_profile *profile,
sc_pkcs15_object_t *object, sc_pkcs15_id_t *id, sc_pkcs15_object_t *object, sc_pkcs15_id_t *id,
sc_pkcs15_der_t *data, sc_pkcs15_der_t *data,
struct sc_path *path) sc_path_t *path)
{ {
struct sc_file *file = NULL; struct sc_file *file = NULL;
int r; int r;
@ -1672,7 +1672,7 @@ __check_key_compatibility(struct sc_pkcs15_card *p15card,
unsigned int key_length, unsigned int key_length,
unsigned int flags) unsigned int flags)
{ {
struct sc_algorithm_info *info; sc_algorithm_info_t *info;
unsigned int count; unsigned int count;
int bad_usage = 0; int bad_usage = 0;
@ -2033,9 +2033,9 @@ select_object_path(sc_pkcs15_card_t *p15card, sc_profile_t *profile,
static int static int
sc_pkcs15init_update_dir(struct sc_pkcs15_card *p15card, sc_pkcs15init_update_dir(struct sc_pkcs15_card *p15card,
struct sc_profile *profile, struct sc_profile *profile,
struct sc_app_info *app) sc_app_info_t *app)
{ {
struct sc_card *card = p15card->card; sc_card_t *card = p15card->card;
int r, retry = 1; int r, retry = 1;
do { do {
@ -2541,7 +2541,7 @@ found: if (type == SC_AC_CHV) {
} }
static int static int
do_verify_pin(struct sc_profile *pro, struct sc_card *card, sc_file_t *file, do_verify_pin(struct sc_profile *pro, sc_card_t *card, sc_file_t *file,
unsigned int type, unsigned int reference) unsigned int type, unsigned int reference)
{ {
size_t pinsize; size_t pinsize;
@ -2561,7 +2561,7 @@ sc_pkcs15init_set_secret(struct sc_profile *pro,
} }
int int
sc_pkcs15init_verify_key(struct sc_profile *pro, struct sc_card *card, sc_pkcs15init_verify_key(struct sc_profile *pro, sc_card_t *card,
sc_file_t *file, unsigned int type, unsigned int reference) sc_file_t *file, unsigned int type, unsigned int reference)
{ {
size_t keysize; size_t keysize;
@ -2660,10 +2660,10 @@ set_user_pin_from_authid(struct sc_pkcs15_card *p15card,
* access conditions in their response to SELECT FILE) * access conditions in their response to SELECT FILE)
*/ */
int int
sc_pkcs15init_authenticate(struct sc_profile *pro, struct sc_card *card, sc_pkcs15init_authenticate(struct sc_profile *pro, sc_card_t *card,
struct sc_file *file, int op) sc_file_t *file, int op)
{ {
const struct sc_acl_entry *acl; const sc_acl_entry_t *acl;
int r = 0; int r = 0;
sc_debug(card->ctx, "path=%s, op=%u\n", sc_debug(card->ctx, "path=%s, op=%u\n",
@ -2685,8 +2685,8 @@ sc_pkcs15init_authenticate(struct sc_profile *pro, struct sc_card *card,
} }
int int
do_select_parent(struct sc_profile *pro, struct sc_card *card, do_select_parent(struct sc_profile *pro, sc_card_t *card,
struct sc_file *file, struct sc_file **parent) sc_file_t *file, sc_file_t **parent)
{ {
struct sc_path path; struct sc_path path;
int r; int r;
@ -2729,8 +2729,8 @@ do_select_parent(struct sc_profile *pro, struct sc_card *card,
} }
int int
sc_pkcs15init_create_file(struct sc_profile *pro, struct sc_card *card, sc_pkcs15init_create_file(struct sc_profile *pro, sc_card_t *card,
struct sc_file *file) sc_file_t *file)
{ {
struct sc_file *parent = NULL; struct sc_file *parent = NULL;
int r; int r;
@ -2753,8 +2753,8 @@ out: if (parent)
} }
int int
sc_pkcs15init_update_file(struct sc_profile *profile, struct sc_card *card, sc_pkcs15init_update_file(struct sc_profile *profile, sc_card_t *card,
struct sc_file *file, void *data, unsigned int datalen) sc_file_t *file, void *data, unsigned int datalen)
{ {
struct sc_file *info = NULL; struct sc_file *info = NULL;
void *copy = NULL; void *copy = NULL;
@ -2815,7 +2815,7 @@ sc_pkcs15init_update_file(struct sc_profile *profile, struct sc_card *card,
* Fix up all file ACLs * Fix up all file ACLs
*/ */
int int
sc_pkcs15init_fixup_file(struct sc_profile *profile, struct sc_file *file) sc_pkcs15init_fixup_file(struct sc_profile *profile, sc_file_t *file)
{ {
sc_context_t *ctx = profile->card->ctx; sc_context_t *ctx = profile->card->ctx;
sc_acl_entry_t so_acl, user_acl; sc_acl_entry_t so_acl, user_acl;
@ -2826,7 +2826,7 @@ sc_pkcs15init_fixup_file(struct sc_profile *profile, struct sc_file *file)
* are still any symbolic references. * are still any symbolic references.
*/ */
for (op = 0; op < SC_MAX_AC_OPS; op++) { for (op = 0; op < SC_MAX_AC_OPS; op++) {
const struct sc_acl_entry *acl; const sc_acl_entry_t *acl;
acl = sc_file_get_acl_entry(file, op); acl = sc_file_get_acl_entry(file, op);
for (; acl; acl = acl->next) { for (; acl; acl = acl->next) {
@ -2876,17 +2876,17 @@ sc_pkcs15init_fixup_file(struct sc_profile *profile, struct sc_file *file)
* PIN name with the real reference. * PIN name with the real reference.
*/ */
int int
sc_pkcs15init_fixup_acls(struct sc_profile *profile, struct sc_file *file, sc_pkcs15init_fixup_acls(struct sc_profile *profile, sc_file_t *file,
struct sc_acl_entry *so_acl, sc_acl_entry_t *so_acl,
struct sc_acl_entry *user_acl) sc_acl_entry_t *user_acl)
{ {
sc_card_t *card = profile->card; sc_card_t *card = profile->card;
struct sc_acl_entry acls[16]; sc_acl_entry_t acls[16];
unsigned int op, num; unsigned int op, num;
int r = 0; int r = 0;
for (op = 0; r == 0 && op < SC_MAX_AC_OPS; op++) { for (op = 0; r == 0 && op < SC_MAX_AC_OPS; op++) {
const struct sc_acl_entry *acl; const sc_acl_entry_t *acl;
const char *what; const char *what;
int added = 0; int added = 0;

View File

@ -32,7 +32,7 @@
/* /*
* Initialize the Application DF * Initialize the Application DF
*/ */
static int miocos_init_app(struct sc_profile *profile, struct sc_card *card, static int miocos_init_app(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_pin_info *pin_info, struct sc_pkcs15_pin_info *pin_info,
const u8 *pin, size_t pin_len, const u8 *puk, size_t puk_len) const u8 *pin, size_t pin_len, const u8 *puk, size_t puk_len)
{ {
@ -47,7 +47,7 @@ static int miocos_init_app(struct sc_profile *profile, struct sc_card *card,
* Store a PIN * Store a PIN
*/ */
static int static int
miocos_new_pin(struct sc_profile *profile, struct sc_card *card, miocos_new_pin(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_pin_info *info, unsigned int idx, struct sc_pkcs15_pin_info *info, unsigned int idx,
const u8 *pin, size_t pin_len, const u8 *pin, size_t pin_len,
const u8 *puk, size_t puk_len) const u8 *puk, size_t puk_len)
@ -83,9 +83,9 @@ miocos_new_pin(struct sc_profile *profile, struct sc_card *card,
* Allocate a file * Allocate a file
*/ */
static int static int
miocos_new_file(struct sc_profile *profile, struct sc_card *card, miocos_new_file(struct sc_profile *profile, sc_card_t *card,
unsigned int type, unsigned int num, unsigned int type, unsigned int num,
struct sc_file **out) sc_file_t **out)
{ {
struct sc_file *file; struct sc_file *file;
struct sc_path *p; struct sc_path *p;
@ -149,7 +149,7 @@ miocos_new_file(struct sc_profile *profile, struct sc_card *card,
} }
static int static int
miocos_update_private_key(struct sc_profile *profile, struct sc_card *card, miocos_update_private_key(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_prkey_rsa *rsa) struct sc_pkcs15_prkey_rsa *rsa)
{ {
int r; int r;
@ -168,7 +168,7 @@ miocos_update_private_key(struct sc_profile *profile, struct sc_card *card,
* Store a private key * Store a private key
*/ */
static int static int
miocos_new_key(struct sc_profile *profile, struct sc_card *card, miocos_new_key(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_prkey *key, unsigned int idx, struct sc_pkcs15_prkey *key, unsigned int idx,
struct sc_pkcs15_prkey_info *info) struct sc_pkcs15_prkey_info *info)
{ {

View File

@ -67,18 +67,18 @@
#define COSM_TYPE_PRKEY_RSA (SC_DEVICE_SPECIFIC_TYPE | SC_PKCS15_TYPE_PRKEY_RSA) #define COSM_TYPE_PRKEY_RSA (SC_DEVICE_SPECIFIC_TYPE | SC_PKCS15_TYPE_PRKEY_RSA)
#define COSM_TYPE_PUBKEY_RSA (SC_DEVICE_SPECIFIC_TYPE | SC_PKCS15_TYPE_PUBKEY_RSA) #define COSM_TYPE_PUBKEY_RSA (SC_DEVICE_SPECIFIC_TYPE | SC_PKCS15_TYPE_PUBKEY_RSA)
static int cosm_update_pin(struct sc_profile *profile, struct sc_card *card, static int cosm_update_pin(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_pin_info *info, const u8 *pin, size_t pin_len, struct sc_pkcs15_pin_info *info, const u8 *pin, size_t pin_len,
const u8 *puk, size_t puk_len); const u8 *puk, size_t puk_len);
int cosm_delete_file(struct sc_card *card, struct sc_profile *profile, int cosm_delete_file(sc_card_t *card, struct sc_profile *profile,
struct sc_file *df); sc_file_t *df);
int cosm_delete_file(struct sc_card *card, struct sc_profile *profile, int cosm_delete_file(sc_card_t *card, struct sc_profile *profile,
struct sc_file *df) sc_file_t *df)
{ {
struct sc_path path; sc_path_t path;
struct sc_file *parent; sc_file_t *parent;
int rv = 0; int rv = 0;
sc_debug(card->ctx, " id %04X\n", df->id); sc_debug(card->ctx, " id %04X\n", df->id);
@ -119,9 +119,9 @@ done:
/* /*
* Erase the card * Erase the card
*/ */
static int cosm_erase_card(struct sc_profile *profile, struct sc_card *card) static int cosm_erase_card(struct sc_profile *profile, sc_card_t *card)
{ {
struct sc_file *df = profile->df_info->file, *dir; sc_file_t *df = profile->df_info->file, *dir;
int r; int r;
/* Delete EF(DIR). This may not be very nice /* Delete EF(DIR). This may not be very nice
@ -180,13 +180,13 @@ done:
* Initialize the Application DF * Initialize the Application DF
*/ */
static int static int
cosm_init_app(struct sc_profile *profile, struct sc_card *card, cosm_init_app(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_pin_info *pinfo, struct sc_pkcs15_pin_info *pinfo,
const u8 *pin, size_t pin_len, const u8 *pin, size_t pin_len,
const u8 *puk, size_t puk_len) const u8 *puk, size_t puk_len)
{ {
int r; int r;
struct sc_file *file = NULL; sc_file_t *file = NULL;
sc_debug(card->ctx, "pin_len %i; puk_len %i\n", pin_len, puk_len); sc_debug(card->ctx, "pin_len %i; puk_len %i\n", pin_len, puk_len);
/* Create the application DF */ /* Create the application DF */
@ -233,7 +233,7 @@ cosm_init_app(struct sc_profile *profile, struct sc_card *card,
return 0; return 0;
} }
static int cosm_create_reference_data(struct sc_profile *profile, struct sc_card *card, static int cosm_create_reference_data(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_pin_info *pinfo, struct sc_pkcs15_pin_info *pinfo,
const u8 *pin, size_t pin_len, const u8 *puk, size_t puk_len ) const u8 *pin, size_t pin_len, const u8 *puk, size_t puk_len )
{ {
@ -310,7 +310,7 @@ done:
/* /*
* Update PIN * Update PIN
*/ */
static int cosm_update_pin(struct sc_profile *profile, struct sc_card *card, static int cosm_update_pin(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_pin_info *pinfo, const u8 *pin, size_t pin_len, struct sc_pkcs15_pin_info *pinfo, const u8 *pin, size_t pin_len,
const u8 *puk, size_t puk_len ) const u8 *puk, size_t puk_len )
{ {
@ -426,8 +426,8 @@ cosm_create_pin(sc_profile_t *profile, sc_card_t *card, sc_file_t *df,
* Allocate a file * Allocate a file
*/ */
static int static int
cosm_new_file(struct sc_profile *profile, struct sc_card *card, cosm_new_file(struct sc_profile *profile, sc_card_t *card,
unsigned int type, unsigned int num, struct sc_file **out) unsigned int type, unsigned int num, sc_file_t **out)
{ {
struct sc_file *file; struct sc_file *file;
const char *_template = NULL, *desc = NULL; const char *_template = NULL, *desc = NULL;
@ -503,7 +503,7 @@ cosm_new_file(struct sc_profile *profile, struct sc_card *card,
* RSA key generation * RSA key generation
*/ */
static int static int
cosm_old_generate_key(struct sc_profile *profile, struct sc_card *card, cosm_old_generate_key(struct sc_profile *profile, sc_card_t *card,
unsigned int idx, unsigned int keybits, unsigned int idx, unsigned int keybits,
sc_pkcs15_pubkey_t *pubkey, sc_pkcs15_pubkey_t *pubkey,
struct sc_pkcs15_prkey_info *info) struct sc_pkcs15_prkey_info *info)
@ -608,11 +608,11 @@ failed:
* Store a private key * Store a private key
*/ */
static int static int
cosm_new_key(struct sc_profile *profile, struct sc_card *card, cosm_new_key(struct sc_profile *profile, sc_card_t *card,
struct sc_pkcs15_prkey *key, unsigned int idx, struct sc_pkcs15_prkey *key, unsigned int idx,
struct sc_pkcs15_prkey_info *info) struct sc_pkcs15_prkey_info *info)
{ {
struct sc_file *prvfile = NULL, *pubfile = NULL; sc_file_t *prvfile = NULL, *pubfile = NULL;
struct sc_pkcs15_prkey_rsa *rsa = NULL; struct sc_pkcs15_prkey_rsa *rsa = NULL;
struct sc_pkcs15_bignum bn[6]; struct sc_pkcs15_bignum bn[6];
u8 *buff; u8 *buff;

View File

@ -44,7 +44,7 @@
static int starcos_finalize_card(sc_card_t *card); static int starcos_finalize_card(sc_card_t *card);
static int starcos_erase_card(struct sc_profile *pro, struct sc_card *card) static int starcos_erase_card(struct sc_profile *pro, sc_card_t *card)
{ {
return sc_card_ctl(card, SC_CARDCTL_ERASE_CARD, NULL); return sc_card_ctl(card, SC_CARDCTL_ERASE_CARD, NULL);
} }

View File

@ -209,7 +209,7 @@ static file_info * sc_profile_find_file(struct sc_profile *,
const sc_path_t *, const char *); const sc_path_t *, const char *);
static file_info * sc_profile_find_file_by_path( static file_info * sc_profile_find_file_by_path(
struct sc_profile *, struct sc_profile *,
const struct sc_path *); const sc_path_t *);
static pin_info * new_pin(struct sc_profile *, unsigned int); static pin_info * new_pin(struct sc_profile *, unsigned int);
static file_info * new_file(struct state *, const char *, static file_info * new_file(struct state *, const char *,
@ -225,7 +225,7 @@ static void set_pin_defaults(struct sc_profile *,
static void new_macro(sc_profile_t *, const char *, scconf_list *); static void new_macro(sc_profile_t *, const char *, scconf_list *);
static sc_macro_t * find_macro(sc_profile_t *, const char *); static sc_macro_t * find_macro(sc_profile_t *, const char *);
static struct sc_file * static sc_file_t *
init_file(unsigned int type) init_file(unsigned int type)
{ {
struct sc_file *file; struct sc_file *file;
@ -502,7 +502,7 @@ sc_profile_get_file_in(sc_profile_t *profile,
int int
sc_profile_get_file(struct sc_profile *profile, sc_profile_get_file(struct sc_profile *profile,
const char *name, struct sc_file **ret) const char *name, sc_file_t **ret)
{ {
struct file_info *fi; struct file_info *fi;
@ -514,7 +514,7 @@ sc_profile_get_file(struct sc_profile *profile,
int int
sc_profile_get_path(struct sc_profile *profile, sc_profile_get_path(struct sc_profile *profile,
const char *name, struct sc_path *ret) const char *name, sc_path_t *ret)
{ {
struct file_info *fi; struct file_info *fi;
@ -526,7 +526,7 @@ sc_profile_get_path(struct sc_profile *profile,
int int
sc_profile_get_file_by_path(struct sc_profile *profile, sc_profile_get_file_by_path(struct sc_profile *profile,
const struct sc_path *path, struct sc_file **ret) const sc_path_t *path, sc_file_t **ret)
{ {
struct file_info *fi; struct file_info *fi;
@ -1178,7 +1178,7 @@ do_acl(struct state *cur, int argc, char **argv)
sc_file_add_acl_entry(file, op, method, id); sc_file_add_acl_entry(file, op, method, id);
} }
} else { } else {
const struct sc_acl_entry *acl; const sc_acl_entry_t *acl;
if (map_str2int(cur, oper, &op, fileOpNames)) if (map_str2int(cur, oper, &op, fileOpNames))
goto bad; goto bad;
@ -1699,7 +1699,7 @@ sc_profile_find_file(struct sc_profile *pro,
} }
struct file_info * struct file_info *
sc_profile_find_file_by_path(struct sc_profile *pro, const struct sc_path *path) sc_profile_find_file_by_path(struct sc_profile *pro, const sc_path_t *path)
{ {
struct file_info *fi; struct file_info *fi;
struct sc_file *fp; struct sc_file *fp;

View File

@ -44,8 +44,8 @@ static const char *eid_path = ".eid";
static const char *auth_cert_file = "authorized_certificates"; static const char *auth_cert_file = "authorized_certificates";
typedef struct _scam_method_data { typedef struct _scam_method_data {
struct sc_context *ctx; sc_context_t *ctx;
struct sc_card *card; sc_card_t *card;
struct sc_pkcs15_card *p15card; struct sc_pkcs15_card *p15card;
int card_locked; int card_locked;

View File

@ -43,8 +43,8 @@
#include "scam.h" #include "scam.h"
typedef struct _scam_method_data { typedef struct _scam_method_data {
struct sc_context *ctx; sc_context_t *ctx;
struct sc_card *card; sc_card_t *card;
struct sc_pkcs15_card *p15card; struct sc_pkcs15_card *p15card;
int card_locked; int card_locked;

View File

@ -16,8 +16,8 @@
#include <opensc/opensc.h> #include <opensc/opensc.h>
#include "sc-test.h" #include "sc-test.h"
struct sc_context *ctx; sc_context_t *ctx;
struct sc_card *card; sc_card_t *card;
const struct option options[] = { const struct option options[] = {
{ "reader", 1, 0, 'r' }, { "reader", 1, 0, 'r' },

View File

@ -54,12 +54,12 @@ const char *option_help[] = {
"Verbose operation. Use several times to enable debug output.", "Verbose operation. Use several times to enable debug output.",
}; };
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
struct sc_card *card = NULL; sc_card_t *card = NULL;
int cardos_info(void) int cardos_info(void)
{ {
struct sc_apdu apdu; sc_apdu_t apdu;
u8 rbuf[SC_MAX_APDU_BUFFER_SIZE]; u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
int r; int r;

View File

@ -78,8 +78,8 @@ const char *option_help[] = {
"Verbose operation. Use several times to enable debug output.", "Verbose operation. Use several times to enable debug output.",
}; };
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
struct sc_card *card = NULL; sc_card_t *card = NULL;
static char *getpin(const char *prompt) static char *getpin(const char *prompt)
{ {
@ -134,8 +134,8 @@ static int verify_pin(int pin)
static int select_app_df(void) static int select_app_df(void)
{ {
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
char str[80]; char str[80];
int r; int r;
@ -332,8 +332,8 @@ static int parse_private_key(const u8 *key, size_t keysize, RSA *rsa)
static int read_public_key(RSA *rsa) static int read_public_key(RSA *rsa)
{ {
int r; int r;
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
u8 buf[2048], *p = buf; u8 buf[2048], *p = buf;
size_t bufsize, keysize; size_t bufsize, keysize;
@ -378,9 +378,9 @@ static int read_public_key(RSA *rsa)
static int read_private_key(RSA *rsa) static int read_private_key(RSA *rsa)
{ {
int r; int r;
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
const struct sc_acl_entry *e; const sc_acl_entry_t *e;
u8 buf[2048], *p = buf; u8 buf[2048], *p = buf;
size_t bufsize, keysize; size_t bufsize, keysize;
@ -473,7 +473,7 @@ static int read_key(void)
static int list_keys(void) static int list_keys(void)
{ {
int r, idx = 0; int r, idx = 0;
struct sc_path path; sc_path_t path;
u8 buf[2048], *p = buf; u8 buf[2048], *p = buf;
size_t keysize, i; size_t keysize, i;
int mod_lens[] = { 512, 768, 1024, 2048 }; int mod_lens[] = { 512, 768, 1024, 2048 };
@ -513,7 +513,7 @@ static int list_keys(void)
static int generate_key(void) static int generate_key(void)
{ {
struct sc_apdu apdu; sc_apdu_t apdu;
u8 sbuf[4]; u8 sbuf[4];
u8 p2; u8 p2;
int r; int r;
@ -570,7 +570,7 @@ static int generate_key(void)
static int create_key_files(void) static int create_key_files(void)
{ {
struct sc_file *file; sc_file_t *file;
int mod_lens[] = { 512, 768, 1024, 2048 }; int mod_lens[] = { 512, 768, 1024, 2048 };
int sizes[] = { 163, 243, 323, 643 }; int sizes[] = { 163, 243, 323, 643 };
int size = -1; int size = -1;
@ -793,7 +793,7 @@ static int encode_public_key(RSA *rsa, u8 *key, size_t *keysize)
static int update_public_key(const u8 *key, size_t keysize) static int update_public_key(const u8 *key, size_t keysize)
{ {
int r, idx = 0; int r, idx = 0;
struct sc_path path; sc_path_t path;
r = select_app_df(); r = select_app_df();
if (r) if (r)
@ -816,7 +816,7 @@ static int update_public_key(const u8 *key, size_t keysize)
static int update_private_key(const u8 *key, size_t keysize) static int update_private_key(const u8 *key, size_t keysize)
{ {
int r, idx = 0; int r, idx = 0;
struct sc_path path; sc_path_t path;
r = select_app_df(); r = select_app_df();
if (r) if (r)
@ -872,9 +872,9 @@ static int store_key(void)
} }
#if 0 #if 0
static int create_file(struct sc_file *file) static int create_file(sc_file_t *file)
{ {
struct sc_path path; sc_path_t path;
int r; int r;
path = file->path; path = file->path;
@ -905,9 +905,9 @@ static int create_file(struct sc_file *file)
#endif #endif
#if 0 #if 0
static int create_app_df(struct sc_path *path, size_t size) static int create_app_df(sc_path_t *path, size_t size)
{ {
struct sc_file *file; sc_file_t *file;
int i; int i;
file = sc_file_new(); file = sc_file_new();
@ -930,12 +930,12 @@ static int create_app_df(struct sc_path *path, size_t size)
} }
#endif #endif
static int create_pin_file(const struct sc_path *inpath, int chv, const char *key_id) static int create_pin_file(const sc_path_t *inpath, int chv, const char *key_id)
{ {
char prompt[40], *pin, *puk; char prompt[40], *pin, *puk;
char buf[30], *p = buf; char buf[30], *p = buf;
struct sc_path file_id, path; sc_path_t file_id, path;
struct sc_file *file; sc_file_t *file;
size_t len; size_t len;
int r; int r;
@ -1050,7 +1050,7 @@ static int create_pin_file(const struct sc_path *inpath, int chv, const char *ke
static int create_pin() static int create_pin()
{ {
struct sc_path path; sc_path_t path;
char buf[80]; char buf[80];
if (opt_pin_num != 1 && opt_pin_num != 2) { if (opt_pin_num != 1 && opt_pin_num != 2) {

View File

@ -130,10 +130,10 @@ static void decode_options(int argc, char **argv)
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
sc_reader_t *reader = NULL; sc_reader_t *reader = NULL;
struct sc_card *card = NULL; sc_card_t *card = NULL;
struct sc_path path; sc_path_t path;
int r, i; int r, i;
char buff[512]; char buff[512];

View File

@ -40,10 +40,10 @@ const char *app_name = "opensc-explorer";
int opt_reader = -1, opt_wait = 0, verbose = 0; int opt_reader = -1, opt_wait = 0, verbose = 0;
const char *opt_driver = NULL; const char *opt_driver = NULL;
struct sc_file *current_file = NULL; sc_file_t *current_file = NULL;
struct sc_path current_path; sc_path_t current_path;
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
struct sc_card *card = NULL; sc_card_t *card = NULL;
const struct option options[] = { const struct option options[] = {
{ "reader", 1, 0, 'r' }, { "reader", 1, 0, 'r' },
@ -110,14 +110,14 @@ ambiguous_match(struct command *table, const char *cmd)
return last_match; return last_match;
} }
static void check_ret(int r, int op, const char *err, const struct sc_file *file) static void check_ret(int r, int op, const char *err, const sc_file_t *file)
{ {
fprintf(stderr, "%s: %s\n", err, sc_strerror(r)); fprintf(stderr, "%s: %s\n", err, sc_strerror(r));
if (r == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) if (r == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED)
fprintf(stderr, "ACL for operation: %s\n", acl_to_str(sc_file_get_acl_entry(file, op))); fprintf(stderr, "ACL for operation: %s\n", acl_to_str(sc_file_get_acl_entry(file, op)));
} }
static int arg_to_path(const char *arg, struct sc_path *path, int is_id) static int arg_to_path(const char *arg, sc_path_t *path, int is_id)
{ {
int buf[2]; int buf[2];
u8 cbuf[2]; u8 cbuf[2];
@ -147,7 +147,7 @@ static int arg_to_path(const char *arg, struct sc_path *path, int is_id)
return 0; return 0;
} }
static void print_file(const struct sc_file *file) static void print_file(const sc_file_t *file)
{ {
const char *st; const char *st;
@ -199,8 +199,8 @@ static int do_ls(int argc, char **argv)
count = r; count = r;
printf("FileID\tType Size\n"); printf("FileID\tType Size\n");
while (count >= 2) { while (count >= 2) {
struct sc_path path; sc_path_t path;
struct sc_file *file = NULL; sc_file_t *file = NULL;
path = current_path; path = current_path;
sc_append_path_id(&path, cur, 2); sc_append_path_id(&path, cur, 2);
@ -228,8 +228,8 @@ usage:
static int do_cd(int argc, char **argv) static int do_cd(int argc, char **argv)
{ {
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
int r; int r;
if (argc != 1) if (argc != 1)
@ -279,7 +279,7 @@ usage:
return -1; return -1;
} }
static int read_and_print_binary_file(struct sc_file *file) static int read_and_print_binary_file(sc_file_t *file)
{ {
unsigned int idx = 0; unsigned int idx = 0;
u8 buf[128]; u8 buf[128];
@ -308,7 +308,7 @@ static int read_and_print_binary_file(struct sc_file *file)
return 0; return 0;
} }
static int read_and_print_record_file(struct sc_file *file) static int read_and_print_record_file(sc_file_t *file)
{ {
u8 buf[256]; u8 buf[256];
int rec, r; int rec, r;
@ -329,8 +329,8 @@ static int read_and_print_record_file(struct sc_file *file)
static int do_cat(int argc, char **argv) static int do_cat(int argc, char **argv)
{ {
int r, err = 0; int r, err = 0;
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
int not_current = 1; int not_current = 1;
if (argc > 1) if (argc > 1)
@ -374,8 +374,8 @@ usage:
static int do_info(int argc, char **argv) static int do_info(int argc, char **argv)
{ {
struct sc_file *file; sc_file_t *file;
struct sc_path path; sc_path_t path;
size_t i; size_t i;
const char *st; const char *st;
int r, not_current = 1; int r, not_current = 1;
@ -480,7 +480,7 @@ usage:
return -1; return -1;
} }
static int create_file(struct sc_file *file) static int create_file(sc_file_t *file)
{ {
int r; int r;
@ -501,8 +501,8 @@ static int create_file(struct sc_file *file)
static int do_create(int argc, char **argv) static int do_create(int argc, char **argv)
{ {
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
unsigned int size; unsigned int size;
int r, op; int r, op;
@ -532,8 +532,8 @@ static int do_create(int argc, char **argv)
static int do_mkdir(int argc, char **argv) static int do_mkdir(int argc, char **argv)
{ {
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
unsigned int size; unsigned int size;
int r, op; int r, op;
@ -561,7 +561,7 @@ static int do_mkdir(int argc, char **argv)
static int do_delete(int argc, char **argv) static int do_delete(int argc, char **argv)
{ {
struct sc_path path; sc_path_t path;
int r; int r;
if (argc != 1) if (argc != 1)
@ -812,8 +812,8 @@ static int do_get(int argc, char **argv)
int r, err = 0; int r, err = 0;
size_t count = 0; size_t count = 0;
unsigned int idx = 0; unsigned int idx = 0;
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
char fbuf[256], *filename; char fbuf[256], *filename;
FILE *outf = NULL; FILE *outf = NULL;
@ -926,8 +926,8 @@ static int do_update_binary(int argc, char **argv)
u8 buf[240]; u8 buf[240];
int r, err = 1, in_len; int r, err = 1, in_len;
int offs; int offs;
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
char *in_str; char *in_str;
if (argc < 2 || argc > 3) if (argc < 2 || argc > 3)
@ -988,8 +988,8 @@ static int do_update_record(int argc, char **argv)
u8 buf[240]; u8 buf[240];
int r, i, err = 1; int r, i, err = 1;
int rec, offs; int rec, offs;
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
char *in_str; char *in_str;
if (argc < 3 || argc > 4) if (argc < 3 || argc > 4)
@ -1058,8 +1058,8 @@ static int do_put(int argc, char **argv)
int r, err = 0; int r, err = 0;
size_t count = 0; size_t count = 0;
unsigned int idx = 0; unsigned int idx = 0;
struct sc_path path; sc_path_t path;
struct sc_file *file; sc_file_t *file;
const char *filename; const char *filename;
FILE *outf = NULL; FILE *outf = NULL;
@ -1160,7 +1160,7 @@ static int do_pksign(int argc, char **argv)
size_t indatalen = sizeof indata; size_t indatalen = sizeof indata;
u8 outdata[128]; u8 outdata[128];
size_t outdatalen = sizeof outdata; size_t outdatalen = sizeof outdata;
struct sc_security_env senv; sc_security_env_t senv;
const u8 *oid; const u8 *oid;
int oidlen; int oidlen;
const char *s; const char *s;
@ -1254,7 +1254,7 @@ static int do_pkdecrypt(int argc, char **argv)
size_t indatalen = sizeof indata; size_t indatalen = sizeof indata;
u8 outdata[128]; u8 outdata[128];
size_t outdatalen = sizeof outdata; size_t outdatalen = sizeof outdata;
struct sc_security_env senv; sc_security_env_t senv;
const char *s; const char *s;
if (argc != 2) if (argc != 2)

View File

@ -77,8 +77,8 @@ const char *option_help[] = {
"Verbose operation. Use several times to enable debug output.", "Verbose operation. Use several times to enable debug output.",
}; };
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
struct sc_card *card = NULL; sc_card_t *card = NULL;
static int list_readers(void) static int list_readers(void)
{ {
@ -129,8 +129,8 @@ static int list_drivers(void)
return 0; return 0;
} }
static int print_file(struct sc_card *in_card, const struct sc_file *file, static int print_file(sc_card_t *in_card, const sc_file_t *file,
const struct sc_path *path, int depth) const sc_path_t *path, int depth)
{ {
int r; int r;
const char *tmps; const char *tmps;
@ -234,9 +234,9 @@ static int print_file(struct sc_card *in_card, const struct sc_file *file,
return 0; return 0;
} }
static int enum_dir(struct sc_path path, int depth) static int enum_dir(sc_path_t path, int depth)
{ {
struct sc_file *file; sc_file_t *file;
int r, file_type; int r, file_type;
u8 files[SC_MAX_APDU_BUFFER_SIZE]; u8 files[SC_MAX_APDU_BUFFER_SIZE];
@ -260,7 +260,7 @@ static int enum_dir(struct sc_path path, int depth)
printf("Empty directory\n"); printf("Empty directory\n");
} else } else
for (i = 0; i < r/2; i++) { for (i = 0; i < r/2; i++) {
struct sc_path tmppath; sc_path_t tmppath;
memcpy(&tmppath, &path, sizeof(path)); memcpy(&tmppath, &path, sizeof(path));
memcpy(tmppath.value + tmppath.len, files + 2*i, 2); memcpy(tmppath.value + tmppath.len, files + 2*i, 2);
@ -273,7 +273,7 @@ static int enum_dir(struct sc_path path, int depth)
static int list_files(void) static int list_files(void)
{ {
struct sc_path path; sc_path_t path;
int r; int r;
sc_format_path("3F00", &path); sc_format_path("3F00", &path);
@ -283,7 +283,7 @@ static int list_files(void)
static int send_apdu(void) static int send_apdu(void)
{ {
struct sc_apdu apdu; sc_apdu_t apdu;
u8 buf[SC_MAX_APDU_BUFFER_SIZE], sbuf[SC_MAX_APDU_BUFFER_SIZE], u8 buf[SC_MAX_APDU_BUFFER_SIZE], sbuf[SC_MAX_APDU_BUFFER_SIZE],
rbuf[SC_MAX_APDU_BUFFER_SIZE], *p; rbuf[SC_MAX_APDU_BUFFER_SIZE], *p;
size_t len, len0, r; size_t len, len0, r;
@ -358,7 +358,7 @@ static int send_apdu(void)
static void print_serial(sc_card_t *in_card) static void print_serial(sc_card_t *in_card)
{ {
int r; int r;
struct sc_serial_number serial; sc_serial_number_t serial;
r = sc_card_ctl(in_card, SC_CARDCTL_GET_SERIALNR, &serial); r = sc_card_ctl(in_card, SC_CARDCTL_GET_SERIALNR, &serial);
if (r) if (r)

View File

@ -83,8 +83,8 @@ const char *option_help[] = {
"Verbose operation. Use several times to enable debug output.", "Verbose operation. Use several times to enable debug output.",
}; };
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
struct sc_card *card = NULL; sc_card_t *card = NULL;
struct sc_pkcs15_card *p15card = NULL; struct sc_pkcs15_card *p15card = NULL;
static char * get_pin(struct sc_pkcs15_object *obj) static char * get_pin(struct sc_pkcs15_object *obj)

View File

@ -57,13 +57,13 @@
const char *app_name = "pkcs15-init"; const char *app_name = "pkcs15-init";
/* Handle encoding of PKCS15 on the card */ /* Handle encoding of PKCS15 on the card */
typedef int (*pkcs15_encoder)(struct sc_context *, typedef int (*pkcs15_encoder)(sc_context_t *,
struct sc_pkcs15_card *, u8 **, size_t *); struct sc_pkcs15_card *, u8 **, size_t *);
/* Local functions */ /* Local functions */
static int open_reader_and_card(int); static int open_reader_and_card(int);
static int do_assert_pristine(struct sc_card *); static int do_assert_pristine(sc_card_t *);
static int do_erase(struct sc_card *, struct sc_profile *); static int do_erase(sc_card_t *, struct sc_profile *);
static int do_init_app(struct sc_profile *); static int do_init_app(struct sc_profile *);
static int do_store_pin(struct sc_profile *); static int do_store_pin(struct sc_profile *);
static int do_generate_key(struct sc_profile *, const char *); static int do_generate_key(struct sc_profile *, const char *);
@ -74,7 +74,7 @@ static int do_convert_private_key(struct sc_pkcs15_prkey *, EVP_PKEY *);
static int do_convert_public_key(struct sc_pkcs15_pubkey *, EVP_PKEY *); static int do_convert_public_key(struct sc_pkcs15_pubkey *, EVP_PKEY *);
static int do_convert_cert(sc_pkcs15_der_t *, X509 *); static int do_convert_cert(sc_pkcs15_der_t *, X509 *);
static int is_cacert_already_present(struct sc_pkcs15init_certargs *); static int is_cacert_already_present(struct sc_pkcs15init_certargs *);
static int do_finalize_card(struct sc_card *, struct sc_profile *); static int do_finalize_card(sc_card_t *, struct sc_profile *);
static int do_read_data_object(const char *name, u8 **out, size_t *outlen); static int do_read_data_object(const char *name, u8 **out, size_t *outlen);
static int do_store_data_object(struct sc_profile *profile); static int do_store_data_object(struct sc_profile *profile);
@ -262,8 +262,8 @@ struct secret {
size_t len; size_t len;
}; };
static struct sc_context * ctx = NULL; static sc_context_t * ctx = NULL;
static struct sc_card * card = NULL; static sc_card_t * card = NULL;
static struct sc_pkcs15_card * p15card = NULL; static struct sc_pkcs15_card * p15card = NULL;
static unsigned int opt_actions; static unsigned int opt_actions;
static int opt_reader = -1, static int opt_reader = -1,
@ -458,7 +458,7 @@ open_reader_and_card(int reader)
* Make sure there's no pkcs15 structure on the card * Make sure there's no pkcs15 structure on the card
*/ */
static int static int
do_assert_pristine(struct sc_card *in_card) do_assert_pristine(sc_card_t *in_card)
{ {
sc_path_t path; sc_path_t path;
int r, res=0; int r, res=0;
@ -502,7 +502,7 @@ do_assert_pristine(struct sc_card *in_card)
* Erase card * Erase card
*/ */
static int static int
do_erase(struct sc_card *in_card, struct sc_profile *profile) do_erase(sc_card_t *in_card, struct sc_profile *profile)
{ {
int r; int r;
ignore_cmdline_pins++; ignore_cmdline_pins++;

View File

@ -56,7 +56,7 @@ enum {
#define NELEMENTS(x) (sizeof(x)/sizeof((x)[0])) #define NELEMENTS(x) (sizeof(x)/sizeof((x)[0]))
static int authenticate(sc_pkcs15_object_t *obj); static int authenticate(sc_pkcs15_object_t *obj);
static int pem_encode(struct sc_context *, int, static int pem_encode(sc_context_t *, int,
sc_pkcs15_der_t *, sc_pkcs15_der_t *); sc_pkcs15_der_t *, sc_pkcs15_der_t *);
const struct option options[] = { const struct option options[] = {
@ -106,8 +106,8 @@ const char *option_help[] = {
"Verbose operation. Use several times to enable debug output.", "Verbose operation. Use several times to enable debug output.",
}; };
struct sc_context *ctx = NULL; sc_context_t *ctx = NULL;
struct sc_card *card = NULL; sc_card_t *card = NULL;
struct sc_pkcs15_card *p15card = NULL; struct sc_pkcs15_card *p15card = NULL;
static void print_cert_info(const struct sc_pkcs15_object *obj) static void print_cert_info(const struct sc_pkcs15_object *obj)
@ -781,10 +781,10 @@ static int change_pin(void)
return 0; return 0;
} }
static int read_and_cache_file(const struct sc_path *path) static int read_and_cache_file(const sc_path_t *path)
{ {
struct sc_file *tfile; sc_file_t *tfile;
const struct sc_acl_entry *e; const sc_acl_entry_t *e;
u8 buf[16384]; u8 buf[16384];
int r; int r;
@ -1071,7 +1071,7 @@ static const struct sc_asn1_entry c_asn1_pem_key[] = {
}; };
static int static int
pem_encode(struct sc_context *ctx, pem_encode(sc_context_t *ctx,
int alg_id, sc_pkcs15_der_t *key, sc_pkcs15_der_t *out) int alg_id, sc_pkcs15_der_t *key, sc_pkcs15_der_t *out)
{ {
struct sc_asn1_entry asn1_pem_key[2], struct sc_asn1_entry asn1_pem_key[2],

View File

@ -15,7 +15,7 @@ int connect_card(sc_context_t *ctx, sc_card_t **cardp,
int r; int r;
if (wait) { if (wait) {
struct sc_reader *readers[16]; sc_reader_t *readers[16];
int slots[16]; int slots[16];
int i, j, k, found; int i, j, k, found;
unsigned int event; unsigned int event;
@ -188,7 +188,7 @@ void print_usage_and_die(void)
exit(2); exit(2);
} }
const char * acl_to_str(const struct sc_acl_entry *e) const char * acl_to_str(const sc_acl_entry_t *e)
{ {
static char line[80], buf[10]; static char line[80], buf[10];
unsigned int acl; unsigned int acl;