include non exported OpenSC functions

This commit is contained in:
Frank Morgner
2014-07-24 23:06:13 +02:00
parent b1966b5594
commit cb96784ed8
4 changed files with 47 additions and 11 deletions

View File

@@ -25,6 +25,7 @@
#include <libopensc/opensc.h>
#include <libopensc/pace.h>
#include <npa/boxing.h>
#include <npa/scutil.h>
#include <stdlib.h>
#include <string.h>
@@ -39,13 +40,6 @@
#include <endian.h>
#endif
#if HAVE_SC_APDU_GET_OCTETS
#include "libopensc/internal.h"
#else
/* Pull request for exporting sc_apdu_get_octets is pending. */
#include "libopensc/apdu.c"
#endif
static const u8 boxing_cla = 0xff;
static const u8 boxing_ins = 0x9a;
static const u8 boxing_p1 = 0x04;

View File

@@ -26,10 +26,6 @@
#include <npa/npa.h>
#include <string.h>
#ifndef HAVE_SC_APDU_GET_OCTETS
#include "libopensc/card.c"
#endif
struct npa_drv_data {
unsigned char *can;
size_t can_length;

View File

@@ -116,5 +116,36 @@ int read_binary_rec(sc_card_t *card, unsigned char sfid,
int write_binary_rec(sc_card_t *card, unsigned char sfid,
u8 *ef, size_t ef_len);
/*
* OPENSC functions that do not get exported (sometimes)
*/
/**
* Returns the encoded APDU in newly created buffer.
* @param ctx sc_context_t object
* @param apdu sc_apdu_t object with the APDU to encode
* @param buf pointer to the newly allocated buffer
* @param len length of the encoded APDU
* @param proto protocol to be used
* @return SC_SUCCESS on success and an error code otherwise
*/
int sc_apdu_get_octets(sc_context_t *ctx, const sc_apdu_t *apdu, u8 **buf,
size_t *len, unsigned int proto);
/**
* Sets the status bytes and return data in the APDU
* @param ctx sc_context_t object
* @param apdu the apdu to which the data should be written
* @param buf returned data
* @param len length of the returned data
* @return SC_SUCCESS on success and an error code otherwise
*/
int sc_apdu_set_resp(sc_context_t *ctx, sc_apdu_t *apdu, const u8 *buf,
size_t len);
/* Returns an index number if a match was found, -1 otherwise. table has to
* be null terminated. */
int _sc_match_atr(struct sc_card *card, struct sc_atr_table *table, int *type_out);
#endif
/* @} */

View File

@@ -20,6 +20,21 @@
#include "config.h"
#endif
#include "libopensc/internal.h"
#if !defined(HAVE_SC_APDU_GET_OCTETS) || !defined(HAVE_SC_APDU_SET_RESP)
/* Pull request for exporting sc_apdu_get_octets is pending. */
#include "libopensc/apdu.c"
#endif
#ifndef HAVE__SC_MATCH_ATR
/* I hate to do this, but to include _sc_match_atr we need to satisfy all
* dependencies of card.c */
#include "common/libscdl.c"
#include "libopensc/sc.c"
#include "libopensc/card.c"
#endif
#include <libopensc/log.h>
#include <npa/iso-sm.h>
#include <npa/scutil.h>