From 6b04ab76505e33292a9a0e7b247a8c671cae2708 Mon Sep 17 00:00:00 2001 From: vtarasov Date: Fri, 22 Apr 2011 14:00:47 +0000 Subject: [PATCH] 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 --- src/pkcs15init/pkcs15-lib.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/pkcs15init/pkcs15-lib.c b/src/pkcs15init/pkcs15-lib.c index 0cec4f3a..9b9733ae 100644 --- a/src/pkcs15init/pkcs15-lib.c +++ b/src/pkcs15init/pkcs15-lib.c @@ -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;