fixed dead assignment
This commit is contained in:
parent
9c025280a6
commit
1d03000222
|
@ -971,7 +971,6 @@ static int asepcos_pin_cmd(sc_card_t *card, struct sc_pin_cmd_data *pdata,
|
||||||
}
|
}
|
||||||
if (apdu.sw1 != 0x90 || apdu.sw2 != 0x00) {
|
if (apdu.sw1 != 0x90 || apdu.sw2 != 0x00) {
|
||||||
/* unable to verify the old PIN */
|
/* unable to verify the old PIN */
|
||||||
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* 2, step: use CHANGE KEY to update the PIN */
|
/* 2, step: use CHANGE KEY to update the PIN */
|
||||||
|
@ -981,7 +980,6 @@ static int asepcos_pin_cmd(sc_card_t *card, struct sc_pin_cmd_data *pdata,
|
||||||
r = sc_transmit_apdu(card, &apdu);
|
r = sc_transmit_apdu(card, &apdu);
|
||||||
if (r != SC_SUCCESS)
|
if (r != SC_SUCCESS)
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "APDU transmit failed");
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "APDU transmit failed");
|
||||||
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
|
||||||
break;
|
break;
|
||||||
case SC_PIN_CMD_UNBLOCK:
|
case SC_PIN_CMD_UNBLOCK:
|
||||||
if (pdata->pin_type != SC_AC_CHV)
|
if (pdata->pin_type != SC_AC_CHV)
|
||||||
|
@ -1008,7 +1006,6 @@ static int asepcos_pin_cmd(sc_card_t *card, struct sc_pin_cmd_data *pdata,
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "APDU transmit failed");
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "APDU transmit failed");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "error: unknow cmd type");
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "error: unknow cmd type");
|
||||||
|
|
|
@ -1259,7 +1259,6 @@ static int gids_create_keyfile(sc_card_t *card, sc_pkcs15_object_t *object) {
|
||||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INTERNAL);
|
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INTERNAL);
|
||||||
}
|
}
|
||||||
// else can be empty if not record
|
// else can be empty if not record
|
||||||
keymaprecordnum = 0;
|
|
||||||
keymapbuffersize = 0;
|
keymapbuffersize = 0;
|
||||||
} else {
|
} else {
|
||||||
keymaprecordnum = (keymapbuffersize - 1) / sizeof(struct gids_keymap_record);
|
keymaprecordnum = (keymapbuffersize - 1) / sizeof(struct gids_keymap_record);
|
||||||
|
|
|
@ -82,11 +82,10 @@ jpki_finish(sc_card_t * card)
|
||||||
struct jpki_private_data *drvdata = JPKI_DRVDATA(card);
|
struct jpki_private_data *drvdata = JPKI_DRVDATA(card);
|
||||||
|
|
||||||
LOG_FUNC_CALLED(card->ctx);
|
LOG_FUNC_CALLED(card->ctx);
|
||||||
|
if (drvdata) {
|
||||||
if (drvdata->mf) {
|
if (drvdata->mf) {
|
||||||
free(drvdata->mf);
|
free(drvdata->mf);
|
||||||
drvdata->mf = NULL;
|
|
||||||
}
|
}
|
||||||
if (drvdata) {
|
|
||||||
free(drvdata);
|
free(drvdata);
|
||||||
card->drv_data = NULL;
|
card->drv_data = NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -925,6 +925,7 @@ myeid_compute_raw_2048_signature(struct sc_card *card, const u8 * data, size_t d
|
||||||
apdu.data = sbuf;
|
apdu.data = sbuf;
|
||||||
|
|
||||||
r = sc_transmit_apdu(card, &apdu);
|
r = sc_transmit_apdu(card, &apdu);
|
||||||
|
LOG_TEST_RET(card->ctx, r, "APDU transmit failed");
|
||||||
if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) {
|
if (apdu.sw1 == 0x90 && apdu.sw2 == 0x00) {
|
||||||
/* prepare 2nd part of data */
|
/* prepare 2nd part of data */
|
||||||
sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);
|
sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);
|
||||||
|
@ -1270,7 +1271,6 @@ static int myeid_loadkey(sc_card_t *card, int mode, u8* value, int value_len)
|
||||||
|
|
||||||
if(mode == LOAD_KEY_MODULUS && value_len >= 256)
|
if(mode == LOAD_KEY_MODULUS && value_len >= 256)
|
||||||
{
|
{
|
||||||
r=0;
|
|
||||||
if((value_len % 2) > 0 && value[0] == 0x00)
|
if((value_len % 2) > 0 && value[0] == 0x00)
|
||||||
{
|
{
|
||||||
value_len--;
|
value_len--;
|
||||||
|
|
|
@ -3122,12 +3122,12 @@ static int piv_init(sc_card_t *card)
|
||||||
* We want to process them now as this has information on what
|
* We want to process them now as this has information on what
|
||||||
* keys and certs the card has and how the pin might be used.
|
* keys and certs the card has and how the pin might be used.
|
||||||
*/
|
*/
|
||||||
r = piv_process_history(card);
|
piv_process_history(card);
|
||||||
|
|
||||||
r = piv_process_discovery(card);
|
r = piv_process_discovery(card);
|
||||||
|
|
||||||
if (r > 0)
|
if (r > 0)
|
||||||
r = 0;
|
r = 0;
|
||||||
|
|
||||||
LOG_FUNC_RETURN(card->ctx, r);
|
LOG_FUNC_RETURN(card->ctx, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3294,7 +3294,7 @@ piv_pin_cmd(sc_card_t *card, struct sc_pin_cmd_data *data, int *tries_left)
|
||||||
/* if access to applet is know to be reset by other driver we select_aid and try again */
|
/* if access to applet is know to be reset by other driver we select_aid and try again */
|
||||||
if ( priv->card_issues & CI_OTHER_AID_LOSE_STATE && priv->pin_cmd_verify_sw1 == 0x6DU) {
|
if ( priv->card_issues & CI_OTHER_AID_LOSE_STATE && priv->pin_cmd_verify_sw1 == 0x6DU) {
|
||||||
sc_log(card->ctx, "AID may be lost doing piv_find_aid and retry pin_cmd");
|
sc_log(card->ctx, "AID may be lost doing piv_find_aid and retry pin_cmd");
|
||||||
r = piv_find_aid(card, priv->aid_file); /* return not tested */
|
piv_find_aid(card, priv->aid_file); /* return not tested */
|
||||||
|
|
||||||
priv->pin_cmd_verify = 1; /* tell piv_check_sw its a verify to save sw1, sw2 */
|
priv->pin_cmd_verify = 1; /* tell piv_check_sw its a verify to save sw1, sw2 */
|
||||||
r = iso_drv->ops->pin_cmd(card, data, tries_left);
|
r = iso_drv->ops->pin_cmd(card, data, tries_left);
|
||||||
|
|
|
@ -788,10 +788,11 @@ static int msc_compute_crypt_final_object(
|
||||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
|
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "APDU transmit failed");
|
||||||
if(apdu.sw1 == 0x90 && apdu.sw2 == 0x00) {
|
if(apdu.sw1 == 0x90 && apdu.sw2 == 0x00) {
|
||||||
r = msc_read_object(card, inputId, 2, outputData, dataLength);
|
r = msc_read_object(card, inputId, 2, outputData, dataLength);
|
||||||
*outputDataLength = dataLength;
|
if (r >= 0)
|
||||||
|
*outputDataLength = r;
|
||||||
msc_delete_object(card, outputId, 0);
|
msc_delete_object(card, outputId, 0);
|
||||||
msc_delete_object(card, inputId, 0);
|
msc_delete_object(card, inputId, 0);
|
||||||
return 0;
|
return r;
|
||||||
}
|
}
|
||||||
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
r = sc_check_sw(card, apdu.sw1, apdu.sw2);
|
||||||
if (r) {
|
if (r) {
|
||||||
|
|
|
@ -55,6 +55,8 @@ static int sc_pkcs15emu_entersafe_init( sc_pkcs15_card_t *p15card)
|
||||||
|
|
||||||
/* get serial number */
|
/* get serial number */
|
||||||
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
||||||
|
if (r != SC_SUCCESS)
|
||||||
|
return SC_ERROR_INTERNAL;
|
||||||
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
||||||
if (r != SC_SUCCESS)
|
if (r != SC_SUCCESS)
|
||||||
return SC_ERROR_INTERNAL;
|
return SC_ERROR_INTERNAL;
|
||||||
|
|
|
@ -225,6 +225,8 @@ static int sc_pkcs15emu_gemsafeGPK_init(sc_pkcs15_card_t *p15card)
|
||||||
p15card->tokeninfo->manufacturer_id = strdup(MANU_ID);
|
p15card->tokeninfo->manufacturer_id = strdup(MANU_ID);
|
||||||
/* get serial number */
|
/* get serial number */
|
||||||
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
||||||
|
if (r != SC_SUCCESS)
|
||||||
|
return SC_ERROR_INTERNAL;
|
||||||
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
||||||
if (r != SC_SUCCESS)
|
if (r != SC_SUCCESS)
|
||||||
return SC_ERROR_INTERNAL;
|
return SC_ERROR_INTERNAL;
|
||||||
|
|
|
@ -60,7 +60,6 @@ _iasecc_md_update_keyinfo(struct sc_pkcs15_card *p15card, struct sc_pkcs15_objec
|
||||||
LOG_TEST_RET(ctx, rv, "Failed to read container DATA object data");
|
LOG_TEST_RET(ctx, rv, "Failed to read container DATA object data");
|
||||||
|
|
||||||
offs = 0;
|
offs = 0;
|
||||||
rv = SC_ERROR_INVALID_DATA;
|
|
||||||
if (*(ddata->data + offs++) != 0x01) {
|
if (*(ddata->data + offs++) != 0x01) {
|
||||||
sc_pkcs15_free_data_object(ddata);
|
sc_pkcs15_free_data_object(ddata);
|
||||||
LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
|
LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_DATA);
|
||||||
|
|
|
@ -774,7 +774,7 @@ static int infocamere_1600_init(sc_pkcs15_card_t * p15card)
|
||||||
|
|
||||||
/* return to MF */
|
/* return to MF */
|
||||||
sc_format_path("3F00", &path);
|
sc_format_path("3F00", &path);
|
||||||
r = sc_select_file(card, &path, NULL);
|
sc_select_file(card, &path, NULL);
|
||||||
|
|
||||||
return SC_SUCCESS;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -369,12 +369,15 @@ sc_pkcs15emu_openpgp_init(sc_pkcs15_card_t *p15card)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PKCS#15 DATA object from OpenPGP private DOs */
|
/* PKCS#15 DATA object from OpenPGP private DOs */
|
||||||
r = sc_pkcs15emu_openpgp_add_data(p15card);
|
sc_pkcs15emu_openpgp_add_data(p15card);
|
||||||
|
|
||||||
return 0;
|
failed:
|
||||||
|
if (r < 0) {
|
||||||
failed: sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "Failed to initialize OpenPGP emulation: %s\n",
|
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL,
|
||||||
|
"Failed to initialize OpenPGP emulation: %s\n",
|
||||||
sc_strerror(r));
|
sc_strerror(r));
|
||||||
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,6 +164,8 @@ static int sc_pkcs15emu_starcert_init(sc_pkcs15_card_t *p15card)
|
||||||
|
|
||||||
/* get serial number */
|
/* get serial number */
|
||||||
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
||||||
|
if (r != SC_SUCCESS)
|
||||||
|
return SC_ERROR_INTERNAL;
|
||||||
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
||||||
if (r != SC_SUCCESS)
|
if (r != SC_SUCCESS)
|
||||||
return SC_ERROR_INTERNAL;
|
return SC_ERROR_INTERNAL;
|
||||||
|
|
|
@ -54,6 +54,8 @@ static int sc_pkcs15emu_westcos_init(sc_pkcs15_card_t * p15card)
|
||||||
|
|
||||||
/* get serial number */
|
/* get serial number */
|
||||||
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
r = sc_card_ctl(card, SC_CARDCTL_GET_SERIALNR, &serial);
|
||||||
|
if (r)
|
||||||
|
goto out;
|
||||||
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
r = sc_bin_to_hex(serial.value, serial.len, buf, sizeof(buf), 0);
|
||||||
if (r)
|
if (r)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -158,6 +158,8 @@ static void do_esteid(sc_card_t *card)
|
||||||
/* print the counters */
|
/* print the counters */
|
||||||
for (i = 1; i <= 4; i++) {
|
for (i = 1; i <= 4; i++) {
|
||||||
r = sc_read_record(card, i, buff, 128, SC_RECORD_BY_REC_NR);
|
r = sc_read_record(card, i, buff, 128, SC_RECORD_BY_REC_NR);
|
||||||
|
if (r < 0)
|
||||||
|
goto out;
|
||||||
key_used[i - 1] = 0xffffff - ((unsigned char) buff[0xc] * 65536
|
key_used[i - 1] = 0xffffff - ((unsigned char) buff[0xc] * 65536
|
||||||
+ (unsigned char) buff[0xd] * 256
|
+ (unsigned char) buff[0xd] * 256
|
||||||
+ (unsigned char) buff[0xe]);
|
+ (unsigned char) buff[0xe]);
|
||||||
|
|
|
@ -449,6 +449,10 @@ int do_genkey(sc_card_t *card, u8 key_id, unsigned int key_len)
|
||||||
}
|
}
|
||||||
sc_format_path("006E007300C5", &path);
|
sc_format_path("006E007300C5", &path);
|
||||||
r = sc_select_file(card, &path, &file);
|
r = sc_select_file(card, &path, &file);
|
||||||
|
if (r < 0) {
|
||||||
|
printf("Failed to retrieve fingerprints. Error %s.\n", sc_strerror(r));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
r = sc_read_binary(card, 0, fingerprints, 60, 0);
|
r = sc_read_binary(card, 0, fingerprints, 60, 0);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
printf("Failed to retrieve fingerprints. Error %s.\n", sc_strerror(r));
|
printf("Failed to retrieve fingerprints. Error %s.\n", sc_strerror(r));
|
||||||
|
|
|
@ -1072,7 +1072,6 @@ cmdline_parser_internal (
|
||||||
|
|
||||||
int override;
|
int override;
|
||||||
int initialize;
|
int initialize;
|
||||||
int check_required;
|
|
||||||
int check_ambiguity;
|
int check_ambiguity;
|
||||||
|
|
||||||
char *optarg;
|
char *optarg;
|
||||||
|
@ -1084,7 +1083,6 @@ cmdline_parser_internal (
|
||||||
|
|
||||||
override = params->override;
|
override = params->override;
|
||||||
initialize = params->initialize;
|
initialize = params->initialize;
|
||||||
check_required = params->check_required;
|
|
||||||
check_ambiguity = params->check_ambiguity;
|
check_ambiguity = params->check_ambiguity;
|
||||||
|
|
||||||
if (initialize)
|
if (initialize)
|
||||||
|
|
Loading…
Reference in New Issue