made bin_log more verbose
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@61 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -44,12 +44,14 @@ static const struct sc_asn1_entry c_sm_rapdu[] = {
|
|||||||
{ NULL, 0, 0, 0, NULL, NULL }
|
{ NULL, 0, 0, 0, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
void bin_log(sc_context_t *ctx, const char *label, const u8 *data, size_t len)
|
void _bin_log(sc_context_t *ctx, int type, const char *file, int line,
|
||||||
|
const char *func, const char *label, const u8 *data, size_t len)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
sc_hex_dump(ctx, data, len, buf, sizeof buf);
|
sc_hex_dump(ctx, data, len, buf, sizeof buf);
|
||||||
sc_debug(ctx, "%s (%u byte%s):\n%s"
|
sc_do_log(ctx, type, file, line, func,
|
||||||
|
"\n%s (%u byte%s):\n%s"
|
||||||
"======================================================================",
|
"======================================================================",
|
||||||
label, len, len==1?"":"s", buf);
|
label, len, len==1?"":"s", buf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,10 @@ int add_iso_pad(const u8 *data, size_t datalen, int block_size, u8 **padded);
|
|||||||
int add_padding(const struct sm_ctx *ctx, const u8 *data, size_t datalen,
|
int add_padding(const struct sm_ctx *ctx, const u8 *data, size_t datalen,
|
||||||
u8 **padded);
|
u8 **padded);
|
||||||
|
|
||||||
void bin_log(sc_context_t *ctx, const char *label, const u8 *data, size_t len);
|
#define bin_log(ctx, label, data, len) \
|
||||||
|
_bin_log(ctx, SC_LOG_TYPE_DEBUG, __FILE__, __LINE__, __FUNCTION__, label, data, len)
|
||||||
|
void _bin_log(sc_context_t *ctx, int type, const char *file, int line,
|
||||||
|
const char *func, const char *label, const u8 *data, size_t len);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user