revert or partially revert some of recent commits

b94c163 - invalid, non-tested
11881a6 -- src/libopensc/card-iasecc.c -- return from select has to be ignored,
3a92bf7 -- src/pkcs11/slot.c -- SEGFAULT issue #373
3a92bf7 -- src/tools/piv-tool.c -- confirmed by author
6759c04 -- src/pkcs15init/pkcs15-lib.c -- file instantiation error has to be ignored
This commit is contained in:
Viktor Tarasov 2015-02-07 18:55:02 +01:00
parent 3a92bf7af5
commit 08eb700b97
7 changed files with 12 additions and 19 deletions

View File

@ -872,8 +872,8 @@ static int asepcos_build_pin_apdu(sc_card_t *card, sc_apdu_t *apdu,
memcpy(p, data->pin1.data, data->pin1.len);
p += data->pin1.len;
} else {
memcpy(p, data->pin2.data, data->pin2.len);
p += data->pin2.len;
memcpy(p, data->pin1.data, data->pin1.len);
p += data->pin1.len;
}
apdu->lc = p - buf;
apdu->datalen = p - buf;

View File

@ -415,7 +415,7 @@ iasecc_init_gemalto(struct sc_card *card)
sc_format_path("3F00", &path);
rv = sc_select_file(card, &path, NULL);
LOG_TEST_RET(ctx, rv, "MF selection error");
/* Result ignored*/
rv = iasecc_parse_ef_atr(card);
sc_log(ctx, "rv %i", rv);
@ -2343,10 +2343,7 @@ iasecc_pin_reset(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_
if (scb & IASECC_SCB_METHOD_SM) {
rv = iasecc_sm_pin_reset(card, se_num, data);
LOG_TEST_RET(ctx, rv, "iasecc_sm_pin_reset() reset PUK error");
if (!need_all)
break;
LOG_FUNC_RETURN(ctx, rv);
}
if (scb & IASECC_SCB_METHOD_EXT_AUTH) {

View File

@ -1311,7 +1311,6 @@ __sc_pkcs15_search_objects(struct sc_pkcs15_card *p15card, unsigned int class_ma
continue;
/* Enumerate the DF's, so p15card->obj_list is
* populated. */
/* FIXME dont ignore errors */
if (SC_SUCCESS != sc_pkcs15_parse_df(p15card, df))
continue;
}

View File

@ -183,7 +183,7 @@ CK_RV card_removed(sc_reader_t * reader)
CK_RV card_detect(sc_reader_t *reader)
{
struct sc_pkcs11_card *p11card = NULL;
int rc, free_p11card = 0;
int rc;
CK_RV rv;
unsigned int i;
int j;
@ -228,7 +228,6 @@ again:
/* Detect the card if it's not known already */
if (p11card == NULL) {
sc_log(context, "%s: First seen the card ", reader->name);
free_p11card = 1;
p11card = (struct sc_pkcs11_card *)calloc(1, sizeof(struct sc_pkcs11_card));
if (!p11card)
return CKR_HOST_MEMORY;
@ -317,9 +316,6 @@ again:
}
}
if (free_p11card)
free(p11card);
sc_log(context, "%s: Detection ended", reader->name);
return CKR_OK;
}

View File

@ -2679,8 +2679,7 @@ sc_pkcs15init_update_any_df(struct sc_pkcs15_card *p15card,
LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "DF missing");
r = sc_profile_get_file_by_path(profile, &df->path, &file);
LOG_TEST_RET(ctx, r, "Failed get file path");
if (file == NULL)
if (r < 0 || file == NULL)
sc_select_file(card, &df->path, &file);
r = sc_pkcs15_encode_df(card->ctx, p15card, df, &buf, &bufsize);

View File

@ -436,6 +436,8 @@ myeid_create_key(struct sc_profile *profile, struct sc_pkcs15_card *p15card,
r = myeid_new_file(profile, card, object->type, key_info->key_reference, &file);
LOG_TEST_RET(ctx, r, "Cannot get new MyEID private key file");
if (file || !file->path.len)
LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, "Cannot determine private key file");
sc_log(ctx, "Key file size %d", keybits);
file->size = keybits;
@ -445,9 +447,6 @@ myeid_create_key(struct sc_profile *profile, struct sc_pkcs15_card *p15card,
file->ef_structure = SC_CARDCTL_MYEID_KEY_EC;
memcpy(&key_info->path.value, &file->path.value, file->path.len);
if (!file->path.len)
LOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS,
"Cannot determine private key file");
key_info->key_reference = file->path.value[file->path.len - 1] & 0xFF;
sc_log(ctx, "Path of MyEID private key file to create %s",

View File

@ -494,8 +494,11 @@ int main(int argc, char * const argv[])
action_count++;
break;
case 'Z':
/*
-Z is the same as -C but -Z says the cert is compressed.
https://github.com/OpenSC/OpenSC/commit/3a92bf7af5aaa85fdbc0434d0a55393e68e0f98d#commitcomment-9636487
*/
compress_cert = 1;
break;
case 'C':
do_load_cert = 1;
cert_id = optarg;