diff options
Diffstat (limited to 'scd')
-rw-r--r-- | scd/apdu.c | 23 | ||||
-rw-r--r-- | scd/apdu.h | 3 | ||||
-rw-r--r-- | scd/app-openpgp.c | 14 | ||||
-rw-r--r-- | scd/app-p15.c | 4 | ||||
-rw-r--r-- | scd/iso7816.c | 3 |
5 files changed, 25 insertions, 22 deletions
diff --git a/scd/apdu.c b/scd/apdu.c index cd98cc91c..66a16f820 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -473,7 +473,7 @@ dump_reader_status (int slot) if (reader_table[slot].atrlen) { log_info ("slot %d: ATR=", slot); - log_printhex ("", reader_table[slot].atr, reader_table[slot].atrlen); + log_printhex (reader_table[slot].atr, reader_table[slot].atrlen, ""); } } @@ -499,6 +499,7 @@ host_sw_string (long err) case SW_HOST_ABORTED: return "aborted"; case SW_HOST_NO_PINPAD: return "no pinpad"; case SW_HOST_ALREADY_CONNECTED: return "already connected"; + case SW_HOST_CANCELLED: return "cancelled"; default: return "unknown host status error"; } } @@ -605,7 +606,7 @@ pcsc_error_to_sw (long ec) { case 0: rc = 0; break; - case PCSC_E_CANCELLED: rc = SW_HOST_ABORTED; break; + case PCSC_E_CANCELLED: rc = SW_HOST_CANCELLED; break; case PCSC_E_NO_MEMORY: rc = SW_HOST_OUT_OF_CORE; break; case PCSC_E_TIMEOUT: rc = SW_HOST_CARD_IO_ERROR; break; case PCSC_E_NO_SERVICE: @@ -736,7 +737,7 @@ pcsc_send_apdu (int slot, unsigned char *apdu, size_t apdulen, return err; if (DBG_CARD_IO) - log_printhex (" PCSC_data:", apdu, apdulen); + log_printhex (apdu, apdulen, " PCSC_data:"); if ((reader_table[slot].pcsc.protocol & PCSC_PROTOCOL_T1)) send_pci.protocol = PCSC_PROTOCOL_T1; @@ -1440,7 +1441,7 @@ send_apdu_ccid (int slot, unsigned char *apdu, size_t apdulen, return err; if (DBG_CARD_IO) - log_printhex (" raw apdu:", apdu, apdulen); + log_printhex (apdu, apdulen, " raw apdu:"); maxbuflen = *buflen; if (pininfo) @@ -1709,7 +1710,7 @@ my_rapdu_send_apdu (int slot, unsigned char *apdu, size_t apdulen, *buflen = 0; if (DBG_CARD_IO) - log_printhex (" APDU_data:", apdu, apdulen); + log_printhex (apdu, apdulen, " APDU_data:"); if (apdulen < 4) { @@ -2842,7 +2843,7 @@ send_le (int slot, int class, int ins, int p0, int p1, log_debug (" response: sw=%04X datalen=%d\n", sw, (unsigned int)resultlen); if ( !retbuf && (sw == SW_SUCCESS || (sw & 0xff00) == SW_MORE_DATA)) - log_printhex (" dump: ", result, resultlen); + log_printhex (result, resultlen, " dump: "); } if (sw == SW_SUCCESS || sw == SW_EOF_REACHED) @@ -2915,7 +2916,7 @@ send_le (int slot, int class, int ins, int p0, int p1, log_debug (" more: sw=%04X datalen=%d\n", sw, (unsigned int)resultlen); if (!retbuf && (sw==SW_SUCCESS || (sw&0xff00)==SW_MORE_DATA)) - log_printhex (" dump: ", result, resultlen); + log_printhex (result, resultlen, " dump: "); } if ((sw & 0xff00) == SW_MORE_DATA @@ -2961,7 +2962,7 @@ send_le (int slot, int class, int ins, int p0, int p1, xfree (result_buffer); if (DBG_CARD_IO && retbuf && sw == SW_SUCCESS) - log_printhex (" dump: ", *retbuf, *retbuflen); + log_printhex (*retbuf, *retbuflen, " dump: "); return sw; } @@ -3121,7 +3122,7 @@ apdu_send_direct (int slot, size_t extended_length, log_debug (" response: sw=%04X datalen=%d\n", sw, (unsigned int)resultlen); if ( !retbuf && (sw == SW_SUCCESS || (sw & 0xff00) == SW_MORE_DATA)) - log_printhex (" dump: ", result, resultlen); + log_printhex (result, resultlen, " dump: "); } if (handle_more && (sw & 0xff00) == SW_MORE_DATA) @@ -3177,7 +3178,7 @@ apdu_send_direct (int slot, size_t extended_length, log_debug (" more: sw=%04X datalen=%d\n", sw, (unsigned int)resultlen); if (!retbuf && (sw==SW_SUCCESS || (sw&0xff00)==SW_MORE_DATA)) - log_printhex (" dump: ", result, resultlen); + log_printhex (result, resultlen, " dump: "); } if ((sw & 0xff00) == SW_MORE_DATA @@ -3246,7 +3247,7 @@ apdu_send_direct (int slot, size_t extended_length, } if (DBG_CARD_IO && retbuf) - log_printhex (" dump: ", *retbuf, *retbuflen); + log_printhex (*retbuf, *retbuflen, " dump: "); return 0; } diff --git a/scd/apdu.h b/scd/apdu.h index 6751e8c9b..8a0d4bda8 100644 --- a/scd/apdu.h +++ b/scd/apdu.h @@ -71,7 +71,8 @@ enum { SW_HOST_NO_READER = 0x1000c, SW_HOST_ABORTED = 0x1000d, SW_HOST_NO_PINPAD = 0x1000e, - SW_HOST_ALREADY_CONNECTED = 0x1000f + SW_HOST_ALREADY_CONNECTED = 0x1000f, + SW_HOST_CANCELLED = 0x10010 }; struct dev_list; diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 9fcfa191e..c17452555 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -98,7 +98,7 @@ static struct { { 0x0065, 1, 0, 1, 0, 0, 0, 0, "Cardholder Related Data"}, { 0x005B, 0, 0x65, 0, 0, 0, 0, 0, "Name" }, { 0x5F2D, 0, 0x65, 0, 0, 0, 0, 0, "Language preferences" }, - { 0x5F35, 0, 0x65, 0, 0, 0, 0, 0, "Sex" }, + { 0x5F35, 0, 0x65, 0, 0, 0, 0, 0, "Salutation" }, { 0x006E, 1, 0, 1, 0, 0, 0, 0, "Application Related Data" }, { 0x004F, 0, 0x6E, 1, 0, 0, 0, 0, "AID" }, { 0x0073, 1, 0, 1, 0, 0, 0, 0, "Discretionary Data Objects" }, @@ -563,7 +563,7 @@ dump_all_do (int slot) if (data_objects[i].binary) { log_info ("DO '%s': ", data_objects[i].desc); - log_printhex ("", buffer, buflen); + log_printhex (buffer, buflen, ""); } else log_info ("DO '%s': '%.*s'\n", @@ -593,7 +593,7 @@ dump_all_do (int slot) if (valuelen > 200) log_info ("[%u]\n", (unsigned int)valuelen); else - log_printhex ("", value, valuelen); + log_printhex (value, valuelen, ""); } else log_info ("DO '%s': '%.*s'\n", @@ -5081,7 +5081,7 @@ parse_algorithm_attribute (app_t app, int keyno) curve = ecc_curve (buffer + 1, oidlen); if (!curve) - log_printhex ("Curve with OID not supported: ", buffer+1, buflen-1); + log_printhex (buffer+1, buflen-1, "Curve with OID not supported: "); else { app->app_local->keyattr[keyno].key_type = KEY_TYPE_ECC; @@ -5099,7 +5099,7 @@ parse_algorithm_attribute (app_t app, int keyno) } } else if (opt.verbose) - log_printhex ("", buffer, buflen); + log_printhex (buffer, buflen, ""); xfree (relptr); } @@ -5141,7 +5141,7 @@ app_select_openpgp (app_t app) if (opt.verbose) { log_info ("AID: "); - log_printhex ("", buffer, buflen); + log_printhex (buffer, buflen, ""); } app->card_version = buffer[6] << 8; @@ -5174,7 +5174,7 @@ app_select_openpgp (app_t app) if (opt.verbose) { log_info ("Historical Bytes: "); - log_printhex ("", buffer, buflen); + log_printhex (buffer, buflen, ""); } parse_historical (app->app_local, buffer, buflen); xfree (relptr); diff --git a/scd/app-p15.c b/scd/app-p15.c index 0bb5f9e51..190292433 100644 --- a/scd/app-p15.c +++ b/scd/app-p15.c @@ -2274,7 +2274,7 @@ read_ef_tokeninfo (app_t app) } memcpy (app->app_local->serialno, p, objlen); app->app_local->serialnolen = objlen; - log_printhex ("Serialnumber from EF(TokenInfo) is:", p, objlen); + log_printhex (p, objlen, "Serialnumber from EF(TokenInfo) is:"); leave: xfree (buffer); @@ -2781,7 +2781,7 @@ micardo_mse (app_t app, unsigned short fid) gpg_strerror (err)); return err; } - log_printhex ("keyD record:", buffer, buflen); + log_printhex (buffer, buflen, "keyD record:"); p = find_tlv (buffer, buflen, 0x83, &n); if (p && n == 4 && ((p[2]<<8)|p[3]) == fid) { diff --git a/scd/iso7816.c b/scd/iso7816.c index 081b0808c..29208c254 100644 --- a/scd/iso7816.c +++ b/scd/iso7816.c @@ -93,8 +93,9 @@ map_sw (int sw) case SW_HOST_CARD_IO_ERROR: ec = GPG_ERR_EIO; break; case SW_HOST_GENERAL_ERROR: ec = GPG_ERR_GENERAL; break; case SW_HOST_NO_READER: ec = GPG_ERR_ENODEV; break; - case SW_HOST_ABORTED: ec = GPG_ERR_CANCELED; break; + case SW_HOST_ABORTED: ec = GPG_ERR_INV_RESPONSE; break; case SW_HOST_NO_PINPAD: ec = GPG_ERR_NOT_SUPPORTED; break; + case SW_HOST_CANCELLED: ec = GPG_ERR_CANCELED; break; default: if ((sw & 0x010000)) |