Commit 226653d2 authored by Jeremy White's avatar Jeremy White Committed by Marc-André Lureau

Add a VCARD_DIRECT implemention to the libcacard smartcard support

This uses libpcsclite to provide direct communication with a smartcard.
Signed-off-by: default avatarJeremy White <jwhite@codeweavers.com>
Reviewed-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
parent 97c0121e
......@@ -5,6 +5,7 @@ lib_LTLIBRARIES = libcacard.la
libcacard_la_SOURCES = \
src/cac.c \
src/capcsc.h \
src/card_7816.c \
src/event.c \
src/glib-compat.h \
......@@ -15,6 +16,10 @@ libcacard_la_SOURCES = \
src/vreader.c \
$(NULL)
if ENABLE_PCSC
libcacard_la_SOURCES += src/capcsc.c
endif
libcacard_includedir = $(includedir)/cacard
libcacard_include_HEADERS = \
src/cac.h \
......@@ -32,7 +37,7 @@ libcacard_include_HEADERS = \
src/vscard_common.h \
$(NULL)
libcacard_la_LIBADD = $(CACARD_LIBS)
libcacard_la_LIBADD = $(CACARD_LIBS) $(PCSC_LIBS)
libcacard_la_LDFLAGS = \
-export-symbols $(srcdir)/src/libcacard.syms \
-no-undefined \
......@@ -56,7 +61,7 @@ if OS_WIN32
vscclient_CFLAGS += -D__USE_MINGW_ANSI_STDIO=1
endif
AM_CPPFLAGS = $(CACARD_CFLAGS) $(WARN_CFLAGS)
AM_CPPFLAGS = $(CACARD_CFLAGS) $(PCSC_CFLAGS) $(WARN_CFLAGS)
EXTRA_DIST = \
NEWS \
README.md \
......
This diff is collapsed.
/*
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
* See the COPYING.LIB file in the top-level directory.
*/
#ifndef CAPCSC_H
#define CAPCSC_H 1
#define CAPCSC_POLL_TIME 50 /* ms - Time we will poll for */
/* card change when a */
/* reader is connected */
#define CAPCSC_MAX_READERS 16
#define CAPCSC_APPLET "CAPCSC APPLET"
int capcsc_init(void);
#endif
......@@ -33,7 +33,7 @@ vcard_response_set_status(VCardResponse *response, vcard_7816_status_t status)
/*
* set the status bytes in a response buffer
*/
static void
void
vcard_response_set_status_bytes(VCardResponse *response,
unsigned char sw1, unsigned char sw2)
{
......
......@@ -31,8 +31,8 @@ VCardResponse *vcard_make_response(vcard_7816_status_t status);
/* create a raw response (status has already been encoded */
VCardResponse *vcard_response_new_data(unsigned char *buf, int len);
void vcard_response_set_status_bytes(VCardResponse *response,
unsigned char sw1, unsigned char sw2);
/*
* destructor for VCardResponse.
......
......@@ -40,6 +40,7 @@ vcard_response_new
vcard_response_new_bytes
vcard_response_new_data
vcard_response_new_status_bytes
vcard_response_set_status_bytes
vcard_select_applet
vcard_set_applet_private
vcard_set_atr_func
......
......@@ -97,7 +97,7 @@ vcard_reset(VCard *card, VCardPower power)
VCardApplet *
vcard_new_applet(VCardProcessAPDU applet_process_function,
VCardResetApplet applet_reset_function,
unsigned char *aid, int aid_len)
const unsigned char *aid, int aid_len)
{
VCardApplet *applet;
......
......@@ -30,7 +30,7 @@ void vcard_reset(VCard *card, VCardPower power);
*/
VCardApplet *vcard_new_applet(VCardProcessAPDU applet_process_function,
VCardResetApplet applet_reset_function,
unsigned char *aid, int aid_len);
const unsigned char *aid, int aid_len);
/*
* destructor for a VCardApplet
......
......@@ -9,6 +9,7 @@
* This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
* See the COPYING file in the top-level directory.
*/
#include "config.h"
/*
* NSS headers
......@@ -1253,7 +1254,12 @@ vcard_emul_options(const char *args)
opts->hw_card_type = VCARD_EMUL_CAC;
opts->use_hw = PR_TRUE;
args = find_blank(args + 7);
/* nssemul */
#if defined(ENABLE_PCSC)
} else if (strncmp(args, "passthru", 8) == 0) {
opts->hw_card_type = VCARD_EMUL_PASSTHRU;
opts->use_hw = PR_TRUE;
args = find_blank(args + 8);
#endif
} else {
fprintf(stderr, "Error: Unknown smartcard specification.\n");
return NULL;
......@@ -1273,6 +1279,9 @@ vcard_emul_usage(void)
" hw_type={card_type_to_emulate} (default CAC)\n"
" hw_param={param_for_card} (default \"\")\n"
" nssemul (alias for use_hw=yes, hw_type=CAC)\n"
#if defined(ENABLE_PCSC)
" passthru (alias for use_hw=yes, hw_type=PASSTHRU)\n"
#endif
" soft=({slot_name},{vreader_name},{card_type_to_emulate},{params_for_card},\n"
" {cert1},{cert2},{cert3} (default none)\n"
"\n"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment