fixed dead assignments
This commit is contained in:
parent
45be3da23f
commit
f4946df4e9
|
@ -659,8 +659,6 @@ static int escape_perform_verify(struct sc_reader *reader,
|
|||
}
|
||||
apdu.lc = apdu.datalen;
|
||||
|
||||
r = SC_SUCCESS;
|
||||
|
||||
r = reader->ops->transmit(reader, &apdu);
|
||||
if (r < 0) {
|
||||
sc_debug(reader->ctx, SC_LOG_DEBUG_NORMAL,
|
||||
|
|
|
@ -292,6 +292,8 @@ static int entersafe_create_pin(sc_profile_t *profile, sc_pkcs15_card_t *p15card
|
|||
data.key_data.symmetric.key_len=16;
|
||||
|
||||
r = sc_card_ctl(card, SC_CARDCTL_ENTERSAFE_WRITE_KEY, &data);
|
||||
if (r < 0)
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r);
|
||||
|
||||
/* Cache new PIN value. */
|
||||
sc_pkcs15_pincache_add(p15card, pin_obj, pin, pin_len);
|
||||
|
@ -316,7 +318,7 @@ static int entersafe_create_pin(sc_profile_t *profile, sc_pkcs15_card_t *p15card
|
|||
}
|
||||
|
||||
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE,r);
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r);
|
||||
}
|
||||
|
||||
static int entersafe_key_reference(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
|
||||
|
|
|
@ -122,6 +122,8 @@ static int epass2003_pkcs15_create_dir(struct sc_profile *profile,
|
|||
"Get SKey info failed");
|
||||
ret = sc_create_file(card, skey_file);
|
||||
sc_file_free(skey_file);
|
||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, ret,
|
||||
"Create SKey info failed");
|
||||
|
||||
ret = sc_profile_get_file(profile, "MAXPIN", &ef_file);
|
||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, ret,
|
||||
|
@ -250,6 +252,8 @@ static int epass2003_pkcs15_create_pin(struct sc_profile *profile,
|
|||
data.key_data.es_secret.key_len = pin_len;
|
||||
|
||||
r = sc_card_ctl(card, SC_CARDCTL_ENTERSAFE_WRITE_KEY, &data);
|
||||
if (r < 0)
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r);
|
||||
if (pin_obj) {
|
||||
/* Cache new PIN value. */
|
||||
sc_pkcs15_pincache_add(p15card, pin_obj, pin, pin_len);
|
||||
|
@ -444,7 +448,7 @@ static int epass2003_pkcs15_store_key(struct sc_profile *profile,
|
|||
sc_print_path(&(file->path)));
|
||||
sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, "private key_info path: %s",
|
||||
sc_print_path(&(key_info->path)));
|
||||
r = sc_delete_file(p15card->card, &file->path);
|
||||
sc_delete_file(p15card->card, &file->path);
|
||||
/* create */
|
||||
r = sc_pkcs15init_create_file(profile, p15card, file);
|
||||
SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r,
|
||||
|
@ -528,7 +532,7 @@ static int epass2003_pkcs15_generate_key(struct sc_profile *profile,
|
|||
SC_TEST_GOTO_ERR(card->ctx, SC_LOG_DEBUG_NORMAL, r,
|
||||
"generate key: pkcs15init_authenticate(SC_AC_OP_DELETE) failed");
|
||||
|
||||
r = sc_delete_file(p15card->card, &file->path);
|
||||
sc_delete_file(p15card->card, &file->path);
|
||||
/* create */
|
||||
r = sc_pkcs15init_create_file(profile, p15card, file);
|
||||
SC_TEST_GOTO_ERR(card->ctx, SC_LOG_DEBUG_NORMAL, r,
|
||||
|
|
|
@ -609,7 +609,7 @@ isoApplet_generate_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
|
|||
|
||||
/* Authentication stuff. */
|
||||
r = sc_profile_get_file_by_path(profile, &key_info->path, &privKeyFile);
|
||||
if(!privKeyFile)
|
||||
if(r < 0 || !privKeyFile)
|
||||
{
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
@ -692,7 +692,7 @@ isoApplet_store_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_pkcs15_
|
|||
|
||||
/* Authentication stuff. */
|
||||
r = sc_profile_get_file_by_path(profile, &key_info->path, &privKeyFile);
|
||||
if(!privKeyFile)
|
||||
if(r < 0 || !privKeyFile)
|
||||
{
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_NOT_SUPPORTED);
|
||||
}
|
||||
|
|
|
@ -177,7 +177,8 @@ muscle_store_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
|
|||
/* Verification stuff */
|
||||
/* Used for verification AND for obtaining private key acls */
|
||||
r = sc_profile_get_file_by_path(profile, &key_info->path, &prkf);
|
||||
if(!prkf) SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE,SC_ERROR_NOT_SUPPORTED);
|
||||
if (r < 0 || !prkf)
|
||||
SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE,SC_ERROR_NOT_SUPPORTED);
|
||||
r = sc_pkcs15init_authenticate(profile, p15card, prkf, SC_AC_OP_CRYPTO);
|
||||
if (r < 0) {
|
||||
sc_file_free(prkf);
|
||||
|
@ -241,7 +242,8 @@ muscle_generate_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card,
|
|||
/* Verification stuff */
|
||||
/* Used for verification AND for obtaining private key acls */
|
||||
r = sc_profile_get_file_by_path(profile, &key_info->path, &prkf);
|
||||
if(!prkf) SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE,SC_ERROR_NOT_SUPPORTED);
|
||||
if(r < 0 || !prkf)
|
||||
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE,SC_ERROR_NOT_SUPPORTED);
|
||||
r = sc_pkcs15init_authenticate(profile, p15card, prkf, SC_AC_OP_CRYPTO);
|
||||
if (r < 0) {
|
||||
sc_file_free(prkf);
|
||||
|
|
|
@ -182,7 +182,7 @@ cosm_erase_card(struct sc_profile *profile, struct sc_pkcs15_card *p15card)
|
|||
}
|
||||
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "erase file ddf %04X",df->id);
|
||||
rv = cosm_delete_file(p15card, profile, df);
|
||||
cosm_delete_file(p15card, profile, df);
|
||||
|
||||
if (sc_profile_get_file(profile, "private-DF", &dir) >= 0) {
|
||||
sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "erase file dir %04X",dir->id);
|
||||
|
|
|
@ -60,7 +60,7 @@ static int westcos_pkcs15init_create_dir(sc_profile_t *profile,
|
|||
int r;
|
||||
|
||||
/* Create the application DF */
|
||||
r = sc_pkcs15init_create_file(profile, p15card, df);
|
||||
sc_pkcs15init_create_file(profile, p15card, df);
|
||||
|
||||
r = sc_select_file(p15card->card, &df->path, NULL);
|
||||
if(r) return r;
|
||||
|
|
|
@ -576,6 +576,8 @@ static int npa_mse_set_at_pace(sc_card_t *card, int protocol,
|
|||
|
||||
r = npa_mse_set_at(card, 0xC1, protocol, &key, sizeof key, NULL,
|
||||
0, NULL, 0, NULL, 0, chat, sw1, sw2);
|
||||
if (0 > r)
|
||||
goto err;
|
||||
|
||||
if (*sw1 == 0x63) {
|
||||
if ((*sw2 & 0xc0) == 0xc0) {
|
||||
|
@ -599,6 +601,7 @@ static int npa_mse_set_at_pace(sc_card_t *card, int protocol,
|
|||
r = sc_check_sw(card, *sw1, *sw2);
|
||||
}
|
||||
|
||||
err:
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ int main(int argc, char *argv[])
|
|||
struct timeval tv1, tv2;
|
||||
u8 buf[14];
|
||||
|
||||
i = sc_test_init(&argc, argv);
|
||||
sc_test_init(&argc, argv);
|
||||
for (i = 0; i < 39; i++)
|
||||
freq[i] = 0;
|
||||
c = 0;
|
||||
|
|
|
@ -390,12 +390,13 @@ main (int argc, char **argv)
|
|||
pin = getenv("PIN");
|
||||
puk = getenv("PUK");
|
||||
newpin = getenv("NEWPIN");
|
||||
} else {
|
||||
can = cmdline.can_arg;
|
||||
mrz = cmdline.mrz_arg;
|
||||
pin = cmdline.pin_arg;
|
||||
puk = cmdline.puk_arg;
|
||||
newpin = cmdline.new_pin_arg;
|
||||
}
|
||||
can = cmdline.can_arg;
|
||||
mrz = cmdline.mrz_arg;
|
||||
pin = cmdline.pin_arg;
|
||||
puk = cmdline.puk_arg;
|
||||
newpin = cmdline.new_pin_arg;
|
||||
if (cmdline.chat_given) {
|
||||
pace_input.chat = chat;
|
||||
pace_input.chat_length = sizeof chat;
|
||||
|
|
|
@ -285,7 +285,7 @@ static int decipher(struct sc_pkcs15_object *obj)
|
|||
}
|
||||
r = write_output(out, r);
|
||||
|
||||
return 0;
|
||||
return r;
|
||||
}
|
||||
|
||||
static int get_key(unsigned int usage, sc_pkcs15_object_t **result)
|
||||
|
|
Loading…
Reference in New Issue