libopensc: uncomplete changes in c48afdbf
breaks windows builds
This commit is contained in:
parent
9cae888dd8
commit
ff2d88a724
|
@ -164,7 +164,7 @@ static int ctapi_internal_transmit(sc_reader_t *reader,
|
|||
|
||||
if (reader->ctx->flags & SC_CTX_FLAG_TERMINATE)
|
||||
return SC_ERROR_NOT_ALLOWED;
|
||||
|
||||
|
||||
if (control)
|
||||
dad = 1;
|
||||
else
|
||||
|
@ -172,14 +172,14 @@ static int ctapi_internal_transmit(sc_reader_t *reader,
|
|||
|
||||
sad = 2;
|
||||
lr = *recvsize;
|
||||
|
||||
|
||||
rv = priv->funcs.CT_data(priv->ctn, &dad, &sad, (unsigned short)sendsize, (u8 *) sendbuf, &lr, recvbuf);
|
||||
if (rv != 0) {
|
||||
sc_debug(reader->ctx, SC_LOG_DEBUG_NORMAL, "Error transmitting APDU: %d\n", rv);
|
||||
return SC_ERROR_TRANSMIT_FAILED;
|
||||
}
|
||||
*recvsize = lr;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -219,14 +219,14 @@ out:
|
|||
sc_mem_clear(rbuf, rbuflen);
|
||||
free(rbuf);
|
||||
}
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int ctapi_detect_card_presence(sc_reader_t *reader)
|
||||
{
|
||||
int r;
|
||||
|
||||
|
||||
r = refresh_attributes(reader);
|
||||
if (r)
|
||||
return r;
|
||||
|
@ -303,7 +303,7 @@ static struct sc_reader_driver ctapi_drv = {
|
|||
"CT-API module",
|
||||
"ctapi",
|
||||
&ctapi_ops,
|
||||
0, 0, NULL
|
||||
NULL
|
||||
};
|
||||
|
||||
static struct ctapi_module * add_module(struct ctapi_global_private_data *gpriv,
|
||||
|
@ -317,7 +317,7 @@ static struct ctapi_module * add_module(struct ctapi_global_private_data *gpriv,
|
|||
gpriv->modules[i].dlhandle = dlhandle;
|
||||
gpriv->modules[i].ctn_count = 0;
|
||||
gpriv->module_count++;
|
||||
|
||||
|
||||
return &gpriv->modules[i];
|
||||
}
|
||||
|
||||
|
@ -334,8 +334,8 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
u8 cmd[5], rbuf[256], sad, dad;
|
||||
unsigned short lr;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
list = scconf_find_list(conf, "ports");
|
||||
if (list == NULL) {
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "No ports configured.\n");
|
||||
|
@ -366,7 +366,7 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
char rv;
|
||||
sc_reader_t *reader;
|
||||
struct ctapi_private_data *priv;
|
||||
|
||||
|
||||
if (sscanf(list->data, "%d", &port) != 1) {
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "Port '%s' is not a number.\n", list->data);
|
||||
continue;
|
||||
|
@ -376,7 +376,7 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "CT_init() failed with %d\n", rv);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
reader = calloc(1, sizeof(sc_reader_t));
|
||||
priv = calloc(1, sizeof(struct ctapi_private_data));
|
||||
if (!priv || !reader) {
|
||||
|
@ -399,9 +399,9 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
free(reader);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Detect functional units of the reader according to CT-BCS spec version 1.0
|
||||
(14.04.2004, http://www.teletrust.de/down/mct1-0_t4.zip) */
|
||||
|
||||
/* Detect functional units of the reader according to CT-BCS spec version 1.0
|
||||
(14.04.2004, http://www.teletrust.de/down/mct1-0_t4.zip) */
|
||||
cmd[0] = CTBCS_CLA;
|
||||
cmd[1] = CTBCS_INS_STATUS;
|
||||
cmd[2] = CTBCS_P1_CT_KERNEL;
|
||||
|
@ -410,7 +410,7 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
dad = 1;
|
||||
sad = 2;
|
||||
lr = 256;
|
||||
|
||||
|
||||
rv = priv->funcs.CT_data(priv->ctn, &dad, &sad, 5, cmd, &lr, rbuf);
|
||||
if (rv || (lr < 4) || (rbuf[lr-2] != 0x90)) {
|
||||
sc_debug(reader->ctx, SC_LOG_DEBUG_NORMAL, "Error getting status of terminal: %d, using defaults\n", rv);
|
||||
|
@ -483,7 +483,7 @@ static int ctapi_load_module(sc_context_t *ctx,
|
|||
if (priv->ctapi_functional_units & CTAPI_FU_DISPLAY)
|
||||
reader->capabilities |= SC_READER_CAP_DISPLAY;
|
||||
}
|
||||
|
||||
|
||||
ctapi_reset(reader);
|
||||
refresh_attributes(reader);
|
||||
mod->ctn_count++;
|
||||
|
@ -505,7 +505,7 @@ static int ctapi_init(sc_context_t *ctx)
|
|||
if (gpriv == NULL)
|
||||
return SC_ERROR_OUT_OF_MEMORY;
|
||||
ctx->reader_drv_data = gpriv;
|
||||
|
||||
|
||||
for (i = 0; ctx->conf_blocks[i] != NULL; i++) {
|
||||
blocks = scconf_find_blocks(ctx->conf, ctx->conf_blocks[i],
|
||||
"reader_driver", "ctapi");
|
||||
|
@ -521,7 +521,7 @@ static int ctapi_init(sc_context_t *ctx)
|
|||
for (i = 0; blocks != NULL && blocks[i] != NULL; i++)
|
||||
ctapi_load_module(ctx, gpriv, blocks[i]);
|
||||
free(blocks);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -531,10 +531,10 @@ static int ctapi_finish(sc_context_t *ctx)
|
|||
|
||||
if (priv) {
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; i < priv->module_count; i++) {
|
||||
struct ctapi_module *mod = &priv->modules[i];
|
||||
|
||||
|
||||
free(mod->name);
|
||||
sc_dlclose(mod->dlhandle);
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ static int ctapi_finish(sc_context_t *ctx)
|
|||
free(priv->modules);
|
||||
free(priv);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -561,7 +561,7 @@ struct sc_reader_driver * sc_get_ctapi_driver(void)
|
|||
ctapi_ops.perform_verify = ctbcs_pin_cmd;
|
||||
ctapi_ops.perform_pace = NULL;
|
||||
ctapi_ops.use_reader = NULL;
|
||||
|
||||
|
||||
return &ctapi_drv;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -46,7 +46,7 @@ static struct sc_reader_driver openct_reader_driver = {
|
|||
"OpenCT reader",
|
||||
"openct",
|
||||
&openct_ops,
|
||||
0, 0, NULL
|
||||
NULL
|
||||
};
|
||||
|
||||
/* private data structures */
|
||||
|
@ -119,7 +119,7 @@ openct_add_reader(sc_context_t *ctx, unsigned int num, ct_info_t *info)
|
|||
reader->drv_data = data;
|
||||
reader->name = strdup(data->info.ct_name);
|
||||
|
||||
if ((rc = _sc_add_reader(ctx, reader)) < 0) {
|
||||
if ((rc = _sc_add_reader(ctx, reader)) < 0) {
|
||||
free(data);
|
||||
free(reader->name);
|
||||
free(reader);
|
||||
|
@ -160,7 +160,7 @@ static int openct_reader_release(sc_reader_t *reader)
|
|||
reader->drv_data = NULL;
|
||||
free(data);
|
||||
}
|
||||
|
||||
|
||||
return SC_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -321,7 +321,7 @@ out:
|
|||
sc_mem_clear(rbuf, rbuflen);
|
||||
free(rbuf);
|
||||
}
|
||||
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -2093,7 +2093,7 @@ static struct sc_reader_driver cardmod_drv = {
|
|||
"PC/SC cardmod reader",
|
||||
"cardmod",
|
||||
&cardmod_ops,
|
||||
0, 0, NULL
|
||||
NULL
|
||||
};
|
||||
|
||||
static int cardmod_init(sc_context_t *ctx)
|
||||
|
|
Loading…
Reference in New Issue