diff --git a/src/libopensc/card-flex.c b/src/libopensc/card-flex.c index d9470421..000620bb 100644 --- a/src/libopensc/card-flex.c +++ b/src/libopensc/card-flex.c @@ -516,7 +516,7 @@ static int select_file_id(sc_card_t *card, const u8 *buf, size_t buflen, sc_file_t *file; sc_log(card->ctx, "called, p1=%u\n", p1); - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "path", buf, buflen); + sc_log_hex(card->ctx, "path", buf, buflen); sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, p1, 0); apdu.resp = rbuf; diff --git a/src/libopensc/card-mcrd.c b/src/libopensc/card-mcrd.c index 2d7b1cb2..9c38a431 100644 --- a/src/libopensc/card-mcrd.c +++ b/src/libopensc/card-mcrd.c @@ -500,7 +500,7 @@ static int get_se_num_from_keyd(sc_card_t * card, unsigned short fid, len = keyd->datalen; sc_log(ctx, "keyd no %d", keyd->recno); - sc_debug_hex(ctx, SC_LOG_DEBUG_NORMAL, "", p, len); + sc_log_hex(ctx, "", p, len); tag = sc_asn1_find_tag(ctx, p, len, 0x83, &taglen); if (!tag || taglen != 4 || diff --git a/src/libopensc/iso7816.c b/src/libopensc/iso7816.c index f69f480e..900164ad 100644 --- a/src/libopensc/iso7816.c +++ b/src/libopensc/iso7816.c @@ -412,7 +412,7 @@ iso7816_process_fci(struct sc_card *card, struct sc_file *file, memcpy(file->name, p, length); file->namelen = length; - sc_debug_hex(ctx, SC_LOG_DEBUG_NORMAL, " File name:", file->name, file->namelen); + sc_log_hex(ctx, " File name:", file->name, file->namelen); if (!file->type) file->type = SC_FILE_TYPE_DF; } diff --git a/src/libopensc/pkcs15-cac.c b/src/libopensc/pkcs15-cac.c index 5f4a8994..57d5bdec 100644 --- a/src/libopensc/pkcs15-cac.c +++ b/src/libopensc/pkcs15-cac.c @@ -353,7 +353,7 @@ static int sc_pkcs15emu_cac_init(sc_pkcs15_card_t *p15card) sc_log(card->ctx, "cert len=%"SC_FORMAT_LEN_SIZE_T"u, cert_info.path.count=%d r=%d\n", cert_der.len, cert_info.path.count, r); - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "cert", cert_der.value, cert_der.len); + sc_log_hex(card->ctx, "cert", cert_der.value, cert_der.len); /* cache it using the PKCS15 emulation objects */ /* as it does not change */ diff --git a/src/libopensc/reader-pcsc.c b/src/libopensc/reader-pcsc.c index da7d7042..817586fd 100644 --- a/src/libopensc/reader-pcsc.c +++ b/src/libopensc/reader-pcsc.c @@ -525,7 +525,7 @@ static void initialize_uid(sc_reader_t *reader) && apdu.sw1 == 0x90 && apdu.sw2 == 0x00) { reader->uid.len = apdu.resplen; memcpy(reader->uid.value, apdu.resp, reader->uid.len); - sc_debug_hex(reader->ctx, SC_LOG_DEBUG_NORMAL, "UID", + sc_log_hex(reader->ctx, "UID", reader->uid.value, reader->uid.len); } else { sc_log(reader->ctx, "unable to get UID"); @@ -2023,7 +2023,7 @@ pcsc_pin_cmd(sc_reader_t *reader, struct sc_pin_cmd_data *data) /* If PIN block building failed, we fail too */ LOG_TEST_RET(reader->ctx, r, "PC/SC v2 pinpad block building failed!"); /* If not, debug it, just for fun */ - sc_debug_hex(reader->ctx, SC_LOG_DEBUG_NORMAL, "PC/SC v2 pinpad block", sbuf, scount); + sc_log_hex(reader->ctx, "PC/SC v2 pinpad block", sbuf, scount); r = pcsc_internal_transmit(reader, sbuf, scount, rbuf, &rcount, ioctl); diff --git a/src/sm/sm-iso.c b/src/sm/sm-iso.c index b4a312e2..b9dcfc7a 100644 --- a/src/sm/sm-iso.c +++ b/src/sm/sm-iso.c @@ -219,13 +219,13 @@ static int format_data(sc_card_t *card, const struct iso_sm_ctx *ctx, } pad_data_len = r; - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Data to encrypt", pad_data, pad_data_len); + sc_log_hex(card->ctx, "Data to encrypt", pad_data, pad_data_len); r = ctx->encrypt(card, ctx, pad_data, pad_data_len, formatted_data); if (r < 0) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not encrypt the data"); goto err; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Cryptogram", *formatted_data, r); + sc_log_hex(card->ctx, "Cryptogram", *formatted_data, r); if (prepend_padding_indicator) { r = prefix_buf(ctx->padding_indicator, *formatted_data, r, formatted_data); @@ -333,7 +333,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not format Le of SM apdu"); goto err; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Protected Le (plain)", le, le_len); + sc_log_hex(card->ctx, "Protected Le (plain)", le, le_len); break; case SC_APDU_CASE_2_EXT: if (card->reader->active_protocol == SC_PROTO_T0) { @@ -353,7 +353,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, goto err; } } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Protected Le (plain)", le, le_len); + sc_log_hex(card->ctx, "Protected Le (plain)", le, le_len); break; case SC_APDU_CASE_3_SHORT: case SC_APDU_CASE_3_EXT: @@ -368,7 +368,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not format data of SM apdu"); goto err; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Padding-content indicator followed by cryptogram (plain)", + sc_log_hex(card->ctx, "Padding-content indicator followed by cryptogram (plain)", fdata, fdata_len); break; case SC_APDU_CASE_4_SHORT: @@ -380,7 +380,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not format Le of SM apdu"); goto err; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Protected Le (plain)", le, le_len); + sc_log_hex(card->ctx, "Protected Le (plain)", le, le_len); } if (apdu->ins & 1) { @@ -394,7 +394,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not format data of SM apdu"); goto err; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Padding-content indicator followed by cryptogram (plain)", + sc_log_hex(card->ctx, "Padding-content indicator followed by cryptogram (plain)", fdata, fdata_len); break; case SC_APDU_CASE_4_EXT: @@ -411,7 +411,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not format Le of SM apdu"); goto err; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Protected Le (plain)", le, le_len); + sc_log_hex(card->ctx, "Protected Le (plain)", le, le_len); } if (apdu->ins & 1) { @@ -425,7 +425,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Could not format data of SM apdu"); goto err; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Padding-content indicator followed by cryptogram (plain)", + sc_log_hex(card->ctx, "Padding-content indicator followed by cryptogram (plain)", fdata, fdata_len); break; default: @@ -455,7 +455,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, } mac_data_len = r; } - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Data to authenticate", mac_data, mac_data_len); + sc_log_hex(card->ctx, "Data to authenticate", mac_data, mac_data_len); r = ctx->authenticate(card, ctx, mac_data, mac_data_len, &mac); @@ -464,7 +464,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, goto err; } mac_len = r; - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Cryptographic Checksum (plain)", mac, mac_len); + sc_log_hex(card->ctx, "Cryptographic Checksum (plain)", mac, mac_len); /* format SM apdu */ @@ -497,7 +497,7 @@ static int sm_encrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, goto err; } sm_apdu->resp = resp_data; - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "ASN.1 encoded encrypted APDU data", sm_apdu->data, sm_apdu->datalen); + sc_log_hex(card->ctx, "ASN.1 encoded encrypted APDU data", sm_apdu->data, sm_apdu->datalen); *psm_apdu = sm_apdu; @@ -620,7 +620,7 @@ static int sm_decrypt(const struct iso_sm_ctx *ctx, sc_card_t *card, sc_log(card->ctx, "Decrypted APDU sw1=%02x sw2=%02x", apdu->sw1, apdu->sw2); - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Decrypted APDU response data", + sc_log_hex(card->ctx, "Decrypted APDU response data", apdu->resp, apdu->resplen); r = SC_SUCCESS; diff --git a/src/tools/npa-tool.c b/src/tools/npa-tool.c index 7c29b7f3..92b52808 100644 --- a/src/tools/npa-tool.c +++ b/src/tools/npa-tool.c @@ -261,7 +261,7 @@ int npa_translate_apdus(sc_card_t *card, FILE *input) r = sc_bytes2apdu(card->ctx, buf, apdulen, &apdu); if (r < 0) { - sc_debug_hex(card->ctx, SC_LOG_DEBUG_NORMAL, "Invalid C-APDU", buf, apdulen); + sc_log_hex(card->ctx, "Invalid C-APDU", buf, apdulen); continue; }