From b4cfb14e4cbefb831e8f5a63615bd263f821c399 Mon Sep 17 00:00:00 2001 From: Viktor Tarasov Date: Sun, 1 Jan 2017 13:55:25 +0100 Subject: [PATCH] asn1: print in log part of raw data to decode closes #926 --- src/libopensc/asn1.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/libopensc/asn1.c b/src/libopensc/asn1.c index 358e4c5c..9b931433 100644 --- a/src/libopensc/asn1.c +++ b/src/libopensc/asn1.c @@ -1260,7 +1260,10 @@ static int asn1_decode_entry(sc_context_t *ctx,struct sc_asn1_entry *entry, callback_func = parm; - sc_debug(ctx, SC_LOG_DEBUG_ASN1, "%*.*sdecoding '%s'\n", depth, depth, "", entry->name); + sc_debug(ctx, SC_LOG_DEBUG_ASN1, "%*.*sdecoding '%s', raw data:%s%s\n", + depth, depth, "", entry->name, + sc_dump_hex(obj, objlen > 16 ? 16 : objlen), + objlen > 16 ? "..." : ""); switch (entry->type) { case SC_ASN1_STRUCT: @@ -1482,7 +1485,7 @@ static int asn1_decode(sc_context_t *ctx, struct sc_asn1_entry *asn1, obj = sc_asn1_skip_tag(ctx, &p, &left, entry->tag, &objlen); if (obj == NULL) { - sc_debug(ctx, SC_LOG_DEBUG_ASN1, "not present\n"); + sc_debug(ctx, SC_LOG_DEBUG_ASN1, "'%s' not present\n", entry->name); if (choice) continue; if (entry->flags & SC_ASN1_OPTIONAL)