diff --git a/src/pkcs15init/pkcs15-asepcos.c b/src/pkcs15init/pkcs15-asepcos.c index 956d1845..2c5d298e 100644 --- a/src/pkcs15init/pkcs15-asepcos.c +++ b/src/pkcs15init/pkcs15-asepcos.c @@ -836,7 +836,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_asepcos_operations = { asepcos_generate_key, NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-cardos.c b/src/pkcs15init/pkcs15-cardos.c index d48c0a46..a9630c32 100644 --- a/src/pkcs15init/pkcs15-cardos.c +++ b/src/pkcs15init/pkcs15-cardos.c @@ -782,7 +782,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_cardos_operations = { cardos_generate_key, NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-cflex.c b/src/pkcs15init/pkcs15-cflex.c index 172eacdb..c5374f4e 100644 --- a/src/pkcs15init/pkcs15-cflex.c +++ b/src/pkcs15init/pkcs15-cflex.c @@ -871,7 +871,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_cryptoflex_operations = { cryptoflex_encode_private_key, cryptoflex_encode_public_key, NULL, /* finalize_card */ - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; @@ -889,7 +888,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_cyberflex_operations = { cyberflex_encode_private_key, cyberflex_encode_public_key, NULL, /* finalize_card */ - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-entersafe.c b/src/pkcs15init/pkcs15-entersafe.c index dc83833a..9f8ed1a9 100644 --- a/src/pkcs15init/pkcs15-entersafe.c +++ b/src/pkcs15init/pkcs15-entersafe.c @@ -423,7 +423,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_entersafe_operations = { entersafe_generate_key, NULL, NULL, /* encode private/public key */ NULL, /* finalize */ - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-gpk.c b/src/pkcs15init/pkcs15-gpk.c index a8c7749d..b1e16027 100644 --- a/src/pkcs15init/pkcs15-gpk.c +++ b/src/pkcs15init/pkcs15-gpk.c @@ -1139,7 +1139,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_gpk_operations = { gpk_generate_key, NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-incrypto34.c b/src/pkcs15init/pkcs15-incrypto34.c index 718ecd60..a9dace92 100644 --- a/src/pkcs15init/pkcs15-incrypto34.c +++ b/src/pkcs15init/pkcs15-incrypto34.c @@ -676,7 +676,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_incrypto34_operations = { incrypto34_generate_key, NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; struct sc_pkcs15init_operations * diff --git a/src/pkcs15init/pkcs15-init.h b/src/pkcs15init/pkcs15-init.h index 4a045953..1e956362 100644 --- a/src/pkcs15init/pkcs15-init.h +++ b/src/pkcs15init/pkcs15-init.h @@ -121,52 +121,6 @@ struct sc_pkcs15init_operations { */ int (*finalize_card)(sc_card_t *); - /* - * Old-style API - */ - - /* - * Initialize application, and optionally set a SO pin - */ - int (*init_app)(struct sc_profile *, struct sc_card *, - struct sc_pkcs15_pin_info *, - const u8 *pin, size_t pin_len, - const u8 *puk, size_t puk_len); - - /* - * Store a new PIN - * On some cards (such as the CryptoFlex) this will create - * a new subdirectory of the AppDF. - * Index is the number of the PIN in the AODF (this should - * help the card driver to pick the right file ID/directory ID/ - * pin file index. - */ - int (*new_pin)(struct sc_profile *, struct sc_card *, - struct sc_pkcs15_pin_info *, unsigned int idx, - const u8 *pin, size_t pin_len, - const u8 *puk, size_t puk_len); - - /* - * Store a key on the card - */ - int (*new_key)(struct sc_profile *, struct sc_card *, - struct sc_pkcs15_prkey *key, unsigned int idx, - struct sc_pkcs15_prkey_info *); - - /* - * Create a file based on a PKCS15_TYPE_xxx - */ - int (*new_file)(struct sc_profile *, struct sc_card *, - unsigned int, unsigned int, struct sc_file **out); - - /* - * Generate a new key pair - */ - int (*old_generate_key)(struct sc_profile *, struct sc_card *, - unsigned int idx, unsigned int keybits, - sc_pkcs15_pubkey_t *pubkey_res, - struct sc_pkcs15_prkey_info *); - /* * Delete object */ diff --git a/src/pkcs15init/pkcs15-jcop.c b/src/pkcs15init/pkcs15-jcop.c index e1af2542..8a6fa69a 100644 --- a/src/pkcs15init/pkcs15-jcop.c +++ b/src/pkcs15init/pkcs15-jcop.c @@ -45,6 +45,7 @@ jcop_erase_card(struct sc_profile *pro, sc_card_t *card) { return SC_ERROR_NOT_SUPPORTED; } +#if 0 /* * Create a new DF * This will usually be the application DF @@ -57,6 +58,17 @@ jcop_init_app(sc_profile_t *profile, sc_card_t *card, return SC_ERROR_NOT_SUPPORTED; } +#else + +static int +jcop_create_dir(sc_profile_t *profile, sc_card_t *card, sc_file_t *file) +{ + return SC_ERROR_NOT_SUPPORTED; +}; + +#endif + + /* * Select a PIN reference */ @@ -346,7 +358,7 @@ jcop_generate_key(sc_profile_t *profile, sc_card_t *card, static struct sc_pkcs15init_operations sc_pkcs15init_jcop_operations = { jcop_erase_card, NULL, /* init_card */ - NULL, /* create_dir */ + jcop_create_dir, NULL, /* create_domain */ jcop_select_pin_reference, jcop_create_pin, @@ -356,8 +368,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_jcop_operations = { jcop_generate_key, NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - jcop_init_app, /* old */ - NULL, NULL, NULL, NULL, /* rest of old style api */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-lib.c b/src/pkcs15init/pkcs15-lib.c index de6169c0..87f50dce 100644 --- a/src/pkcs15init/pkcs15-lib.c +++ b/src/pkcs15init/pkcs15-lib.c @@ -687,23 +687,15 @@ sc_pkcs15init_add_app(sc_card_t *card, struct sc_profile *profile, } /* Create the application DF and store the PINs */ - if (profile->ops->create_dir) { - /* Create the application directory */ - r = profile->ops->create_dir(profile, card, df); + /* Create the application directory */ + r = profile->ops->create_dir(profile, card, df); - /* Set the SO PIN */ - if (r >= 0 && pin_obj) { - r = profile->ops->create_pin(profile, card, df, pin_obj, - args->so_pin, args->so_pin_len, - args->so_puk, args->so_puk_len); - } - } else { - /* Old style API */ - r = profile->ops->init_app(profile, card, &pin_info, + /* Set the SO PIN */ + if (r >= 0 && pin_obj) { + r = profile->ops->create_pin(profile, card, df, pin_obj, args->so_pin, args->so_pin_len, args->so_puk, args->so_puk_len); } - if (r < 0 && pin_obj) sc_pkcs15_free_object(pin_obj); SC_TEST_RET(ctx, r, "Card specific create application DF failed"); @@ -1057,17 +1049,7 @@ sc_pkcs15init_store_pin(struct sc_pkcs15_card *p15card, SC_TEST_RET(ctx, r, "Failed to set SO PIN reference from card"); /* Now store the PINs */ - if (profile->ops->create_pin) { - r = sc_pkcs15init_create_pin(p15card, profile, pin_obj, args); - } else { - /* Get the number of PINs we already have */ - idx = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_AUTH, NULL, 0); - - r = profile->ops->new_pin(profile, p15card->card, pin_info, idx, - args->pin, args->pin_len, - args->puk, args->puk_len); - } - + r = sc_pkcs15init_create_pin(p15card, profile, pin_obj, args); if (r < 0) sc_pkcs15_free_object(pin_obj); SC_TEST_RET(ctx, r, "Card specific create PIN failed."); @@ -1323,7 +1305,7 @@ sc_pkcs15init_generate_key(struct sc_pkcs15_card *p15card, keybits, SC_ALGORITHM_ONBOARD_KEY_GEN)) SC_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, "Generation of RSA and GOST keys is only supported"); - if (profile->ops->generate_key == NULL && profile->ops->old_generate_key == NULL) + if (profile->ops->generate_key == NULL) SC_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, "Key generation not supported"); /* Set the USER PIN reference from args */ @@ -1356,21 +1338,11 @@ sc_pkcs15init_generate_key(struct sc_pkcs15_card *p15card, pubkey_args.gost_params = keygen_args->prkey_args.gost_params; /* Generate the private key on card */ - if (profile->ops->create_key) { - /* New API */ - r = profile->ops->create_key(profile, p15card->card, object); - SC_TEST_RET(ctx, r, "Cannot generate key: create key failed"); + r = profile->ops->create_key(profile, p15card->card, object); + SC_TEST_RET(ctx, r, "Cannot generate key: create key failed"); - r = profile->ops->generate_key(profile, p15card->card, object, &pubkey_args.key); - SC_TEST_RET(ctx, r, "Failed to generate key"); - } else { - int idx; - - idx = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_PRKEY, NULL, 0); - r = profile->ops->old_generate_key(profile, p15card->card, idx, keybits, - &pubkey_args.key, key_info); - SC_TEST_RET(ctx, r, "Failed to generate key in an old manner"); - } + r = profile->ops->generate_key(profile, p15card->card, object, &pubkey_args.key); + SC_TEST_RET(ctx, r, "Failed to generate key"); /* update PrKDF entry */ if (!caller_supplied_id) { @@ -1463,17 +1435,11 @@ sc_pkcs15init_store_private_key(struct sc_pkcs15_card *p15card, /* Get the number of private keys already on this card */ idx = sc_pkcs15_get_objects(p15card, SC_PKCS15_TYPE_PRKEY, NULL, 0); if (!(keyargs->flags & SC_PKCS15INIT_EXTRACTABLE)) { - if (profile->ops->create_key) { - /* New API */ - r = profile->ops->create_key(profile, p15card->card, object); - SC_TEST_RET(ctx, r, "Card specific 'create key' failed"); + r = profile->ops->create_key(profile, p15card->card, object); + SC_TEST_RET(ctx, r, "Card specific 'create key' failed"); - r = profile->ops->store_key(profile, p15card->card, object, &key); - SC_TEST_RET(ctx, r, "Card specific 'store key' failed"); - } else { - r = profile->ops->new_key(profile, p15card->card, &key, idx, key_info); - SC_TEST_RET(ctx, r, "Card specific 'new key' failed"); - } + r = profile->ops->store_key(profile, p15card->card, object, &key); + SC_TEST_RET(ctx, r, "Card specific 'store key' failed"); } else { sc_pkcs15_der_t encoded, wrapped, *der = &encoded; sc_context_t *ctx = p15card->card->ctx; @@ -1868,27 +1834,12 @@ sc_pkcs15init_store_data(struct sc_pkcs15_card *p15card, r = set_so_pin_from_card(p15card, profile); SC_TEST_RET(ctx, r, "Failed to set SO PIN from card"); - if (profile->ops->new_file == NULL) { - /* New API */ - r = select_object_path(p15card, profile, object, id, path); - SC_TEST_RET(ctx, r, "Failed to select object path"); + r = select_object_path(p15card, profile, object, id, path); + SC_TEST_RET(ctx, r, "Failed to select object path"); - r = sc_profile_get_file_by_path(profile, path, &file); - SC_TEST_RET(ctx, r, "Failed to get file by path"); - } else { - /* Get the number of objects of this type already on this card */ - idx = sc_pkcs15_get_objects(p15card, - object->type & SC_PKCS15_TYPE_CLASS_MASK, - NULL, 0); + r = sc_profile_get_file_by_path(profile, path, &file); + SC_TEST_RET(ctx, r, "Failed to get file by path"); - /* Allocate data file */ - r = profile->ops->new_file(profile, p15card->card, - object->type, idx, &file); - if (r < 0) { - sc_debug(p15card->card->ctx, "Unable to allocate file"); - goto done; - } - } if (file->path.count == 0) { file->path.index = 0; file->path.count = -1; diff --git a/src/pkcs15init/pkcs15-miocos.c b/src/pkcs15init/pkcs15-miocos.c index 17753df0..9ff7dfc7 100644 --- a/src/pkcs15init/pkcs15-miocos.c +++ b/src/pkcs15init/pkcs15-miocos.c @@ -274,12 +274,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_miocos_operations = { NULL, /* generate_key */ NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - /* Old API */ - NULL, /* miocos_init_app */ - NULL, /* miocos_new_pin */ - NULL, /* miocos_new_key */ - NULL, /* miocos_new_file */ - NULL, /* old_generate_key */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-muscle.c b/src/pkcs15init/pkcs15-muscle.c index bcf5d612..f445b9a9 100644 --- a/src/pkcs15init/pkcs15-muscle.c +++ b/src/pkcs15init/pkcs15-muscle.c @@ -309,11 +309,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_muscle_operations = { muscle_generate_key, /* generate_key */ NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - NULL, /* old - initapp*/ - NULL, /* new_pin */ - NULL, /* new key */ - NULL, /* new file */ - NULL, /* generate key */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-myeid.c b/src/pkcs15init/pkcs15-myeid.c index 7ed8570e..0dbcb76c 100644 --- a/src/pkcs15init/pkcs15-myeid.c +++ b/src/pkcs15init/pkcs15-myeid.c @@ -695,13 +695,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_myeid_operations = { myeid_encode_private_key, myeid_encode_public_key, NULL, /* finalize_card */ - /* Old style API */ - NULL, /* init_app */ - NULL, /* new_pin */ - NULL, /* new_key */ - NULL, /* new_file */ - NULL, /* old_generate_key */ - myeid_delete_object /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-oberthur.c b/src/pkcs15init/pkcs15-oberthur.c index 49fb6bc6..e2ce30af 100644 --- a/src/pkcs15init/pkcs15-oberthur.c +++ b/src/pkcs15init/pkcs15-oberthur.c @@ -811,13 +811,7 @@ sc_pkcs15init_oberthur_operations = { NULL, NULL, /* encode private/public key */ NULL, /* finalize_card */ - /* Old API */ - NULL, /* init_app */ - NULL, /* new_pin */ - NULL, /* cosm_new_key, */ - NULL, /* cosm_new_file, */ - NULL, /* cosm_old_generate_key, */ - NULL + NULL /* delete_object */ }; struct sc_pkcs15init_operations * diff --git a/src/pkcs15init/pkcs15-rtecp.c b/src/pkcs15init/pkcs15-rtecp.c index 271d693a..5644c569 100644 --- a/src/pkcs15init/pkcs15-rtecp.c +++ b/src/pkcs15init/pkcs15-rtecp.c @@ -590,12 +590,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_rtecp_operations = { NULL, /* encode_private_key */ NULL, /* encode_public_key */ rtecp_finalize, /* finalize_card */ - /* Old-style API */ - NULL, /* init_app */ - NULL, /* new_pin */ - NULL, /* new_key */ - NULL, /* new_file */ - NULL, /* old_generate_key */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-rutoken.c b/src/pkcs15init/pkcs15-rutoken.c index 0d527bb8..9aaec110 100644 --- a/src/pkcs15init/pkcs15-rutoken.c +++ b/src/pkcs15init/pkcs15-rutoken.c @@ -506,12 +506,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_rutoken_operations = { NULL, /* encode_private_key */ NULL, /* encode_public_key */ NULL, /* finalize_card */ - /* Old-style API */ - NULL, /* init_app */ - NULL, /* new_pin */ - NULL, /* new_key */ - NULL, /* new_file */ - NULL, /* old_generate_key */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-setcos.c b/src/pkcs15init/pkcs15-setcos.c index 4d8eb0c7..d311b19f 100644 --- a/src/pkcs15init/pkcs15-setcos.c +++ b/src/pkcs15init/pkcs15-setcos.c @@ -593,14 +593,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_setcos_operations = { setcos_encode_private_key, setcos_encode_public_key, NULL, /* finalize_card */ - - /* Old style API */ - NULL, /* init_app */ - NULL, - NULL, /* new_key */ - NULL, /* new_file */ - NULL, /* old_generate_key */ - setcos_delete_object }; diff --git a/src/pkcs15init/pkcs15-starcos.c b/src/pkcs15init/pkcs15-starcos.c index 0fd3f66e..6e72b1f1 100644 --- a/src/pkcs15init/pkcs15-starcos.c +++ b/src/pkcs15init/pkcs15-starcos.c @@ -919,7 +919,6 @@ static struct sc_pkcs15init_operations sc_pkcs15init_starcos_operations = { starcos_generate_key, NULL, NULL, /* encode private/public key */ starcos_finalize_card, - NULL, NULL, NULL, NULL, NULL, /* old style api */ NULL /* delete_object */ }; diff --git a/src/pkcs15init/pkcs15-westcos.c b/src/pkcs15init/pkcs15-westcos.c index b39ec754..4f68a54e 100644 --- a/src/pkcs15init/pkcs15-westcos.c +++ b/src/pkcs15init/pkcs15-westcos.c @@ -326,21 +326,19 @@ static int westcos_pkcs15init_finalize_card(sc_card_t *card) } static struct sc_pkcs15init_operations sc_pkcs15init_westcos_operations = { - NULL, /* erase_card */ - westcos_pkcs15init_init_card, /* init_card */ - westcos_pkcs15init_create_dir, /* create_dir */ - NULL, /* create_domain */ - westcos_pkcs15_select_pin_reference,/* select_pin_reference */ - westcos_pkcs15_create_pin, /* create_pin */ - NULL, /* select_key_reference */ - westcos_pkcs15init_create_key, /* create_key */ - westcos_pkcs15init_store_key, /* store_key */ - westcos_pkcs15init_generate_key, /* generate_key */ - NULL, NULL, /* encode private/public key */ - westcos_pkcs15init_finalize_card, /* finalize_card */ - NULL,NULL,NULL,NULL, /* old style app */ - NULL, /* old_generate_key */ - NULL /* delete_object */ + NULL, /* erase_card */ + westcos_pkcs15init_init_card, /* init_card */ + westcos_pkcs15init_create_dir, /* create_dir */ + NULL, /* create_domain */ + westcos_pkcs15_select_pin_reference, /* select_pin_reference */ + westcos_pkcs15_create_pin, /* create_pin */ + NULL, /* select_key_reference */ + westcos_pkcs15init_create_key, /* create_key */ + westcos_pkcs15init_store_key, /* store_key */ + westcos_pkcs15init_generate_key, /* generate_key */ + NULL, NULL, /* encode private/public key */ + westcos_pkcs15init_finalize_card, /* finalize_card */ + NULL /* delete_object */ }; struct sc_pkcs15init_operations* sc_pkcs15init_get_westcos_ops(void)