pkcs11: parametrize disabling of the slot for PUK
git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3953 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
ae046cc460
commit
031bfc7a07
|
@ -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);
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -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, */
|
||||
|
|
Loading…
Reference in New Issue