fixed resuming the PIN

initialization of the boxing commands in perform_pace always destroyed
the established security context.
This commit is contained in:
Frank Morgner
2014-02-19 01:05:01 +01:00
parent 68d8a9cf64
commit 6b7d42000b
5 changed files with 18 additions and 13 deletions

View File

@@ -46,11 +46,6 @@
#include "libopensc/apdu.c"
#endif
#ifndef HAVE_LIST_ITERATOR_NEXT
#include "opensc/src/common/simclist.c"
#endif
static const u8 boxing_cla = 0xff;
static const u8 boxing_ins = 0x9a;
static const u8 boxing_p1 = 0x04;
@@ -737,6 +732,11 @@ void sc_detect_boxing_cmds(sc_reader_t *reader)
}
#ifndef DISABLE_GLOBAL_BOXING_INITIALIZATION
#ifndef HAVE_LIST_ITERATOR_NEXT
#include "opensc/src/common/simclist.c"
#endif
void sc_initialize_boxing_cmds(sc_context_t *ctx)
{
sc_reader_t *reader;

View File

@@ -21,6 +21,7 @@
#include "iso-sm-internal.h"
#include "libopensc/internal.h"
#include "libopensc/pace.h"
#include <npa/boxing.h>
#include <npa/npa.h>
#include <string.h>
@@ -61,6 +62,10 @@ static int npa_init(sc_card_t * card)
card->drv_data = NULL;
card->caps |= SC_CARD_CAP_APDU_EXT | SC_CARD_CAP_RNG;
#ifdef DISABLE_GLOBAL_BOXING_INITIALIZATION
sc_detect_boxing_cmds(card->reader);
#endif
return SC_SUCCESS;
}

View File

@@ -370,7 +370,9 @@ main (int argc, char **argv)
exit(1);
}
#ifndef DISABLE_GLOBAL_BOXING_INITIALIZATION
#ifdef DISABLE_GLOBAL_BOXING_INITIALIZATION
sc_detect_boxing_cmds(card->reader);
#else
sc_initialize_boxing_cmds(ctx);
#endif

View File

@@ -1206,10 +1206,6 @@ int perform_pace(sc_card_t *card,
}
}
#ifdef DISABLE_GLOBAL_BOXING_INITIALIZATION
sc_detect_boxing_cmds(card->reader);
#endif
if (card->reader->capabilities & SC_READER_CAP_PACE_GENERIC
&& card->reader->ops->perform_pace) {
r = card->reader->ops->perform_pace(card->reader, &pace_input, pace_output);

View File

@@ -30,9 +30,11 @@ extern "C" {
#define DISABLE_GLOBAL_BOXING_INITIALIZATION
#ifndef DISABLE_GLOBAL_BOXING_INITIALIZATION
/** initialize boxing for all available readers */
/* currently disabled, because the OpenSC PC/SC reader implementation
* allows a transmit only when a card is connected. */
/** initialize boxing for all available readers once on the application
* layer */
/* The OpenSC PC/SC reader implementation allows a transmit only when a
* card is connected. So testing for boxing commands will yield an error
* then. */
void sc_initialize_boxing_cmds(sc_context_t *ctx);
#else
void sc_detect_boxing_cmds(sc_reader_t *reader);