avoid debugging PIN commands

use a higher debug level to see it anyway
This commit is contained in:
Frank Morgner 2020-03-05 22:15:27 +01:00
parent 9681193ad5
commit d06f23e89b
2 changed files with 11 additions and 1 deletions

View File

@ -37,6 +37,7 @@ enum {
SC_LOG_DEBUG_SM, /* secure messaging */
SC_LOG_DEBUG_ASN1, /* asn1.c */
SC_LOG_DEBUG_MATCH, /* card matching */
SC_LOG_DEBUG_PIN, /* PIN commands */
};
#define SC_COLOR_FG_RED 0x0001

View File

@ -192,12 +192,19 @@ int sc_reset_retry_counter(sc_card_t *card, unsigned int type, int ref,
int sc_pin_cmd(sc_card_t *card, struct sc_pin_cmd_data *data,
int *tries_left)
{
int r;
int r, debug;
if (card == NULL) {
return SC_ERROR_INVALID_ARGUMENTS;
}
LOG_FUNC_CALLED(card->ctx);
debug = card->ctx->debug;
if (data->cmd != SC_PIN_CMD_GET_INFO
&& card->ctx->debug < SC_LOG_DEBUG_PIN) {
card->ctx->debug = 0;
}
if (card->ops->pin_cmd) {
r = card->ops->pin_cmd(card, data, tries_left);
} else if (!(data->flags & SC_PIN_CMD_USE_PINPAD)) {
@ -244,6 +251,8 @@ int sc_pin_cmd(sc_card_t *card, struct sc_pin_cmd_data *data,
sc_log(card->ctx, "Use of pin pad not supported by card driver");
r = SC_ERROR_NOT_SUPPORTED;
}
card->ctx->debug = debug;
SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r);
}