dumping chat

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@532 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2011-09-20 19:41:31 +00:00
parent d8e2eb9afc
commit 93d727841e

View File

@@ -871,6 +871,7 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
__u8 *p;
BIO *bio_stdout = NULL;
CVC_CERTIFICATE_DESCRIPTION *desc = NULL;
CVC_CHAT *chat = NULL;
memset(&pace_input, 0, sizeof pace_input);
memset(&pace_output, 0, sizeof pace_output);
@@ -885,6 +886,13 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
bin_log(ctx, SC_LOG_DEBUG_VERBOSE, "EstablishPACEChannel InBuffer",
abData, abDatalen);
bio_stdout = BIO_new_fp(stdout, BIO_NOCLOSE);
if (!bio_stdout) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Could not get output buffer");
sc_result = SC_ERROR_INTERNAL;
goto err;
}
if (abDatalen < parsed+1) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Buffer too small, could not get PinID");
sc_result = SC_ERROR_INVALID_ARGUMENTS;
@@ -909,10 +917,26 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
}
pace_input.chat = &abData[parsed];
parsed += pace_input.chat_length;
if (pace_input.chat_length)
if (pace_input.chat_length) {
bin_log(ctx, SC_LOG_DEBUG_VERBOSE, "Card holder authorization template",
pace_input.chat, pace_input.chat_length);
chat = d2i_CVC_CHAT(NULL,
&pace_input.chat,
pace_input.chat_length);
if (!chat) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Could not parse CHAT");
sc_result = SC_ERROR_INTERNAL;
goto err;
}
if (!cvc_chat_print(bio_stdout, chat, 4)) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Could not print CHAT");
sc_result = SC_ERROR_INTERNAL;
goto err;
}
}
if (abDatalen < parsed+1) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Buffer too small, could not get lengthPIN");
@@ -962,8 +986,7 @@ perform_PC_to_RDR_Secure_EstablishPACEChannel(sc_card_t *card,
goto err;
}
bio_stdout = BIO_new_fp(stdout, BIO_NOCLOSE);
if (!bio_stdout || !certificate_description_print(bio_stdout, desc, 4)) {
if (!certificate_description_print(bio_stdout, desc, 4)) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, "Could not print Certificate Description");
sc_result = SC_ERROR_INTERNAL;
goto err;
@@ -1111,6 +1134,8 @@ err:
BIO_free_all(bio_stdout);
if (desc)
CVC_CERTIFICATE_DESCRIPTION_free(desc);
if (chat)
CVC_CHAT_free(chat);
return sc_result;
}