pkcs15init: pkcs15 card flags

Set 'TOKEN INITIALIZED' after an application has been added,
set 'USER PIN INITIALIZED' and 'LOGIN REQUIRED' after User PIN object has been created.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4130 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
viktor.tarasov 2010-03-18 09:27:09 +00:00
parent 5eba20e263
commit 965ecbf9a1
1 changed files with 7 additions and 0 deletions

View File

@ -773,6 +773,7 @@ sc_pkcs15init_add_app(struct sc_card *card, struct sc_profile *profile,
/* See if we've set an SO PIN */
r = sc_pkcs15init_add_object(p15card, profile, SC_PKCS15_AODF, pin_obj);
if (r >= 0) {
p15card->flags |= SC_PKCS15_CARD_FLAG_TOKEN_INITIALIZED;
r = sc_pkcs15init_update_dir(p15card, profile, app);
if (r >= 0)
r = sc_pkcs15init_update_tokeninfo(p15card, profile);
@ -903,6 +904,12 @@ sc_pkcs15init_store_pin(struct sc_pkcs15_card *p15card,
sc_pkcs15_free_object(pin_obj);
SC_TEST_RET(ctx, SC_LOG_DEBUG_NORMAL, r, "Failed to add PIN object");
if (!(pin_info->flags & (SC_PKCS15_PIN_FLAG_SO_PIN | SC_PKCS15_PIN_FLAG_UNBLOCKING_PIN))) {
p15card->flags |= SC_PKCS15_CARD_FLAG_USER_PIN_INITIALIZED;
p15card->flags |= SC_PKCS15_CARD_FLAG_LOGIN_REQUIRED;
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Updated pkcs15 card flags %X", p15card->flags);
}
if (args->puk_id.len)
r = sc_pkcs15init_store_puk(p15card, profile, args);