pkcs15init: in 'change-attribute' procedure use card specific 'update DF' handler ...

... when it's available. 
'Change-attribute' is used by pkcs15 framework for PKCS#11.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@5389 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
vtarasov 2011-04-22 14:00:47 +00:00
parent 4fa9679463
commit 6b04ab7650
1 changed files with 15 additions and 9 deletions

View File

@ -2701,17 +2701,23 @@ sc_pkcs15init_change_attrib(struct sc_pkcs15_card *p15card,
return SC_ERROR_NOT_SUPPORTED;
}
r = sc_pkcs15_encode_df(card->ctx, p15card, df, &buf, &bufsize);
if (r >= 0) {
struct sc_file *file = NULL;
if (profile->ops->emu_update_any_df) {
r = profile->ops->emu_update_any_df(profile, p15card, SC_AC_OP_CREATE, object);
LOG_TEST_RET(ctx, r, "Card specific DF update failed");
}
else {
r = sc_pkcs15_encode_df(card->ctx, p15card, df, &buf, &bufsize);
if (r >= 0) {
struct sc_file *file = NULL;
r = sc_profile_get_file_by_path(profile, &df->path, &file);
if(r < 0)
return r;
r = sc_profile_get_file_by_path(profile, &df->path, &file);
if(r < 0)
return r;
r = sc_pkcs15init_update_file(profile, p15card, file, buf, bufsize);
free(buf);
sc_file_free(file);
r = sc_pkcs15init_update_file(profile, p15card, file, buf, bufsize);
free(buf);
sc_file_free(file);
}
}
return r < 0 ? r : 0;