From c01c85e7ec9a83e782779697408e6b2bfd9e08f8 Mon Sep 17 00:00:00 2001 From: frankmorgner Date: Mon, 12 Apr 2010 07:18:35 +0000 Subject: [PATCH] - added more debugging - bugfix: header of sm apdu is authenticated instead of the original apdu git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@63 96b47cad-a561-4643-ad3b-153ac7d7599c --- ccid/sm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ccid/sm.c b/ccid/sm.c index c0d8b29..20ad154 100644 --- a/ccid/sm.c +++ b/ccid/sm.c @@ -207,11 +207,13 @@ static int format_data(sc_card_t *card, const struct sm_ctx *ctx, goto err; pad_data_len = r; + bin_log(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_error(card->ctx, "Could not encrypt the data"); goto err; } + bin_log(card->ctx, "Cryptogram", *formatted_data, r); r = prefix_buf(ctx->padding_indicator, *formatted_data, r, formatted_data); if (r < 0) @@ -276,7 +278,7 @@ static int sm_encrypt(const struct sm_ctx *ctx, sc_card_t *card, sm_apdu->ins = apdu->ins; sm_apdu->p1 = apdu->p1; sm_apdu->p2 = apdu->p2; - r = format_head(ctx, apdu, &mac_data); + r = format_head(ctx, sm_apdu, &mac_data); if (r < 0) { sc_error(card->ctx, "Could not format header of SM apdu"); goto err;