diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c index 22f44a93..b6b8d4a3 100644 --- a/src/pkcs11/framework-pkcs15.c +++ b/src/pkcs11/framework-pkcs15.c @@ -849,10 +849,16 @@ static CK_RV pkcs15_create_tokens(struct sc_pkcs11_card *p11card) if ((pin_info->flags & SC_PKCS15_PIN_FLAG_SO_PIN) != 0) continue; - /* Ignore unblocking pins */ - if (pin_info->flags & SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN) + /* Ignore unblocking pins for hacked module */ + if (hack_enabled && (pin_info->flags & SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN) != 0) continue; + /* Ignore unblocking pins */ + printf("%s %i: disable %i\n", __FILE__, __LINE__, sc_pkcs11_conf.disable_user_puk_slot); + if (sc_pkcs11_conf.disable_user_puk_slot) + if (pin_info->flags & SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN) + continue; + found_auth_count++; rv = pkcs15_create_slot(p11card, auths[i], &slot); diff --git a/src/pkcs11/misc.c b/src/pkcs11/misc.c index 63718c9d..9a47a1a2 100644 --- a/src/pkcs11/misc.c +++ b/src/pkcs11/misc.c @@ -257,6 +257,7 @@ void load_pkcs11_parameters(struct sc_pkcs11_config *conf, sc_context_t * ctx) conf->lock_login = 0; conf->soft_keygen_allowed = 0; conf->pin_unblock_style = SC_PKCS11_PIN_UNBLOCK_NOT_ALLOWED; + conf->disable_user_puk_slot = 0; conf_block = sc_get_conf_block(ctx, "pkcs11", NULL, 1); if (!conf_block) @@ -279,6 +280,8 @@ void load_pkcs11_parameters(struct sc_pkcs11_config *conf, sc_context_t * ctx) conf->pin_unblock_style = SC_PKCS11_PIN_UNBLOCK_SCONTEXT_SETPIN; else if (unblock_style && !strcmp(unblock_style, "init_pin_in_so_session")) conf->pin_unblock_style = SC_PKCS11_PIN_UNBLOCK_SO_LOGGED_INITPIN; + + conf->disable_user_puk_slot = scconf_get_bool(conf_block, "disable_user_puk_slot", conf->disable_user_puk_slot); sc_debug(ctx, "PKCS#11 options: plug_and_play=%d max_virtual_slots=%d slots_per_card=%d " "hide_empty_tokens=%d lock_login=%d pin_unblock_style=%d", diff --git a/src/pkcs11/sc-pkcs11.h b/src/pkcs11/sc-pkcs11.h index d8908c51..bf754e8e 100644 --- a/src/pkcs11/sc-pkcs11.h +++ b/src/pkcs11/sc-pkcs11.h @@ -79,6 +79,7 @@ struct sc_pkcs11_config { unsigned char lock_login; unsigned char soft_keygen_allowed; unsigned int pin_unblock_style; + unsigned int disable_user_puk_slot; }; /* diff --git a/src/pkcs15init/pkcs15-oberthur.c b/src/pkcs15init/pkcs15-oberthur.c index f16a1a7f..c8d5321f 100644 --- a/src/pkcs15init/pkcs15-oberthur.c +++ b/src/pkcs15init/pkcs15-oberthur.c @@ -813,7 +813,7 @@ sc_pkcs15init_oberthur_operations = { NULL, /* encode private/public key */ NULL, /* finalize_card */ /* Old API */ - NULL, //cosm_init_app, /* old */ + NULL, /* init_app */ NULL, /* new_pin */ NULL, /* cosm_new_key, */ NULL, /* cosm_new_file, */