From eb4717ea177a02f2ad1e07bc205ce56ea933eb73 Mon Sep 17 00:00:00 2001 From: bert Date: Wed, 9 Mar 2005 00:04:44 +0000 Subject: [PATCH] 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 --- src/openscd/commands.c | 10 ++-- src/pkcs11/framework-pkcs15.c | 2 +- src/pkcs11/misc.c | 2 +- src/pkcs11/pkcs11-global.c | 4 +- src/pkcs11/pkcs11-spy.c | 2 +- src/pkcs15init/pkcs15-cflex.c | 8 ++-- src/pkcs15init/pkcs15-etoken.c | 10 ++-- src/pkcs15init/pkcs15-gpk.c | 34 +++++++------- src/pkcs15init/pkcs15-jcop.c | 4 +- src/pkcs15init/pkcs15-lib.c | 80 ++++++++++++++++---------------- src/pkcs15init/pkcs15-miocos.c | 12 ++--- src/pkcs15init/pkcs15-oberthur.c | 36 +++++++------- src/pkcs15init/pkcs15-starcos.c | 2 +- src/pkcs15init/profile.c | 14 +++--- src/scam/p15_eid.c | 4 +- src/scam/p15_ldap.c | 4 +- src/tests/sc-test.c | 4 +- src/tools/cardos-info.c | 6 +-- src/tools/cryptoflex-tool.c | 44 +++++++++--------- src/tools/eidenv.c | 6 +-- src/tools/opensc-explorer.c | 66 +++++++++++++------------- src/tools/opensc-tool.c | 20 ++++---- src/tools/pkcs15-crypt.c | 4 +- src/tools/pkcs15-init.c | 16 +++---- src/tools/pkcs15-tool.c | 14 +++--- src/tools/util.c | 4 +- 26 files changed, 206 insertions(+), 206 deletions(-) diff --git a/src/openscd/commands.c b/src/openscd/commands.c index 7ba7fab4..eaa3ed23 100644 --- a/src/openscd/commands.c +++ b/src/openscd/commands.c @@ -15,7 +15,7 @@ #include "openscd.h" static struct openscd_card * find_card(struct openscd_context *dctx, - struct sc_reader *reader, + sc_reader_t *reader, int slot_id) { 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, - struct sc_reader *reader, + sc_reader_t *reader, int slot_id) { int n = dctx->card_count; int r; - struct sc_card *card; + sc_card_t *card; struct sc_pkcs15_card *p15card; 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_context *dctx = targ->dctx; - struct sc_reader *reader = targ->reader; - struct sc_context *ctx = dctx->ctx; + sc_reader_t *reader = targ->reader; + sc_context_t *ctx = dctx->ctx; const int sleep_time = 200; int r; diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c index 9fc4e8a1..2dcce04d 100644 --- a/src/pkcs11/framework-pkcs15.c +++ b/src/pkcs11/framework-pkcs15.c @@ -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 *) session->slot->card->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; if (!out_data) diff --git a/src/pkcs11/misc.c b/src/pkcs11/misc.c index a2590336..abbfa016 100644 --- a/src/pkcs11/misc.c +++ b/src/pkcs11/misc.c @@ -308,7 +308,7 @@ CK_RV attr_find_var(CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, 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; int i; diff --git a/src/pkcs11/pkcs11-global.c b/src/pkcs11/pkcs11-global.c index 3acd3307..17742415 100644 --- a/src/pkcs11/pkcs11-global.c +++ b/src/pkcs11/pkcs11-global.c @@ -22,7 +22,7 @@ #include #include "sc-pkcs11.h" -struct sc_context *context = NULL; +sc_context_t *context = NULL; struct sc_pkcs11_pool session_pool; struct sc_pkcs11_slot virtual_slots[SC_PKCS11_MAX_VIRTUAL_SLOTS]; 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_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 i, j, k, r, found; unsigned int mask, events; diff --git a/src/pkcs11/pkcs11-spy.c b/src/pkcs11/pkcs11-spy.c index 74950c7a..20fedb12 100644 --- a/src/pkcs11/pkcs11-spy.c +++ b/src/pkcs11/pkcs11-spy.c @@ -52,7 +52,7 @@ static CK_RV init_spy(void) { const char *mspec = NULL, *file = NULL, *env = NULL; scconf_block *conf_block = NULL, **blocks; - struct sc_context *ctx = NULL; + sc_context_t *ctx = NULL; int rv = CKR_OK, r, i; /* Allocates and initializes the pkcs11_spy structure */ diff --git a/src/pkcs15init/pkcs15-cflex.c b/src/pkcs15init/pkcs15-cflex.c index b98d1160..f05d41a4 100644 --- a/src/pkcs15init/pkcs15-cflex.c +++ b/src/pkcs15init/pkcs15-cflex.c @@ -50,8 +50,8 @@ static int cflex_get_keyfiles(sc_profile_t *, sc_card_t *, static int cflex_delete_file(sc_profile_t *profile, sc_card_t *card, sc_file_t *df) { - struct sc_path path; - struct sc_file *parent; + sc_path_t path; + sc_file_t *parent; int r = 0; /* Select the parent DF */ 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 */ -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; /* Delete EF(DIR). This may not be very nice diff --git a/src/pkcs15init/pkcs15-etoken.c b/src/pkcs15init/pkcs15-etoken.c index c1c1267a..f2167404 100644 --- a/src/pkcs15init/pkcs15-etoken.c +++ b/src/pkcs15init/pkcs15-etoken.c @@ -60,7 +60,7 @@ static int etoken_store_pin(sc_profile_t *profile, sc_card_t *card, const u8 *pin, size_t pin_len); static int etoken_create_sec_env(sc_profile_t *, sc_card_t *, 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 *, struct sc_pkcs15_prkey_rsa *); static int etoken_key_algorithm(unsigned int, int *); @@ -124,7 +124,7 @@ tlv_len(struct tlv *tlv) * it's close enough to be useful. */ 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); } @@ -460,7 +460,7 @@ etoken_store_pin(sc_profile_t *profile, sc_card_t *card, * Create an empty security environment */ 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) { 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_FLAGS 0x00 static int -etoken_store_key_component(struct sc_card *card, +etoken_store_key_component(sc_card_t *card, int algorithm, unsigned int key_id, unsigned int pin_id, unsigned int num, @@ -608,7 +608,7 @@ etoken_put_key(sc_profile_t *profile, sc_card_t *card, * GENERATE KEY PAIR */ 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) { u8 buf[256]; diff --git a/src/pkcs15init/pkcs15-gpk.c b/src/pkcs15init/pkcs15-gpk.c index bde4478d..bb9728b8 100644 --- a/src/pkcs15init/pkcs15-gpk.c +++ b/src/pkcs15init/pkcs15-gpk.c @@ -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 *, struct sc_pkcs15_prkey_dsa *, struct pkdata *, struct sc_pkcs15_prkey_info *); -static int gpk_store_pk(struct sc_profile *, struct sc_card *, - struct sc_file *, struct pkdata *); +static int gpk_store_pk(struct sc_profile *, sc_card_t *, + sc_file_t *, struct pkdata *); 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 *, 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 */ 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; @@ -253,7 +253,7 @@ gpk_create_pin(sc_profile_t *profile, sc_card_t *card, sc_file_t *df, * Lock a file operation */ 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; @@ -266,8 +266,8 @@ gpk_lock(struct sc_card *card, struct sc_file *file, unsigned int op) * Lock the pin file */ static int -gpk_lock_pinfile(struct sc_profile *profile, struct sc_card *card, - struct sc_file *pinfile) +gpk_lock_pinfile(struct sc_profile *profile, sc_card_t *card, + sc_file_t *pinfile) { struct sc_path path; struct sc_file *parent = NULL; @@ -295,10 +295,10 @@ gpk_lock_pinfile(struct sc_profile *profile, struct sc_card *card, * Initialize pin file */ static int -gpk_init_pinfile(struct sc_profile *profile, struct sc_card *card, - struct sc_file *file) +gpk_init_pinfile(struct sc_profile *profile, sc_card_t *card, + sc_file_t *file) { - const struct sc_acl_entry *acl; + const sc_acl_entry_t *acl; unsigned char buffer[GPK_MAX_PINS * 8], *blk; struct sc_file *pinfile; 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 usage) { - const struct sc_acl_entry *acl; + const sc_acl_entry_t *acl; sc_file_t *tmp = NULL; u8 sysrec[7], buffer[256]; unsigned int n, npins; @@ -715,7 +715,7 @@ out: if (tmp) static int 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; unsigned char buffer[256]; @@ -776,8 +776,8 @@ gpk_pkfile_update_public(struct sc_profile *profile, } static int -gpk_pkfile_init_private(struct sc_card *card, - struct sc_file *file, unsigned int privlen) +gpk_pkfile_init_private(sc_card_t *card, + sc_file_t *file, unsigned int privlen) { struct sc_cardctl_gpk_pkinit args; @@ -787,7 +787,7 @@ gpk_pkfile_init_private(struct sc_card *card, } 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) { struct sc_cardctl_gpk_pkload args; @@ -801,7 +801,7 @@ gpk_pkfile_load_private(struct sc_card *card, struct sc_file *file, static int 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) { unsigned int m, size, nb, cks; @@ -1038,8 +1038,8 @@ gpk_encode_dsa_key(sc_profile_t *profile, sc_card_t *card, } static int -gpk_store_pk(struct sc_profile *profile, struct sc_card *card, - struct sc_file *file, struct pkdata *p) +gpk_store_pk(struct sc_profile *profile, sc_card_t *card, + sc_file_t *file, struct pkdata *p) { size_t fsize; int r; diff --git a/src/pkcs15init/pkcs15-jcop.c b/src/pkcs15init/pkcs15-jcop.c index c685eb49..53c7ec8d 100644 --- a/src/pkcs15init/pkcs15-jcop.c +++ b/src/pkcs15init/pkcs15-jcop.c @@ -40,7 +40,7 @@ * Erase the card */ 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 */ 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; - struct sc_file *keyfile = NULL; + sc_file_t *keyfile = NULL; size_t bytes, mod_len, exp_len, prv_len, pub_len; int r; diff --git a/src/pkcs15init/pkcs15-lib.c b/src/pkcs15init/pkcs15-lib.c index d831b651..6ab09570 100644 --- a/src/pkcs15init/pkcs15-lib.c +++ b/src/pkcs15init/pkcs15-lib.c @@ -73,18 +73,18 @@ #define DEFAULT_DATA_FLAGS 0x02 /* 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 *); static int sc_pkcs15init_store_data(struct sc_pkcs15_card *, struct sc_profile *, sc_pkcs15_object_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 int sc_pkcs15init_update_dir(struct sc_pkcs15_card *, struct sc_profile *profile, - struct sc_app_info *app); + sc_app_info_t *app); static int sc_pkcs15init_update_tokeninfo(struct sc_pkcs15_card *, struct sc_profile *profile); 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 *); static int set_user_pin_from_authid(struct sc_pkcs15_card *, struct sc_profile *, struct sc_pkcs15_id *); -static int do_select_parent(struct sc_profile *, struct sc_card *, - struct sc_file *, struct sc_file **); +static int do_select_parent(struct sc_profile *, sc_card_t *, + sc_file_t *, sc_file_t **); static int sc_pkcs15init_create_pin(sc_pkcs15_card_t *, sc_profile_t *, sc_pkcs15_object_t *, struct sc_pkcs15init_pinargs *); 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. */ 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; scconf_block **blocks, *blk; int i; @@ -220,7 +220,7 @@ static const char *find_library(sc_context_t *ctx, const char *name) 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 *version, *libname; @@ -262,7 +262,7 @@ static void *load_dynamic_driver(struct sc_context *ctx, void **dll, * Set up profile */ 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, struct sc_profile **result) { @@ -366,7 +366,7 @@ sc_pkcs15init_set_lifecycle(sc_card_t *card, int lcycle) * Erase the card */ 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) return SC_ERROR_NOT_SUPPORTED; @@ -374,7 +374,7 @@ sc_pkcs15init_erase_card(struct sc_card *card, struct sc_profile *profile) } int -sc_pkcs15init_erase_card_recursively(struct sc_card *card, +sc_pkcs15init_erase_card_recursively(sc_card_t *card, struct sc_profile *profile, 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. */ int -sc_pkcs15init_rmdir(struct sc_card *card, struct sc_profile *profile, - struct sc_file *df) +sc_pkcs15init_rmdir(sc_card_t *card, struct sc_profile *profile, + sc_file_t *df) { u8 buffer[1024]; struct sc_path path; @@ -508,7 +508,7 @@ sc_pkcs15init_rmdir(struct sc_card *card, struct sc_profile *profile, } 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) 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 */ 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) { sc_pkcs15_card_t *p15spec = profile->p15_spec; sc_pkcs15_pin_info_t pin_info, puk_info; 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; 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 * doesn't work if secure messaging is required for the * 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) return SC_ERROR_OUT_OF_MEMORY; app->path = p15spec->file_app->path; @@ -1180,7 +1180,7 @@ sc_pkcs15init_store_private_key(struct sc_pkcs15_card *p15card, } } else { 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 */ encoded.value = wrapped.value = NULL; @@ -1553,7 +1553,7 @@ sc_pkcs15init_store_data(struct sc_pkcs15_card *p15card, struct sc_profile *profile, sc_pkcs15_object_t *object, sc_pkcs15_id_t *id, sc_pkcs15_der_t *data, - struct sc_path *path) + sc_path_t *path) { struct sc_file *file = NULL; int r; @@ -1672,7 +1672,7 @@ __check_key_compatibility(struct sc_pkcs15_card *p15card, unsigned int key_length, unsigned int flags) { - struct sc_algorithm_info *info; + sc_algorithm_info_t *info; unsigned int count; int bad_usage = 0; @@ -2033,9 +2033,9 @@ select_object_path(sc_pkcs15_card_t *p15card, sc_profile_t *profile, static int sc_pkcs15init_update_dir(struct sc_pkcs15_card *p15card, 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; do { @@ -2541,7 +2541,7 @@ found: if (type == SC_AC_CHV) { } 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) { size_t pinsize; @@ -2561,7 +2561,7 @@ sc_pkcs15init_set_secret(struct sc_profile *pro, } 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) { 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) */ int -sc_pkcs15init_authenticate(struct sc_profile *pro, struct sc_card *card, - struct sc_file *file, int op) +sc_pkcs15init_authenticate(struct sc_profile *pro, sc_card_t *card, + sc_file_t *file, int op) { - const struct sc_acl_entry *acl; + const sc_acl_entry_t *acl; int r = 0; 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 -do_select_parent(struct sc_profile *pro, struct sc_card *card, - struct sc_file *file, struct sc_file **parent) +do_select_parent(struct sc_profile *pro, sc_card_t *card, + sc_file_t *file, sc_file_t **parent) { struct sc_path path; int r; @@ -2729,8 +2729,8 @@ do_select_parent(struct sc_profile *pro, struct sc_card *card, } int -sc_pkcs15init_create_file(struct sc_profile *pro, struct sc_card *card, - struct sc_file *file) +sc_pkcs15init_create_file(struct sc_profile *pro, sc_card_t *card, + sc_file_t *file) { struct sc_file *parent = NULL; int r; @@ -2753,8 +2753,8 @@ out: if (parent) } int -sc_pkcs15init_update_file(struct sc_profile *profile, struct sc_card *card, - struct sc_file *file, void *data, unsigned int datalen) +sc_pkcs15init_update_file(struct sc_profile *profile, sc_card_t *card, + sc_file_t *file, void *data, unsigned int datalen) { struct sc_file *info = 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 */ 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_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. */ 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); 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. */ int -sc_pkcs15init_fixup_acls(struct sc_profile *profile, struct sc_file *file, - struct sc_acl_entry *so_acl, - struct sc_acl_entry *user_acl) +sc_pkcs15init_fixup_acls(struct sc_profile *profile, sc_file_t *file, + sc_acl_entry_t *so_acl, + sc_acl_entry_t *user_acl) { sc_card_t *card = profile->card; - struct sc_acl_entry acls[16]; + sc_acl_entry_t acls[16]; unsigned int op, num; int r = 0; 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; int added = 0; diff --git a/src/pkcs15init/pkcs15-miocos.c b/src/pkcs15init/pkcs15-miocos.c index e5d961bc..d50d39db 100644 --- a/src/pkcs15init/pkcs15-miocos.c +++ b/src/pkcs15init/pkcs15-miocos.c @@ -32,7 +32,7 @@ /* * 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, 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 */ 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, const u8 *pin, size_t pin_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 */ 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, - struct sc_file **out) + sc_file_t **out) { struct sc_file *file; struct sc_path *p; @@ -149,7 +149,7 @@ miocos_new_file(struct sc_profile *profile, struct sc_card *card, } 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) { int r; @@ -168,7 +168,7 @@ miocos_update_private_key(struct sc_profile *profile, struct sc_card *card, * Store a private key */ 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_info *info) { diff --git a/src/pkcs15init/pkcs15-oberthur.c b/src/pkcs15init/pkcs15-oberthur.c index 54888a57..f26b1d62 100644 --- a/src/pkcs15init/pkcs15-oberthur.c +++ b/src/pkcs15init/pkcs15-oberthur.c @@ -67,18 +67,18 @@ #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) -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, const u8 *puk, size_t puk_len); -int cosm_delete_file(struct sc_card *card, struct sc_profile *profile, - struct sc_file *df); +int cosm_delete_file(sc_card_t *card, struct sc_profile *profile, + sc_file_t *df); -int cosm_delete_file(struct sc_card *card, struct sc_profile *profile, - struct sc_file *df) +int cosm_delete_file(sc_card_t *card, struct sc_profile *profile, + sc_file_t *df) { - struct sc_path path; - struct sc_file *parent; + sc_path_t path; + sc_file_t *parent; int rv = 0; sc_debug(card->ctx, " id %04X\n", df->id); @@ -119,9 +119,9 @@ done: /* * 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; /* Delete EF(DIR). This may not be very nice @@ -180,13 +180,13 @@ done: * Initialize the Application DF */ 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, const u8 *pin, size_t pin_len, const u8 *puk, size_t puk_len) { 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); /* Create the application DF */ @@ -233,7 +233,7 @@ cosm_init_app(struct sc_profile *profile, struct sc_card *card, 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, const u8 *pin, size_t pin_len, const u8 *puk, size_t puk_len ) { @@ -310,7 +310,7 @@ done: /* * 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, 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 */ static int -cosm_new_file(struct sc_profile *profile, struct sc_card *card, - unsigned int type, unsigned int num, struct sc_file **out) +cosm_new_file(struct sc_profile *profile, sc_card_t *card, + unsigned int type, unsigned int num, sc_file_t **out) { struct sc_file *file; const char *_template = NULL, *desc = NULL; @@ -503,7 +503,7 @@ cosm_new_file(struct sc_profile *profile, struct sc_card *card, * RSA key generation */ 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, sc_pkcs15_pubkey_t *pubkey, struct sc_pkcs15_prkey_info *info) @@ -608,11 +608,11 @@ failed: * Store a private key */ 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_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_bignum bn[6]; u8 *buff; diff --git a/src/pkcs15init/pkcs15-starcos.c b/src/pkcs15init/pkcs15-starcos.c index da01d00e..c622f59d 100644 --- a/src/pkcs15init/pkcs15-starcos.c +++ b/src/pkcs15init/pkcs15-starcos.c @@ -44,7 +44,7 @@ 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); } diff --git a/src/pkcs15init/profile.c b/src/pkcs15init/profile.c index 07e5bb08..c7a7c4a8 100644 --- a/src/pkcs15init/profile.c +++ b/src/pkcs15init/profile.c @@ -209,7 +209,7 @@ static file_info * sc_profile_find_file(struct sc_profile *, const sc_path_t *, const char *); static file_info * sc_profile_find_file_by_path( struct sc_profile *, - const struct sc_path *); + const sc_path_t *); static pin_info * new_pin(struct sc_profile *, unsigned int); 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 sc_macro_t * find_macro(sc_profile_t *, const char *); -static struct sc_file * +static sc_file_t * init_file(unsigned int type) { struct sc_file *file; @@ -502,7 +502,7 @@ sc_profile_get_file_in(sc_profile_t *profile, int 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; @@ -514,7 +514,7 @@ sc_profile_get_file(struct sc_profile *profile, int 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; @@ -526,7 +526,7 @@ sc_profile_get_path(struct sc_profile *profile, int 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; @@ -1178,7 +1178,7 @@ do_acl(struct state *cur, int argc, char **argv) sc_file_add_acl_entry(file, op, method, id); } } else { - const struct sc_acl_entry *acl; + const sc_acl_entry_t *acl; if (map_str2int(cur, oper, &op, fileOpNames)) goto bad; @@ -1699,7 +1699,7 @@ sc_profile_find_file(struct sc_profile *pro, } 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 sc_file *fp; diff --git a/src/scam/p15_eid.c b/src/scam/p15_eid.c index a3ca1d90..53aeb3ae 100644 --- a/src/scam/p15_eid.c +++ b/src/scam/p15_eid.c @@ -44,8 +44,8 @@ static const char *eid_path = ".eid"; static const char *auth_cert_file = "authorized_certificates"; typedef struct _scam_method_data { - struct sc_context *ctx; - struct sc_card *card; + sc_context_t *ctx; + sc_card_t *card; struct sc_pkcs15_card *p15card; int card_locked; diff --git a/src/scam/p15_ldap.c b/src/scam/p15_ldap.c index 303f8b59..7363a205 100644 --- a/src/scam/p15_ldap.c +++ b/src/scam/p15_ldap.c @@ -43,8 +43,8 @@ #include "scam.h" typedef struct _scam_method_data { - struct sc_context *ctx; - struct sc_card *card; + sc_context_t *ctx; + sc_card_t *card; struct sc_pkcs15_card *p15card; int card_locked; diff --git a/src/tests/sc-test.c b/src/tests/sc-test.c index 9f817f3e..64991bd5 100644 --- a/src/tests/sc-test.c +++ b/src/tests/sc-test.c @@ -16,8 +16,8 @@ #include #include "sc-test.h" -struct sc_context *ctx; -struct sc_card *card; +sc_context_t *ctx; +sc_card_t *card; const struct option options[] = { { "reader", 1, 0, 'r' }, diff --git a/src/tools/cardos-info.c b/src/tools/cardos-info.c index 05b7d7f6..335540fc 100644 --- a/src/tools/cardos-info.c +++ b/src/tools/cardos-info.c @@ -54,12 +54,12 @@ const char *option_help[] = { "Verbose operation. Use several times to enable debug output.", }; -struct sc_context *ctx = NULL; -struct sc_card *card = NULL; +sc_context_t *ctx = NULL; +sc_card_t *card = NULL; int cardos_info(void) { - struct sc_apdu apdu; + sc_apdu_t apdu; u8 rbuf[SC_MAX_APDU_BUFFER_SIZE]; int r; diff --git a/src/tools/cryptoflex-tool.c b/src/tools/cryptoflex-tool.c index f6f19343..7b3d13f9 100644 --- a/src/tools/cryptoflex-tool.c +++ b/src/tools/cryptoflex-tool.c @@ -78,8 +78,8 @@ const char *option_help[] = { "Verbose operation. Use several times to enable debug output.", }; -struct sc_context *ctx = NULL; -struct sc_card *card = NULL; +sc_context_t *ctx = NULL; +sc_card_t *card = NULL; static char *getpin(const char *prompt) { @@ -134,8 +134,8 @@ static int verify_pin(int pin) static int select_app_df(void) { - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; char str[80]; 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) { int r; - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; u8 buf[2048], *p = buf; size_t bufsize, keysize; @@ -378,9 +378,9 @@ static int read_public_key(RSA *rsa) static int read_private_key(RSA *rsa) { int r; - struct sc_path path; - struct sc_file *file; - const struct sc_acl_entry *e; + sc_path_t path; + sc_file_t *file; + const sc_acl_entry_t *e; u8 buf[2048], *p = buf; size_t bufsize, keysize; @@ -473,7 +473,7 @@ static int read_key(void) static int list_keys(void) { int r, idx = 0; - struct sc_path path; + sc_path_t path; u8 buf[2048], *p = buf; size_t keysize, i; int mod_lens[] = { 512, 768, 1024, 2048 }; @@ -513,7 +513,7 @@ static int list_keys(void) static int generate_key(void) { - struct sc_apdu apdu; + sc_apdu_t apdu; u8 sbuf[4]; u8 p2; int r; @@ -570,7 +570,7 @@ static int generate_key(void) static int create_key_files(void) { - struct sc_file *file; + sc_file_t *file; int mod_lens[] = { 512, 768, 1024, 2048 }; int sizes[] = { 163, 243, 323, 643 }; 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) { int r, idx = 0; - struct sc_path path; + sc_path_t path; r = select_app_df(); 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) { int r, idx = 0; - struct sc_path path; + sc_path_t path; r = select_app_df(); if (r) @@ -872,9 +872,9 @@ static int store_key(void) } #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; path = file->path; @@ -905,9 +905,9 @@ static int create_file(struct sc_file *file) #endif #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; file = sc_file_new(); @@ -930,12 +930,12 @@ static int create_app_df(struct sc_path *path, size_t size) } #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 buf[30], *p = buf; - struct sc_path file_id, path; - struct sc_file *file; + sc_path_t file_id, path; + sc_file_t *file; size_t len; 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() { - struct sc_path path; + sc_path_t path; char buf[80]; if (opt_pin_num != 1 && opt_pin_num != 2) { diff --git a/src/tools/eidenv.c b/src/tools/eidenv.c index fce9f0f9..d8c07d3f 100644 --- a/src/tools/eidenv.c +++ b/src/tools/eidenv.c @@ -130,10 +130,10 @@ static void decode_options(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; - struct sc_card *card = NULL; - struct sc_path path; + sc_card_t *card = NULL; + sc_path_t path; int r, i; char buff[512]; diff --git a/src/tools/opensc-explorer.c b/src/tools/opensc-explorer.c index 5ba89c5a..02267a3c 100644 --- a/src/tools/opensc-explorer.c +++ b/src/tools/opensc-explorer.c @@ -40,10 +40,10 @@ const char *app_name = "opensc-explorer"; int opt_reader = -1, opt_wait = 0, verbose = 0; const char *opt_driver = NULL; -struct sc_file *current_file = NULL; -struct sc_path current_path; -struct sc_context *ctx = NULL; -struct sc_card *card = NULL; +sc_file_t *current_file = NULL; +sc_path_t current_path; +sc_context_t *ctx = NULL; +sc_card_t *card = NULL; const struct option options[] = { { "reader", 1, 0, 'r' }, @@ -110,14 +110,14 @@ ambiguous_match(struct command *table, const char *cmd) 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)); 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))); } -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]; u8 cbuf[2]; @@ -147,7 +147,7 @@ static int arg_to_path(const char *arg, struct sc_path *path, int is_id) return 0; } -static void print_file(const struct sc_file *file) +static void print_file(const sc_file_t *file) { const char *st; @@ -199,8 +199,8 @@ static int do_ls(int argc, char **argv) count = r; printf("FileID\tType Size\n"); while (count >= 2) { - struct sc_path path; - struct sc_file *file = NULL; + sc_path_t path; + sc_file_t *file = NULL; path = current_path; sc_append_path_id(&path, cur, 2); @@ -228,8 +228,8 @@ usage: static int do_cd(int argc, char **argv) { - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; int r; if (argc != 1) @@ -279,7 +279,7 @@ usage: 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; u8 buf[128]; @@ -308,7 +308,7 @@ static int read_and_print_binary_file(struct sc_file *file) 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]; 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) { int r, err = 0; - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; int not_current = 1; if (argc > 1) @@ -374,8 +374,8 @@ usage: static int do_info(int argc, char **argv) { - struct sc_file *file; - struct sc_path path; + sc_file_t *file; + sc_path_t path; size_t i; const char *st; int r, not_current = 1; @@ -480,7 +480,7 @@ usage: return -1; } -static int create_file(struct sc_file *file) +static int create_file(sc_file_t *file) { int r; @@ -501,8 +501,8 @@ static int create_file(struct sc_file *file) static int do_create(int argc, char **argv) { - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; unsigned int size; int r, op; @@ -532,8 +532,8 @@ static int do_create(int argc, char **argv) static int do_mkdir(int argc, char **argv) { - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; unsigned int size; int r, op; @@ -561,7 +561,7 @@ static int do_mkdir(int argc, char **argv) static int do_delete(int argc, char **argv) { - struct sc_path path; + sc_path_t path; int r; if (argc != 1) @@ -812,8 +812,8 @@ static int do_get(int argc, char **argv) int r, err = 0; size_t count = 0; unsigned int idx = 0; - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; char fbuf[256], *filename; FILE *outf = NULL; @@ -926,8 +926,8 @@ static int do_update_binary(int argc, char **argv) u8 buf[240]; int r, err = 1, in_len; int offs; - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; char *in_str; if (argc < 2 || argc > 3) @@ -988,8 +988,8 @@ static int do_update_record(int argc, char **argv) u8 buf[240]; int r, i, err = 1; int rec, offs; - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; char *in_str; if (argc < 3 || argc > 4) @@ -1058,8 +1058,8 @@ static int do_put(int argc, char **argv) int r, err = 0; size_t count = 0; unsigned int idx = 0; - struct sc_path path; - struct sc_file *file; + sc_path_t path; + sc_file_t *file; const char *filename; FILE *outf = NULL; @@ -1160,7 +1160,7 @@ static int do_pksign(int argc, char **argv) size_t indatalen = sizeof indata; u8 outdata[128]; size_t outdatalen = sizeof outdata; - struct sc_security_env senv; + sc_security_env_t senv; const u8 *oid; int oidlen; const char *s; @@ -1254,7 +1254,7 @@ static int do_pkdecrypt(int argc, char **argv) size_t indatalen = sizeof indata; u8 outdata[128]; size_t outdatalen = sizeof outdata; - struct sc_security_env senv; + sc_security_env_t senv; const char *s; if (argc != 2) diff --git a/src/tools/opensc-tool.c b/src/tools/opensc-tool.c index 62501f55..bdd9c189 100644 --- a/src/tools/opensc-tool.c +++ b/src/tools/opensc-tool.c @@ -77,8 +77,8 @@ const char *option_help[] = { "Verbose operation. Use several times to enable debug output.", }; -struct sc_context *ctx = NULL; -struct sc_card *card = NULL; +sc_context_t *ctx = NULL; +sc_card_t *card = NULL; static int list_readers(void) { @@ -129,8 +129,8 @@ static int list_drivers(void) return 0; } -static int print_file(struct sc_card *in_card, const struct sc_file *file, - const struct sc_path *path, int depth) +static int print_file(sc_card_t *in_card, const sc_file_t *file, + const sc_path_t *path, int depth) { int r; const char *tmps; @@ -234,9 +234,9 @@ static int print_file(struct sc_card *in_card, const struct sc_file *file, 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; 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"); } else for (i = 0; i < r/2; i++) { - struct sc_path tmppath; + sc_path_t tmppath; memcpy(&tmppath, &path, sizeof(path)); 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) { - struct sc_path path; + sc_path_t path; int r; sc_format_path("3F00", &path); @@ -283,7 +283,7 @@ static int list_files(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], rbuf[SC_MAX_APDU_BUFFER_SIZE], *p; size_t len, len0, r; @@ -358,7 +358,7 @@ static int send_apdu(void) static void print_serial(sc_card_t *in_card) { int r; - struct sc_serial_number serial; + sc_serial_number_t serial; r = sc_card_ctl(in_card, SC_CARDCTL_GET_SERIALNR, &serial); if (r) diff --git a/src/tools/pkcs15-crypt.c b/src/tools/pkcs15-crypt.c index d4daed9e..e950c737 100644 --- a/src/tools/pkcs15-crypt.c +++ b/src/tools/pkcs15-crypt.c @@ -83,8 +83,8 @@ const char *option_help[] = { "Verbose operation. Use several times to enable debug output.", }; -struct sc_context *ctx = NULL; -struct sc_card *card = NULL; +sc_context_t *ctx = NULL; +sc_card_t *card = NULL; struct sc_pkcs15_card *p15card = NULL; static char * get_pin(struct sc_pkcs15_object *obj) diff --git a/src/tools/pkcs15-init.c b/src/tools/pkcs15-init.c index d6112d44..58a92c36 100644 --- a/src/tools/pkcs15-init.c +++ b/src/tools/pkcs15-init.c @@ -57,13 +57,13 @@ const char *app_name = "pkcs15-init"; /* 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 *); /* Local functions */ static int open_reader_and_card(int); -static int do_assert_pristine(struct sc_card *); -static int do_erase(struct sc_card *, struct sc_profile *); +static int do_assert_pristine(sc_card_t *); +static int do_erase(sc_card_t *, struct sc_profile *); static int do_init_app(struct sc_profile *); static int do_store_pin(struct sc_profile *); 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_cert(sc_pkcs15_der_t *, X509 *); 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_store_data_object(struct sc_profile *profile); @@ -262,8 +262,8 @@ struct secret { size_t len; }; -static struct sc_context * ctx = NULL; -static struct sc_card * card = NULL; +static sc_context_t * ctx = NULL; +static sc_card_t * card = NULL; static struct sc_pkcs15_card * p15card = NULL; static unsigned int opt_actions; 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 */ static int -do_assert_pristine(struct sc_card *in_card) +do_assert_pristine(sc_card_t *in_card) { sc_path_t path; int r, res=0; @@ -502,7 +502,7 @@ do_assert_pristine(struct sc_card *in_card) * Erase card */ 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; ignore_cmdline_pins++; diff --git a/src/tools/pkcs15-tool.c b/src/tools/pkcs15-tool.c index 13592053..641555f1 100644 --- a/src/tools/pkcs15-tool.c +++ b/src/tools/pkcs15-tool.c @@ -56,7 +56,7 @@ enum { #define NELEMENTS(x) (sizeof(x)/sizeof((x)[0])) 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 *); const struct option options[] = { @@ -106,8 +106,8 @@ const char *option_help[] = { "Verbose operation. Use several times to enable debug output.", }; -struct sc_context *ctx = NULL; -struct sc_card *card = NULL; +sc_context_t *ctx = NULL; +sc_card_t *card = NULL; struct sc_pkcs15_card *p15card = NULL; static void print_cert_info(const struct sc_pkcs15_object *obj) @@ -781,10 +781,10 @@ static int change_pin(void) 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; - const struct sc_acl_entry *e; + sc_file_t *tfile; + const sc_acl_entry_t *e; u8 buf[16384]; int r; @@ -1071,7 +1071,7 @@ static const struct sc_asn1_entry c_asn1_pem_key[] = { }; 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) { struct sc_asn1_entry asn1_pem_key[2], diff --git a/src/tools/util.c b/src/tools/util.c index 88584116..912d3198 100644 --- a/src/tools/util.c +++ b/src/tools/util.c @@ -15,7 +15,7 @@ int connect_card(sc_context_t *ctx, sc_card_t **cardp, int r; if (wait) { - struct sc_reader *readers[16]; + sc_reader_t *readers[16]; int slots[16]; int i, j, k, found; unsigned int event; @@ -188,7 +188,7 @@ void print_usage_and_die(void) 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]; unsigned int acl;