示例#1
0
static struct sc_card_driver *sc_get_driver(void)
{
	sc_card_driver_t *iso_drv = sc_get_iso7816_driver();

	if(iso_ops == NULL)
	{
		iso_ops = iso_drv->ops;
	}

	isoApplet_ops = *iso_drv->ops;

	isoApplet_ops.match_card = isoApplet_match_card;
	isoApplet_ops.init = isoApplet_init;
	isoApplet_ops.finish = isoApplet_finish;

	isoApplet_ops.card_ctl = isoApplet_card_ctl;

	isoApplet_ops.create_file = isoApplet_create_file;
	isoApplet_ops.process_fci = isoApplet_process_fci;
	isoApplet_ops.set_security_env = isoApplet_set_security_env;
	isoApplet_ops.compute_signature = isoApplet_compute_signature;
	isoApplet_ops.get_challenge = isoApplet_get_challenge;

	/* unsupported functions */
	isoApplet_ops.write_binary = NULL;
	isoApplet_ops.read_record = NULL;
	isoApplet_ops.write_record = NULL;
	isoApplet_ops.append_record = NULL;
	isoApplet_ops.update_record = NULL;
	isoApplet_ops.restore_security_env = NULL;

	return &isoApplet_drv;
}
示例#2
0
static struct sc_card_driver * sc_get_driver(void)
{
	struct sc_card_driver *iso_drv = sc_get_iso7816_driver();

	default_ops = *iso_drv->ops;
	default_ops.match_card = default_match_card;
	default_ops.init = default_init;

	return &default_drv;
}
示例#3
0
static struct sc_card_driver *sc_get_driver(void)
{
	struct sc_card_driver *iso_drv = sc_get_iso7816_driver();

	javacard_ops = *iso_drv->ops;
	javacard_ops.match_card = javacard_match_card;
	javacard_ops.select_file = NULL;
	javacard_ops.init = javacard_init;
	javacard_ops.finish = javacard_finish;

	return &javacard_drv;
}
示例#4
0
文件: card-jpki.c 项目: jpki/OpenSC
static int
jpki_read_binary(sc_card_t * card, unsigned int idx,
		 u8 * buf, size_t count, unsigned long flags)
{
	struct sc_card_driver *iso_drv = sc_get_iso7816_driver();
	const struct sc_card_operations *iso_ops = iso_drv->ops;
	int rc;

	LOG_FUNC_CALLED(card->ctx);

	rc = iso_ops->read_binary(card, idx, buf, count, flags);
	LOG_FUNC_RETURN(card->ctx, rc);
}
示例#5
0
static struct sc_card_driver *npa_get_driver(void)
{
    struct sc_card_driver *iso_drv = sc_get_iso7816_driver();

    npa_ops = *iso_drv->ops;
    npa_ops.match_card = npa_match_card;
    npa_ops.init = npa_init;
    npa_ops.finish = npa_finish;
    npa_ops.set_security_env = npa_set_security_env;
    npa_ops.pin_cmd = npa_pin_cmd;
    npa_ops.logout = npa_logout;

    return &npa_drv;
}
示例#6
0
文件: card-npa.c 项目: AktivCo/OpenSC
static int npa_standard_pin_cmd(struct sc_card *card,
		struct sc_pin_cmd_data *data, int *tries_left)
{
	int r;
	struct sc_card_driver *iso_drv;

	iso_drv = sc_get_iso7816_driver();

	if (!iso_drv || !iso_drv->ops || !iso_drv->ops->pin_cmd) {
		r = SC_ERROR_INTERNAL;
	} else {
		r = iso_drv->ops->pin_cmd(card, data, tries_left);
	}

	return r;
}
示例#7
0
文件: card-jpki.c 项目: jpki/OpenSC
static struct sc_card_driver *
sc_get_driver(void)
{
	struct sc_card_driver *iso_drv = sc_get_iso7816_driver();

	jpki_ops = *iso_drv->ops;
	jpki_ops.match_card = jpki_match_card;
	jpki_ops.init = jpki_init;
	jpki_ops.finish = jpki_finish;
	jpki_ops.select_file = jpki_select_file;
	jpki_ops.read_binary = jpki_read_binary;
	jpki_ops.pin_cmd = jpki_pin_cmd;
	jpki_ops.set_security_env = jpki_set_security_env;
	jpki_ops.compute_signature = jpki_compute_signature;

	return &jpki_drv;
}
示例#8
0
文件: card-ias.c 项目: pawmas/opensc
static struct sc_card_driver *sc_get_driver(void)
{
	struct sc_card_driver *iso_drv = sc_get_iso7816_driver();

	if (iso_ops == NULL)
		iso_ops = iso_drv->ops;
	/* Use the standard iso operations as default */
	ias_ops = *iso_drv->ops;
	/* IAS specific functions */
	ias_ops.select_file = ias_select_file;
	ias_ops.match_card = ias_match_card;
	ias_ops.init = ias_init;
	ias_ops.set_security_env = ias_set_security_env;
	ias_ops.compute_signature = ias_compute_signature;
	ias_ops.pin_cmd = ias_pin_cmd;

