Beispiel #1
0
int sc_pkcs15emu_pteid_init_ex(sc_pkcs15_card_t *p15card, sc_pkcs15emu_opt_t *opts)
{
	if (opts != NULL && opts->flags & SC_PKCS15EMU_FLAGS_NO_CHECK)
		return sc_pkcs15emu_pteid_init(p15card);
	else {
		int r = pteid_detect_card(p15card);
		if (r)
			return SC_ERROR_WRONG_CARD;
		return sc_pkcs15emu_pteid_init(p15card);
	}
}
Beispiel #2
0
int sc_pkcs15emu_pteid_init_ex(sc_pkcs15_card_t *p15card, struct sc_aid *aid, sc_pkcs15emu_opt_t *opts)
{
	int r=SC_SUCCESS;
	sc_context_t *ctx = p15card->card->ctx;
	LOG_FUNC_CALLED(ctx);

	/* if no check flag execute unconditionally */
	if (opts && opts->flags & SC_PKCS15EMU_FLAGS_NO_CHECK)
		LOG_FUNC_RETURN(ctx, sc_pkcs15emu_pteid_init(p15card));
	/* check for proper card */
	r = pteid_detect_card(p15card->card);
	if (r == SC_ERROR_WRONG_CARD)
		LOG_FUNC_RETURN(ctx, SC_ERROR_WRONG_CARD);
	/* ok: initialize and return */
	LOG_FUNC_RETURN(ctx, sc_pkcs15emu_pteid_init(p15card));
}