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:
parent
779326b9e5
commit
9f1d63a56c
|
@ -77,6 +77,16 @@ static const char *func_name = "sc_pkcs15_init_func";
|
||||||
static const char *exfunc_name = "sc_pkcs15_init_func_ex";
|
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
|
int
|
||||||
sc_pkcs15_bind_synthetic(sc_pkcs15_card_t *p15card)
|
sc_pkcs15_bind_synthetic(sc_pkcs15_card_t *p15card)
|
||||||
{
|
{
|
||||||
|
|
|
@ -725,7 +725,7 @@ int sc_pkcs15_bind(sc_card_t *card,
|
||||||
enable_emu = scconf_get_bool(conf_block, "enable_pkcs15_emulation", 1);
|
enable_emu = scconf_get_bool(conf_block, "enable_pkcs15_emulation", 1);
|
||||||
if (enable_emu) {
|
if (enable_emu) {
|
||||||
emu_first = scconf_get_bool(conf_block, "try_emulation_first", 0);
|
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);
|
r = sc_pkcs15_bind_synthetic(p15card);
|
||||||
if (r == SC_SUCCESS)
|
if (r == SC_SUCCESS)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
|
@ -675,6 +675,7 @@ typedef struct sc_pkcs15emu_opt {
|
||||||
#define SC_PKCS15EMU_FLAGS_NO_CHECK 0x00000001
|
#define SC_PKCS15EMU_FLAGS_NO_CHECK 0x00000001
|
||||||
|
|
||||||
extern int sc_pkcs15_bind_synthetic(sc_pkcs15_card_t *);
|
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,
|
int sc_pkcs15emu_object_add(sc_pkcs15_card_t *p15card, unsigned int type,
|
||||||
const sc_pkcs15_object_t *obj, const void *data);
|
const sc_pkcs15_object_t *obj, const void *data);
|
||||||
|
|
Loading…
Reference in New Issue