From f5d0bc52b332cbae4e231f32b1fb540581e7564a Mon Sep 17 00:00:00 2001 From: Frank Morgner Date: Wed, 25 Mar 2015 07:50:33 +0100 Subject: [PATCH] fixed logging out with PACE reader --- npa/src/card-npa.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/npa/src/card-npa.c b/npa/src/card-npa.c index 04d31ad..be917e3 100644 --- a/npa/src/card-npa.c +++ b/npa/src/card-npa.c @@ -653,7 +653,19 @@ err: static int npa_logout(sc_card_t *card) { + struct sc_apdu apdu; + sm_stop(card); + + if (card->reader->capabilities & SC_READER_CAP_PACE_GENERIC) { + /* If PACE is done between reader and card, SM is transparent to us as + * it ends at the reader. With CLA=0x0C we provoque a SM error to + * disable SM on the reader. */ + sc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0xA4, 0x00, 0x00); + apdu.cla = 0x0C; + sc_transmit_apdu(card, &apdu); + /* ignore result */ + } return sc_select_file(card, sc_get_mf_path(), NULL); }