pkcs15init: in pkcs15-init.h, for the function prototypes, homogenize using 'struct *' vs. '*_t'; do not use paramters name

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4131 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
viktor.tarasov 2010-03-18 09:39:16 +00:00
parent 965ecbf9a1
commit 8419f95f76
1 changed files with 66 additions and 69 deletions

View File

@ -21,7 +21,7 @@ extern "C" {
#define SC_PKCS15INIT_X509_KEY_CERT_SIGN 0x0004UL
#define SC_PKCS15INIT_X509_CRL_SIGN 0x0002UL
typedef struct sc_profile sc_profile_t; /* opaque type */
struct sc_profile;
struct sc_pkcs15init_operations {
/*
@ -38,26 +38,26 @@ struct sc_pkcs15init_operations {
* Currently used by the cflex driver to read the card's
* serial number and use it as the pkcs15 serial number.
*/
int (*init_card)(sc_profile_t *, sc_pkcs15_card_t *);
int (*init_card)(struct sc_profile *, struct sc_pkcs15_card *);
/*
* Create a DF
*/
int (*create_dir)(sc_profile_t *, sc_pkcs15_card_t *, sc_file_t *);
int (*create_dir)(struct sc_profile *, struct sc_pkcs15_card *, struct sc_file *);
/*
* Create a "pin domain". This is for cards such as
* the cryptoflex that need to put their pins into
* separate directories
*/
int (*create_domain)(sc_profile_t *, sc_pkcs15_card_t *,
const sc_pkcs15_id_t *, sc_file_t **);
int (*create_domain)(struct sc_profile *, struct sc_pkcs15_card *,
const struct sc_pkcs15_id *, struct sc_file **);
/*
* Select a PIN reference
*/
int (*select_pin_reference)(sc_profile_t *, sc_pkcs15_card_t *,
sc_pkcs15_pin_info_t *);
int (*select_pin_reference)(struct sc_profile *, struct sc_pkcs15_card *,
struct sc_pkcs15_pin_info *);
/*
* Create a PIN object within the given DF.
@ -66,16 +66,16 @@ struct sc_pkcs15init_operations {
* The card driver can reject the pin reference; in this case
* the caller needs to adjust it.
*/
int (*create_pin)(sc_profile_t *, sc_pkcs15_card_t *, sc_file_t *,
sc_pkcs15_object_t *,
const u8 *pin, size_t pin_len,
const u8 *puk, size_t puk_len);
int (*create_pin)(struct sc_profile *, struct sc_pkcs15_card *, struct sc_file *,
struct sc_pkcs15_object *,
const unsigned char *, size_t,
const unsigned char *, size_t);
/*
* Select a reference for a private key object
*/
int (*select_key_reference)(sc_profile_t *, sc_pkcs15_card_t *,
sc_pkcs15_prkey_info_t *);
int (*select_key_reference)(struct sc_profile *, struct sc_pkcs15_card *,
struct sc_pkcs15_prkey_info *);
/*
* Create an empty key object.
@ -85,33 +85,33 @@ struct sc_pkcs15init_operations {
* unprotected.
* @key_info should be filled in by the function
*/
int (*create_key)(sc_profile_t *, sc_pkcs15_card_t *,
sc_pkcs15_object_t *o);
int (*create_key)(struct sc_profile *, struct sc_pkcs15_card *,
struct sc_pkcs15_object *);
/*
* Store a key on the card
*/
int (*store_key)(sc_profile_t *, sc_pkcs15_card_t *,
sc_pkcs15_object_t *,
sc_pkcs15_prkey_t *);
int (*store_key)(struct sc_profile *, struct sc_pkcs15_card *,
struct sc_pkcs15_object *,
struct sc_pkcs15_prkey *);
/*
* Generate key
*/
int (*generate_key)(sc_profile_t *, sc_pkcs15_card_t *,
sc_pkcs15_object_t *,
sc_pkcs15_pubkey_t *);
int (*generate_key)(struct sc_profile *, struct sc_pkcs15_card *,
struct sc_pkcs15_object *,
struct sc_pkcs15_pubkey *);
/*
* Encode private/public key
* These are used mostly by the Cryptoflex/Cyberflex drivers.
*/
int (*encode_private_key)(sc_profile_t *, sc_card_t *,
int (*encode_private_key)(struct sc_profile *, struct sc_card *,
struct sc_pkcs15_prkey_rsa *,
u8 *buf, size_t *bufsize, int key_ref);
int (*encode_public_key)(sc_profile_t *, sc_card_t *,
unsigned char *buf, size_t *bufsize, int key_ref);
int (*encode_public_key)(struct sc_profile *, struct sc_card *,
struct sc_pkcs15_prkey_rsa *,
u8 *buf, size_t *bufsize, int key_ref);
unsigned char *buf, size_t *bufsize, int key_ref);
/*
* Finalize card
@ -119,13 +119,13 @@ struct sc_pkcs15init_operations {
* (actually this command is currently only for starcos spk 2.3
* cards).
*/
int (*finalize_card)(sc_card_t *);
int (*finalize_card)(struct sc_card *);
/*
* Delete object
*/
int (*delete_object)(struct sc_profile *, struct sc_pkcs15_card *,
unsigned int type, const void *data, const sc_path_t *path);
unsigned int, const void *, const struct sc_path *);
/*
* Support of pkcs15init emulation
@ -156,24 +156,21 @@ struct sc_pkcs15init_callbacks {
* Get a PIN from the front-end. The first argument is
* one of the SC_PKCS15INIT_XXX_PIN/PUK macros.
*/
int (*get_pin)(struct sc_profile *, int,
const struct sc_pkcs15_pin_info *,
const char *label,
u8 *, size_t *);
int (*get_pin)(struct sc_profile *, int, const struct sc_pkcs15_pin_info *,
const char *, unsigned char *, size_t *);
/*
* Get a transport/secure messaging key from the front-end.
*/
int (*get_key)(struct sc_profile *,
int method, int reference,
const u8 *def_key, size_t def_size,
u8 *key_buf, size_t *key_size);
int (*get_key)(struct sc_profile *, int method, int reference,
const unsigned char *def_key, size_t def_size,
unsigned char *key_buf, size_t *key_size);
};
struct sc_pkcs15init_initargs {
const u8 * so_pin;
const unsigned char * so_pin;
size_t so_pin_len;
const u8 * so_puk;
const unsigned char * so_puk;
size_t so_puk_len;
const char * so_pin_label;
const char * label;
@ -183,12 +180,12 @@ struct sc_pkcs15init_initargs {
struct sc_pkcs15init_pinargs {
struct sc_pkcs15_id auth_id;
const char * label;
const u8 * pin;
const unsigned char * pin;
size_t pin_len;
struct sc_pkcs15_id puk_id;
const char * puk_label;
const u8 * puk;
const unsigned char * puk;
size_t puk_len;
};
@ -205,7 +202,7 @@ struct sc_pkcs15init_prkeyargs {
unsigned int flags;
struct sc_pkcs15init_keyarg_gost_params gost_params;
sc_pkcs15_prkey_t key;
struct sc_pkcs15_prkey key;
/* support for non-native keys */
char * passphrase;
@ -228,7 +225,7 @@ struct sc_pkcs15init_pubkeyargs {
unsigned long x509_usage;
struct sc_pkcs15init_keyarg_gost_params gost_params;
sc_pkcs15_pubkey_t key;
struct sc_pkcs15_pubkey key;
};
struct sc_pkcs15init_dataargs {
@ -238,7 +235,7 @@ struct sc_pkcs15init_dataargs {
const char * app_label;
struct sc_object_id app_oid;
sc_pkcs15_der_t der_encoded; /* Wrong name: is not DER encoded */
struct sc_pkcs15_der der_encoded; /* Wrong name: is not DER encoded */
};
struct sc_pkcs15init_certargs {
@ -247,26 +244,26 @@ struct sc_pkcs15init_certargs {
unsigned long x509_usage;
unsigned char authority;
sc_pkcs15_der_t der_encoded;
struct sc_pkcs15_der der_encoded;
};
#define P15_ATTR_TYPE_LABEL 0
#define P15_ATTR_TYPE_ID 1
extern struct sc_pkcs15_object *sc_pkcs15init_new_object(int type, const char *,
sc_pkcs15_id_t *, void *);
extern struct sc_pkcs15_object *sc_pkcs15init_new_object(int, const char *,
struct sc_pkcs15_id *, void *);
extern void sc_pkcs15init_set_callbacks(struct sc_pkcs15init_callbacks *);
extern int sc_pkcs15init_bind(struct sc_card *, const char *, const char *,
struct sc_profile **);
extern void sc_pkcs15init_unbind(struct sc_profile *);
extern void sc_pkcs15init_set_p15card(sc_profile_t *,
sc_pkcs15_card_t *);
extern int sc_pkcs15init_set_lifecycle(sc_card_t *card, int lcycle);
extern void sc_pkcs15init_set_p15card(struct sc_profile *,
struct sc_pkcs15_card *);
extern int sc_pkcs15init_set_lifecycle(struct sc_card *, int);
extern int sc_pkcs15init_erase_card(struct sc_pkcs15_card *,
struct sc_profile *);
/* XXX could this function be merged with ..._set_lifecycle ?? */
extern int sc_pkcs15init_finalize_card(sc_card_t *,
extern int sc_pkcs15init_finalize_card(struct sc_card *,
struct sc_profile *);
extern int sc_pkcs15init_add_app(struct sc_card *,
struct sc_profile *,
@ -306,24 +303,24 @@ extern int sc_pkcs15init_store_data_object(struct sc_pkcs15_card *,
* If P15_ATTR_TYPE_LABEL, then *new_value is a struct sc_pkcs15_id;
* If P15_ATTR_TYPE_ID, then *new_value is a char array.
*/
extern int sc_pkcs15init_change_attrib(struct sc_pkcs15_card *p15card,
struct sc_profile *profile,
struct sc_pkcs15_object *object,
int new_attrib_type,
void *new_value,
int new_len);
extern int sc_pkcs15init_delete_object(sc_pkcs15_card_t *p15card,
sc_profile_t *profile,
sc_pkcs15_object_t *obj);
extern int sc_pkcs15init_change_attrib(struct sc_pkcs15_card *,
struct sc_profile *,
struct sc_pkcs15_object *,
int,
void *,
int);
extern int sc_pkcs15init_delete_object(struct sc_pkcs15_card *,
struct sc_profile *,
struct sc_pkcs15_object *);
/* Replace an existing cert with a new one, which is assumed to be
* compatible with the correcsponding private key (e.g. the old and
* new cert should have the same public key).
*/
extern int sc_pkcs15init_update_certificate(sc_pkcs15_card_t *p15card,
sc_profile_t *profile,
sc_pkcs15_object_t *obj,
const unsigned char *rawcert,
size_t certlen);
extern int sc_pkcs15init_update_certificate(struct sc_pkcs15_card *,
struct sc_profile *,
struct sc_pkcs15_object *,
const unsigned char *,
size_t);
extern int sc_pkcs15init_create_file(struct sc_profile *,
struct sc_pkcs15_card *, struct sc_file *);
@ -334,7 +331,7 @@ extern int sc_pkcs15init_authenticate(struct sc_profile *, struct sc_pkcs15_card
extern int sc_pkcs15init_fixup_file(struct sc_profile *, struct sc_pkcs15_card *,
struct sc_file *);
extern int sc_pkcs15init_get_pin_info(struct sc_profile *, int, struct sc_pkcs15_pin_info *);
extern int sc_profile_get_pin_retries(sc_profile_t *, int);
extern int sc_profile_get_pin_retries(struct sc_profile *, int);
extern int sc_pkcs15init_get_manufacturer(struct sc_profile *,
const char **);
extern int sc_pkcs15init_get_serial(struct sc_profile *, const char **);
@ -344,9 +341,9 @@ extern int sc_pkcs15init_get_label(struct sc_profile *, const char **);
extern int sc_pkcs15init_verify_secret(struct sc_profile *, struct sc_pkcs15_card *,
sc_file_t *, unsigned int, int);
extern int sc_pkcs15init_delete_by_path(struct sc_profile *,
struct sc_pkcs15_card *, const sc_path_t *path);
extern int sc_pkcs15init_update_any_df(sc_pkcs15_card_t *, sc_profile_t *,
sc_pkcs15_df_t *, int);
struct sc_pkcs15_card *, const struct sc_path *path);
extern int sc_pkcs15init_update_any_df(struct sc_pkcs15_card *, struct sc_profile *,
struct sc_pkcs15_df *, int);
/* Erasing the card structure via rm -rf */
extern int sc_pkcs15init_erase_card_recursively(struct sc_pkcs15_card *,
@ -360,8 +357,8 @@ extern int sc_pkcs15init_requires_restrictive_usage(
struct sc_pkcs15init_prkeyargs *,
unsigned int);
extern int sc_pkcs15_create_pin_domain(sc_profile_t *, struct sc_pkcs15_card *,
const sc_pkcs15_id_t *, sc_file_t **);
extern int sc_pkcs15_create_pin_domain(struct sc_profile *, struct sc_pkcs15_card *,
const struct sc_pkcs15_id *, struct sc_file **);
extern int sc_pkcs15init_get_pin_reference(struct sc_pkcs15_card *,
struct sc_profile *, unsigned, int);