fixed resuming the PIN
initialization of the boxing commands in perform_pace always destroyed the established security context.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user