moved sm_stop() to OpenSC as sc_sm_stop()
This commit is contained in:
@@ -57,8 +57,8 @@ LIBS="$LDFLAGS $OPENSC_LIBS"
|
|||||||
|
|
||||||
AC_CHECK_HEADERS([libopensc/opensc.h libopensc/sm.h libopensc/pace.h],
|
AC_CHECK_HEADERS([libopensc/opensc.h libopensc/sm.h libopensc/pace.h],
|
||||||
[], [AC_MSG_ERROR([OpenSC headers not found])])
|
[], [AC_MSG_ERROR([OpenSC headers not found])])
|
||||||
AC_MSG_CHECKING([for iasecc_sm_external_authentication])
|
AC_MSG_CHECKING([for sc_sm_stop])
|
||||||
AC_TRY_LINK_FUNC(iasecc_sm_external_authentication,
|
AC_TRY_LINK_FUNC(sc_sm_stop,
|
||||||
[ AC_MSG_RESULT([yes]) ],
|
[ AC_MSG_RESULT([yes]) ],
|
||||||
[ AC_MSG_ERROR([Cannot link against libopensc with SM]) ])
|
[ AC_MSG_ERROR([Cannot link against libopensc with SM]) ])
|
||||||
AC_CHECK_FUNCS([sc_apdu_get_octets _sc_match_atr list_iterator_next])
|
AC_CHECK_FUNCS([sc_apdu_get_octets _sc_match_atr list_iterator_next])
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "iso-sm-internal.h"
|
#include "iso-sm-internal.h"
|
||||||
#include "libopensc/internal.h"
|
#include "libopensc/internal.h"
|
||||||
#include "libopensc/pace.h"
|
#include "libopensc/pace.h"
|
||||||
|
#include "libopensc/sm.h"
|
||||||
#include "card-npa.h"
|
#include "card-npa.h"
|
||||||
#include <npa/boxing.h>
|
#include <npa/boxing.h>
|
||||||
#include <npa/npa.h>
|
#include <npa/npa.h>
|
||||||
@@ -377,7 +378,7 @@ err:
|
|||||||
|
|
||||||
static int npa_finish(sc_card_t * card)
|
static int npa_finish(sc_card_t * card)
|
||||||
{
|
{
|
||||||
sm_stop(card);
|
sc_sm_stop(card);
|
||||||
npa_drv_data_free(card->drv_data);
|
npa_drv_data_free(card->drv_data);
|
||||||
card->drv_data = NULL;
|
card->drv_data = NULL;
|
||||||
EAC_cleanup();
|
EAC_cleanup();
|
||||||
@@ -655,7 +656,7 @@ static int npa_logout(sc_card_t *card)
|
|||||||
{
|
{
|
||||||
struct sc_apdu apdu;
|
struct sc_apdu apdu;
|
||||||
|
|
||||||
sm_stop(card);
|
sc_sm_stop(card);
|
||||||
|
|
||||||
if (card->reader->capabilities & SC_READER_CAP_PACE_GENERIC) {
|
if (card->reader->capabilities & SC_READER_CAP_PACE_GENERIC) {
|
||||||
/* If PACE is done between reader and card, SM is transparent to us as
|
/* If PACE is done between reader and card, SM is transparent to us as
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <libopensc/sm.h>
|
||||||
#include <npa/iso-sm.h>
|
#include <npa/iso-sm.h>
|
||||||
#include <npa/npa.h>
|
#include <npa/npa.h>
|
||||||
#include <npa/scutil.h>
|
#include <npa/scutil.h>
|
||||||
@@ -127,7 +128,7 @@ err:
|
|||||||
if (pace_output.id_pcd)
|
if (pace_output.id_pcd)
|
||||||
free(pace_output.id_pcd);
|
free(pace_output.id_pcd);
|
||||||
|
|
||||||
sm_stop(card);
|
sc_sm_stop(card);
|
||||||
sc_reset(card, 1);
|
sc_reset(card, 1);
|
||||||
sc_disconnect_card(card);
|
sc_disconnect_card(card);
|
||||||
sc_release_context(ctx);
|
sc_release_context(ctx);
|
||||||
|
|||||||
@@ -720,20 +720,6 @@ int iso_sm_start(struct sc_card *card, struct iso_sm_ctx *sctx)
|
|||||||
return SC_SUCCESS;
|
return SC_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sm_stop(struct sc_card *card)
|
|
||||||
{
|
|
||||||
int r = SC_SUCCESS;
|
|
||||||
|
|
||||||
if (card) {
|
|
||||||
if (card->sm_ctx.sm_mode == SM_MODE_TRANSMIT
|
|
||||||
&& card->sm_ctx.ops.close)
|
|
||||||
r = card->sm_ctx.ops.close(card);
|
|
||||||
card->sm_ctx.sm_mode = SM_MODE_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
int iso_sm_close(struct sc_card *card)
|
int iso_sm_close(struct sc_card *card)
|
||||||
@@ -760,9 +746,4 @@ int iso_sm_start(struct sc_card *card, struct iso_sm_ctx *sctx)
|
|||||||
return SC_ERROR_NOT_SUPPORTED;
|
return SC_ERROR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sm_stop(struct sc_card *card)
|
|
||||||
{
|
|
||||||
return SC_ERROR_NOT_SUPPORTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
#include <eac/pace.h>
|
#include <eac/pace.h>
|
||||||
#include <libopensc/log.h>
|
#include <libopensc/log.h>
|
||||||
#include <libopensc/opensc.h>
|
#include <libopensc/opensc.h>
|
||||||
|
#include <libopensc/sm.h>
|
||||||
#include <npa/boxing.h>
|
#include <npa/boxing.h>
|
||||||
#include <npa/iso-sm.h>
|
#include <npa/iso-sm.h>
|
||||||
#include <npa/npa.h>
|
#include <npa/npa.h>
|
||||||
@@ -790,7 +791,7 @@ err:
|
|||||||
if (templates)
|
if (templates)
|
||||||
ASN1_AUXILIARY_DATA_free(templates);
|
ASN1_AUXILIARY_DATA_free(templates);
|
||||||
|
|
||||||
sm_stop(card);
|
sc_sm_stop(card);
|
||||||
sc_reset(card, 1);
|
sc_reset(card, 1);
|
||||||
sc_disconnect_card(card);
|
sc_disconnect_card(card);
|
||||||
sc_release_context(ctx);
|
sc_release_context(ctx);
|
||||||
|
|||||||
@@ -118,18 +118,6 @@ struct iso_sm_ctx *iso_sm_ctx_create(void);
|
|||||||
*/
|
*/
|
||||||
int iso_sm_start(struct sc_card *card, struct iso_sm_ctx *sctx);
|
int iso_sm_start(struct sc_card *card, struct iso_sm_ctx *sctx);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Stops SM and frees allocated ressources.
|
|
||||||
*
|
|
||||||
* Calls \a card->sm_ctx.ops.close() if available and \c card->sm_ctx.sm_mode
|
|
||||||
* is \c SM_MODE_TRANSMIT
|
|
||||||
*
|
|
||||||
* @param[in] card
|
|
||||||
*
|
|
||||||
* @return \c SC_SUCCESS or error code if an error occurred
|
|
||||||
*/
|
|
||||||
int sm_stop(struct sc_card *card);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Submodule npa/src/opensc updated: 88ec461bc5...8ea328ff7f
Reference in New Issue
Block a user