- removed config directory
- fixed compiling with C++ - added error SC_ERROR_CARD_RESET git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@65 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
parent
684623a2ec
commit
683f561800
13
Makefile.am
13
Makefile.am
|
@ -1,18 +1,17 @@
|
|||
## Makefile.am -- Process this file with automake to produce Makefile.in
|
||||
|
||||
AUX_DIST = $(ac_aux_dir)/config.guess \
|
||||
$(ac_aux_dir)/config.sub \
|
||||
$(ac_aux_dir)/install-sh \
|
||||
$(ac_aux_dir)/ltmain.sh \
|
||||
$(ac_aux_dir)/missing \
|
||||
$(ac_aux_dir)/mkinstalldirs
|
||||
AUX_DIST = config.guess config.sub \
|
||||
install-sh \
|
||||
ltmain.sh \
|
||||
missing \
|
||||
mkinstalldirs
|
||||
EXTRA_DIST = bootstrap
|
||||
|
||||
SUBDIRS = src
|
||||
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config-h.in \
|
||||
stamp-h.in $(AUX_DIST)
|
||||
dist-hook:
|
||||
(cd $(distdir) && mkdir $(ac_aux_dir))
|
||||
cd $(distdir)
|
||||
for file in $(AUX_DIST); do \
|
||||
cp $$file $(distdir)/$$file; \
|
||||
done
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -x
|
||||
aclocal -I config
|
||||
aclocal
|
||||
libtoolize --force --copy
|
||||
autoheader
|
||||
automake --add-missing --copy
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(libopensc)
|
||||
AC_CONFIG_AUX_DIR(config)
|
||||
AC_CONFIG_SRCDIR(src/sc.c)
|
||||
AM_CONFIG_HEADER(config.h:config.h.in)
|
||||
AM_INIT_AUTOMAKE(libopensc, 0.3.2)
|
||||
|
@ -50,8 +49,6 @@ AC_FUNC_MALLOC
|
|||
AC_FUNC_MEMCMP
|
||||
AC_CHECK_FUNCS(memset strdup)
|
||||
|
||||
AC_SUBST(ac_aux_dir)
|
||||
|
||||
CFLAGS="${CFLAGS} -Wall"
|
||||
|
||||
AC_CONFIG_FILES(Makefile src/Makefile)
|
||||
|
|
|
@ -28,7 +28,7 @@ static int fineid_defaults(void *arg)
|
|||
{
|
||||
struct sc_card *card = (struct sc_card *) arg;
|
||||
|
||||
card->class = 0;
|
||||
card->cla = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ static int multiflex_defaults(void *arg)
|
|||
{
|
||||
struct sc_card *card = (struct sc_card *) arg;
|
||||
|
||||
card->class = 0xC0;
|
||||
card->cla = 0xC0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
|
||||
#include "opensc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SC_PKCS15_PIN_MAGIC 0x31415926
|
||||
#define SC_PKCS15_MAX_PINS 2
|
||||
#define SC_PKCS15_MAX_CERTS 3
|
||||
|
@ -218,4 +222,8 @@ int sc_pkcs15_parse_common_object_attr(struct sc_pkcs15_common_obj_attr *attr,
|
|||
|
||||
extern const struct sc_pkcs15_defaults sc_pkcs15_card_table[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include <winscard.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SC_ERROR_MIN -1000
|
||||
#define SC_ERROR_UNKNOWN -1000
|
||||
#define SC_ERROR_CMD_TOO_SHORT -1001
|
||||
|
@ -51,6 +55,7 @@
|
|||
#define SC_ERROR_UNKNOWN_SMARTCARD -1022
|
||||
#define SC_ERROR_UNKNOWN_REPLY -1023
|
||||
#define SC_ERROR_OBJECT_NOT_FOUND -1024
|
||||
#define SC_ERROR_CARD_RESET -1025
|
||||
|
||||
#define SC_APDU_CASE_NONE 0
|
||||
#define SC_APDU_CASE_1 1
|
||||
|
@ -122,7 +127,7 @@ struct sc_file {
|
|||
};
|
||||
|
||||
struct sc_card {
|
||||
int class;
|
||||
int cla;
|
||||
struct sc_context *context;
|
||||
|
||||
SCARDHANDLE pcsc_card;
|
||||
|
@ -213,10 +218,10 @@ int sc_compute_signature(struct sc_card *card, const u8 * data,
|
|||
int sc_verify(struct sc_card *card, int ref, const u8 *buf, int buflen,
|
||||
int *tries_left);
|
||||
int sc_change_reference_data(struct sc_card *card, int ref, const u8 *old,
|
||||
int oldlen, const u8 *new, int newlen,
|
||||
int oldlen, const u8 *newref, int newlen,
|
||||
int *tries_left);
|
||||
int sc_reset_retry_counter(struct sc_card *card, int ref, const u8 *puk,
|
||||
int puklen, const u8 *new, int newlen);
|
||||
int puklen, const u8 *newref, int newlen);
|
||||
|
||||
/* ISO 7816-9 */
|
||||
int sc_create_file(struct sc_card *card, const struct sc_file *file);
|
||||
|
@ -239,4 +244,9 @@ extern const char *sc_version;
|
|||
|
||||
extern const struct sc_defaults sc_card_table[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,10 @@
|
|||
|
||||
#include "opensc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SC_PKCS15_PIN_MAGIC 0x31415926
|
||||
#define SC_PKCS15_MAX_PINS 2
|
||||
#define SC_PKCS15_MAX_CERTS 3
|
||||
|
@ -218,4 +222,8 @@ int sc_pkcs15_parse_common_object_attr(struct sc_pkcs15_common_obj_attr *attr,
|
|||
|
||||
extern const struct sc_pkcs15_defaults sc_pkcs15_card_table[];
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -219,15 +219,14 @@ static int sc_transceive_t0(struct sc_card *card, struct sc_apdu *apdu)
|
|||
switch (rv) {
|
||||
case SCARD_W_REMOVED_CARD:
|
||||
return SC_ERROR_CARD_REMOVED;
|
||||
case SCARD_W_RESET_CARD:
|
||||
return SC_ERROR_CARD_RESET;
|
||||
case SCARD_E_NOT_TRANSACTED:
|
||||
if (sc_detect_card(card->context, card->reader) != 1)
|
||||
return SC_ERROR_CARD_REMOVED;
|
||||
return SC_ERROR_TRANSMIT_FAILED;
|
||||
default:
|
||||
if (sc_debug) {
|
||||
fprintf(stderr, "SCardTransmit returned 0x%08lX.\n", rv);
|
||||
return SC_ERROR_TRANSMIT_FAILED;
|
||||
}
|
||||
return SC_ERROR_TRANSMIT_FAILED;
|
||||
}
|
||||
}
|
||||
if (dwRecvLength < 2)
|
||||
|
@ -516,7 +515,7 @@ int sc_format_apdu(struct sc_card *card, struct sc_apdu *apdu,
|
|||
{
|
||||
assert(card != NULL && apdu != NULL);
|
||||
memset(apdu, 0, sizeof(*apdu));
|
||||
apdu->cla = card->class;
|
||||
apdu->cla = card->cla;
|
||||
apdu->cse = cse;
|
||||
apdu->ins = ins;
|
||||
apdu->p1 = p1;
|
||||
|
@ -710,7 +709,7 @@ int sc_connect_card(struct sc_context *ctx,
|
|||
if (defaults != NULL && defaults->defaults_func != NULL) {
|
||||
defaults->defaults_func(card);
|
||||
} else {
|
||||
card->class = 0; /* FIXME */
|
||||
card->cla = 0; /* FIXME */
|
||||
}
|
||||
pthread_mutex_init(&card->mutex, NULL);
|
||||
*card_out = card;
|
||||
|
@ -754,6 +753,7 @@ const char *sc_strerror(int error)
|
|||
"Unknown SmartCard",
|
||||
"Unknown reply from SmartCard",
|
||||
"Requested object not found",
|
||||
"Card reset"
|
||||
};
|
||||
int nr_errors = sizeof(errors) / sizeof(errors[0]);
|
||||
|
||||
|
|
Loading…
Reference in New Issue