emulator fix #125: thanks to Thomas Harning: emulator specific 'clear' handler

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@4255 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
viktor.tarasov 2010-04-18 16:38:49 +00:00
parent 07c98da3a8
commit be3670600b
3 changed files with 19 additions and 1 deletions

View File

@ -99,6 +99,7 @@ static int sc_oberthur_parse_publicinfo (struct sc_pkcs15_card *, unsigned char
static int sc_oberthur_parse_privateinfo (struct sc_pkcs15_card *, unsigned char *, size_t, int);
static int sc_awp_parse_df(struct sc_pkcs15_card *, struct sc_pkcs15_df *);
static void sc_awp_clear(struct sc_pkcs15_card *);
struct crypto_container {
unsigned id_pub;
@ -939,7 +940,8 @@ sc_pkcs15emu_oberthur_init(struct sc_pkcs15_card * p15card)
sc_bin_to_hex(card->serialnr.value, card->serialnr.len, serial, sizeof(serial), 0);
p15card->serial_number = strdup(serial);
p15card->ops.parse_df = sc_awp_parse_df;
p15card->ops.parse_df = sc_awp_parse_df;
p15card->ops.clear = sc_awp_clear;
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Oberthur init: serial %s", p15card->serial_number);
@ -1106,3 +1108,10 @@ sc_awp_parse_df(struct sc_pkcs15_card *p15card, struct sc_pkcs15_df *df)
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_NORMAL, rv);
}
static void
sc_awp_clear(struct sc_pkcs15_card *p15card)
{
SC_FUNC_CALLED(p15card->card->ctx, SC_LOG_DEBUG_VERBOSE);
}

View File

@ -424,6 +424,10 @@ void sc_pkcs15_card_free(struct sc_pkcs15_card *p15card)
if (p15card == NULL)
return;
assert(p15card->magic == SC_PKCS15_CARD_MAGIC);
if (p15card->ops.clear)
p15card->ops.clear(p15card);
while (p15card->obj_list) {
struct sc_pkcs15_object *obj = p15card->obj_list;
@ -466,6 +470,10 @@ void sc_pkcs15_card_clear(sc_pkcs15_card_t *p15card)
{
if (p15card == NULL)
return;
if (p15card->ops.clear)
p15card->ops.clear(p15card);
p15card->version = 0;
p15card->flags = 0;
while (p15card->obj_list) {

View File

@ -401,6 +401,7 @@ typedef struct sc_pkcs15_tokeninfo {
struct sc_pkcs15_operations {
int (*parse_df)(struct sc_pkcs15_card *, struct sc_pkcs15_df *);
void (*clear)(struct sc_pkcs15_card *);
};
typedef struct sc_pkcs15_card {