From 85485eb9b076181d47bbe8d2a332a2b4e469a849 Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Fri, 25 Jan 2019 13:54:27 +0100 Subject: [PATCH] fixed unused assignments --- src/libopensc/card-cac1.c | 1 - src/libopensc/card-iasecc.c | 2 +- src/libopensc/card-setcos.c | 1 - src/pkcs11/framework-pkcs15.c | 2 ++ src/pkcs15init/pkcs15-myeid.c | 1 + src/sm/sm-common.c | 3 --- src/tools/iasecc-tool.c | 4 ++++ src/tools/opensc-explorer.c | 2 +- 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/libopensc/card-cac1.c b/src/libopensc/card-cac1.c index 969c1808..8513a30e 100644 --- a/src/libopensc/card-cac1.c +++ b/src/libopensc/card-cac1.c @@ -177,7 +177,6 @@ static int cac_read_binary(sc_card_t *card, unsigned int idx, #endif if (r) goto done; - cert_ptr = val; } else if (cert_len > 0) { priv->cache_buf = malloc(cert_len); if (priv->cache_buf == NULL) { diff --git a/src/libopensc/card-iasecc.c b/src/libopensc/card-iasecc.c index f4cbbfac..8f5be901 100644 --- a/src/libopensc/card-iasecc.c +++ b/src/libopensc/card-iasecc.c @@ -416,7 +416,7 @@ iasecc_init_gemalto(struct sc_card *card) card->caps |= SC_CARD_CAP_USE_FCI_AC; sc_format_path("3F00", &path); - rv = sc_select_file(card, &path, NULL); + sc_select_file(card, &path, NULL); /* Result ignored*/ rv = iasecc_parse_ef_atr(card); diff --git a/src/libopensc/card-setcos.c b/src/libopensc/card-setcos.c index ea085f61..4cf328ad 100644 --- a/src/libopensc/card-setcos.c +++ b/src/libopensc/card-setcos.c @@ -792,7 +792,6 @@ static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len) if (iACLen > len) break; - iPinCount = -1; /* default no pin required */ iMethod = SC_AC_NONE; /* default no authentication required */ if (buf[iOffset] & 0X80) { /* AC in adaptive coding */ diff --git a/src/pkcs11/framework-pkcs15.c b/src/pkcs11/framework-pkcs15.c index e94201a0..c7c8f1b6 100644 --- a/src/pkcs11/framework-pkcs15.c +++ b/src/pkcs11/framework-pkcs15.c @@ -5705,6 +5705,8 @@ register_mechanisms(struct sc_pkcs11_card *p11card) if (aes_max_key_size > 0) { rc = sc_pkcs11_register_aes_mechanisms(p11card, aes_flags, aes_min_key_size, aes_max_key_size); + if (rc != CKR_OK) + return rc; } diff --git a/src/pkcs15init/pkcs15-myeid.c b/src/pkcs15init/pkcs15-myeid.c index 304b0dd7..095b4fe5 100644 --- a/src/pkcs15init/pkcs15-myeid.c +++ b/src/pkcs15init/pkcs15-myeid.c @@ -654,6 +654,7 @@ myeid_create_key(struct sc_profile *profile, struct sc_pkcs15_card *p15card, /* TODO: add other flags, like CKA_TRUSTED and CKA_WRAP_WITH_TRUSTED */ r = sc_file_set_prop_attr(file, prop_info, 2); + LOG_TEST_RET(ctx, r, "Cannot create MyEID key file"); /* Now create the key file */ r = sc_pkcs15init_create_file(profile, p15card, file); diff --git a/src/sm/sm-common.c b/src/sm/sm-common.c index 43e1fb15..ecd6ef12 100644 --- a/src/sm/sm-common.c +++ b/src/sm/sm-common.c @@ -162,7 +162,6 @@ DES_cbc_cksum_3des_emv96(const unsigned char *in, DES_cblock *output, tin0^=tout0; tin[0]=tin0; tin1^=tout1; tin[1]=tin1; DES_encrypt3((DES_LONG *)tin,schedule,schedule2,schedule); - tout0=tin[0]; tout1=tin[1]; if (out != NULL) @@ -170,7 +169,6 @@ DES_cbc_cksum_3des_emv96(const unsigned char *in, DES_cblock *output, l2c(tout0,out); l2c(tout1,out); } - tout0=tin0=tin1=tin[0]=tin[1]=0; /* Transform the data in tout1 so that it will match the return value that the MIT Kerberos @@ -220,7 +218,6 @@ DES_cbc_cksum_3des(const unsigned char *in, DES_cblock *output, l2c(tout0,out); l2c(tout1,out); } - tout0=tin0=tin1=tin[0]=tin[1]=0; /* Transform the data in tout1 so that it will match the return value that the MIT Kerberos diff --git a/src/tools/iasecc-tool.c b/src/tools/iasecc-tool.c index 6b1d0111..b12a5f18 100644 --- a/src/tools/iasecc-tool.c +++ b/src/tools/iasecc-tool.c @@ -265,6 +265,10 @@ int main(int argc, char *argv[]) else if (!do_list_sdos) { r = sc_pkcs15_bind(card, NULL, &p15card); } + if (r != SC_SUCCESS) { + fprintf(stderr, "Failed to bind card: %s\n", sc_strerror(r)); + goto end; + } if (do_list_sdos) { if ((err = list_sdos(opt_sdo_tag))) diff --git a/src/tools/opensc-explorer.c b/src/tools/opensc-explorer.c index ea2163fb..a4edb88f 100644 --- a/src/tools/opensc-explorer.c +++ b/src/tools/opensc-explorer.c @@ -2104,7 +2104,7 @@ int main(int argc, char *argv[]) int r, c, long_optind = 0, err = 0; sc_context_param_t ctx_param; int lcycle = SC_CARDCTRL_LIFECYCLE_ADMIN; - FILE *script = stdin; + FILE *script; printf("OpenSC Explorer version %s\n", sc_get_version());