- Somewhat improved debugging output

- sc_pkcs15_print_id changed to sprintf to a buffer rather than printing
  to stdout.


git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1612 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
okir 2003-11-19 20:30:44 +00:00
parent 519c1e8e55
commit 1780e10bf2
1 changed files with 19 additions and 5 deletions

View File

@ -538,6 +538,19 @@ int sc_pkcs15_bind(struct sc_card *card,
sc_error(card->ctx, "Unable to parse ODF\n");
goto error;
}
if (card->ctx->debug) {
sc_pkcs15_df_t *df;
sc_debug(card->ctx, "The following DFs were found:\n");
for (df = p15card->df_list; df; df = df->next) {
sc_debug(card->ctx,
" DF type %u, path %s, index %u, count %d\n",
df->type, sc_print_path(&df->path),
df->path.index, df->path.count);
}
}
if (p15card->file_tokeninfo == NULL) {
tmppath = p15card->file_app->path;
sc_append_path_id(&tmppath, (const u8 *) "\x50\x32", 2);
@ -1172,7 +1185,8 @@ int sc_pkcs15_read_file(struct sc_pkcs15_card *p15card,
int r = -1;
assert(p15card != NULL && in_path != NULL && buf != NULL);
SC_FUNC_CALLED(p15card->card->ctx, 1);
sc_debug(p15card->card->ctx, "called, path=%s, index=%u, count=%d\n",
sc_print_path(in_path), in_path->index, in_path->count);
if (in_path->type == SC_PATH_TYPE_FILE_ID)
{
@ -1252,12 +1266,12 @@ void sc_pkcs15_format_id(const char *str, struct sc_pkcs15_id *id)
id->len = len;
}
void sc_pkcs15_print_id(const struct sc_pkcs15_id *id)
const char *sc_pkcs15_print_id(const struct sc_pkcs15_id *id)
{
size_t i;
static char buffer[256];
for (i = 0; i < id->len; i++)
printf("%02X", id->value[i]);
sc_bin_to_hex(id->value, id->len, buffer, sizeof(buffer), '\0');
return buffer;
}
int sc_pkcs15_hex_string_to_id(const char *in, struct sc_pkcs15_id *out)