	return &ias_drv;
}
示例#9
0
struct sc_card_driver *sc_get_esteid2018_driver(void) {
	struct sc_card_driver *iso_drv = sc_get_iso7816_driver();

	if (iso_ops == NULL)
		iso_ops = iso_drv->ops;

	esteid_ops = *iso_drv->ops;
	esteid_ops.match_card = esteid_match_card;
	esteid_ops.init = esteid_init;
	esteid_ops.finish = esteid_finish;

	esteid_ops.select_file = esteid_select_file;
	esteid_ops.read_binary = esteid_read_binary;

	esteid_ops.set_security_env = esteid_set_security_env;
	esteid_ops.compute_signature = esteid_compute_signature;
	esteid_ops.pin_cmd = esteid_pin_cmd;

	return &esteid2018_driver;
}
示例#10
0
static struct sc_card_driver *sc_get_driver(void)
{
    struct sc_card_driver *iso_drv = sc_get_iso7816_driver();
    if (!iso_ops)
        iso_ops = iso_drv->ops;
    /* use the standard iso operations as default */
    gemsafe_ops = *iso_drv->ops;
    /* gemsafe specific functions */
    gemsafe_ops.match_card	= gemsafe_match_card;
    gemsafe_ops.init	= gemsafe_init;
    gemsafe_ops.finish	= gemsafe_finish;
    gemsafe_ops.select_file	= gemsafe_select_file;
    gemsafe_ops.restore_security_env = gemsafe_restore_security_env;
    gemsafe_ops.set_security_env     = gemsafe_set_security_env;
    gemsafe_ops.decipher             = gemsafe_decipher;
    gemsafe_ops.compute_signature    = gemsafe_compute_signature;
    gemsafe_ops.get_challenge 		 = gemsafe_get_challenge;
    gemsafe_ops.process_fci	= gemsafe_process_fci;
    gemsafe_ops.pin_cmd		 = gemsafe_pin_cmd;

    return &gemsafe_drv;
}
static struct sc_card_driver * sc_get_driver(void)
{
	struct sc_card_driver *iso_drv = sc_get_iso7816_driver();
	if (iso_ops == NULL)
		iso_ops = iso_drv->ops;
  
	atrust_acos_ops = *iso_drv->ops;
	atrust_acos_ops.match_card = atrust_acos_match_card;
	atrust_acos_ops.init   = atrust_acos_init;
	atrust_acos_ops.finish = atrust_acos_finish;
	atrust_acos_ops.select_file = atrust_acos_select_file;
	atrust_acos_ops.check_sw    = atrust_acos_check_sw;
	atrust_acos_ops.create_file = NULL;
	atrust_acos_ops.delete_file = NULL;
	atrust_acos_ops.set_security_env  = atrust_acos_set_security_env;
	atrust_acos_ops.compute_signature = atrust_acos_compute_signature;
	atrust_acos_ops.decipher    = atrust_acos_decipher;
	atrust_acos_ops.card_ctl    = atrust_acos_card_ctl;
	atrust_acos_ops.logout      = atrust_acos_logout;
  
	return &atrust_acos_drv;
}
示例#12
0
static struct sc_card_driver *sc_get_driver(void)
{
	if (iso_ops == NULL)
		iso_ops = sc_get_iso7816_driver()->ops;

	belpic_ops.match_card = belpic_match_card;
	belpic_ops.init = belpic_init;
	belpic_ops.finish = belpic_finish;

	belpic_ops.update_binary = belpic_update_binary;
	belpic_ops.select_file = belpic_select_file;
	belpic_ops.read_binary = belpic_read_binary;
	belpic_ops.pin_cmd = belpic_pin_cmd;
	belpic_ops.set_security_env = belpic_set_security_env;

	belpic_ops.compute_signature = belpic_compute_signature;
	belpic_ops.get_challenge = iso_ops->get_challenge;
	belpic_ops.get_response = iso_ops->get_response;
	belpic_ops.check_sw = iso_ops->check_sw;

	return &belpic_drv;
}
示例#13
0
文件: card-npa.c 项目: AktivCo/OpenSC
static int npa_set_security_env(struct sc_card *card,
		const struct sc_security_env *env, int se_num)
{
	int r;
	struct sc_card_driver *iso_drv;
	struct sc_security_env fixed_env;

	iso_drv = sc_get_iso7816_driver();

	if (!env || !iso_drv || !iso_drv->ops || !iso_drv->ops->set_security_env) {
		r = SC_ERROR_INTERNAL;
	} else {
		memcpy(&fixed_env, env, sizeof fixed_env);
		if (env->operation == SC_SEC_OPERATION_SIGN) {
			/* The pkcs#15 layer assumes that the field_size of the private key
			 * object is correctly initialized and wants to include it as
			 * algorithm reference. We disable it here */
			fixed_env.flags &= ~SC_SEC_ENV_ALG_REF_PRESENT;
		}
		r = iso_drv->ops->set_security_env(card, &fixed_env, se_num);
	}

	return r;
}