Allow to specify at compile time that a card will work only via pkcs15 emulation. This way no matter what is

configured in the config file (try_emulation_first option) the card is usable via pkcs15 tools.



git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@3099 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
martin 2007-01-05 16:20:50 +00:00
parent 779326b9e5
commit 9f1d63a56c
3 changed files with 12 additions and 1 deletions

View File

@ -77,6 +77,16 @@ static const char *func_name = "sc_pkcs15_init_func";
static const char *exfunc_name = "sc_pkcs15_init_func_ex";
int sc_pkcs15_is_emulation_only(sc_card_t *card)
{
switch (card->type) {
case SC_CARD_TYPE_MCRD_ESTEID:
return 1;
default:
return 0;
}
}
int
sc_pkcs15_bind_synthetic(sc_pkcs15_card_t *p15card)
{

View File

@ -725,7 +725,7 @@ int sc_pkcs15_bind(sc_card_t *card,
enable_emu = scconf_get_bool(conf_block, "enable_pkcs15_emulation", 1);
if (enable_emu) {
emu_first = scconf_get_bool(conf_block, "try_emulation_first", 0);
if (emu_first) {
if (emu_first || sc_pkcs15_is_emulation_only(card)) {
r = sc_pkcs15_bind_synthetic(p15card);
if (r == SC_SUCCESS)
goto done;

View File

@ -675,6 +675,7 @@ typedef struct sc_pkcs15emu_opt {
#define SC_PKCS15EMU_FLAGS_NO_CHECK 0x00000001
extern int sc_pkcs15_bind_synthetic(sc_pkcs15_card_t *);
extern int sc_pkcs15_is_emulation_only(sc_card_t *);
int sc_pkcs15emu_object_add(sc_pkcs15_card_t *p15card, unsigned int type,
const sc_pkcs15_object_t *obj, const void *data);