usb-ccid
v25 cover usb-ccid
This patchset adds three new devices, usb-ccid, ccid-card-passthru and ccid-card-emulated, providing a CCID bus, a simple passthru protocol implementing card requiring a client, and a standalone emulated card.
It also introduces a new directory libcaccard with CAC card emulation, CAC is a type of ISO 7816 smart card.
Tree for pull: git://anongit.freedesktop.org/~alon/qemu usb_ccid.v25.clean
v24->v25 changes:
* libcacard:
* Fix out of tree build
* Fix build for linux-user targets
v23->v24 changes:
* libcacard:
= changed patches: (that need re-review)
* 6 - libcacard: initial commit
* 7 - libcacard: add vscclient
= changed but trust me don't need rereview:
* 5 - ccid: add passthru card device (removed a duplicate line in the header, had two licenses).
* drop "libcacard add passthru" patch, not ready, not used.
* remove unrequired includes
* use stderr in vscclient for printing errors
* cosmetic fixes
v22->v23 changes:
* libcacard
* configure fixes: (reported by Stefan Hajnoczi)
* test a = b, not a == b (second isn't portable)
* quote $source_path in case it contains spaces
- this doesn't really help since there are many other places that need similar fixes, not introduced by this patch.
v21->v22 changes:
* libcacard:
* fix configure to not link libcacard if nss not found (reported by Stefan Hajnoczi)
* fix vscclient linkage with simpletrace backend (reported by Stefan Hajnoczi)
* card_7816.c: add missing break in ERROR_DATA_NOT_FOUND (reported by William van de Velde)
v20->v21 changes:
* all: cosmetics
* libcacard, ccid-card-passthru:
* use qemu-{malloc,free} and qemu-thread, error_report
* libcacard:
* split to multiple patches
v19->v20 changes:
* checkpatch.pl. Here are the remaining errors with explanation:
* ignored 5 macro errors of the type
"ERROR: Macros with complex values should be enclosed in parenthesis" because fixing them breaks current code, if it really bothers someone I can fix it.
* four of them are in libcacard/card_7816t.h:
/* give the subfields a unified look */
..
#define a_cla a_header->ah_cla /* class */
#define a_ins a_header->ah_ins /* instruction */
#define a_p1 a_header->ah_p1 /* parameter 1 */
#define a_p2 a_header->ah_p2 /* parameter 2 */
* and the fifth:
#4946: FILE: libcacard/vcardt.h:31:
+#define VCARD_ATR_PREFIX(size) 0x3b, 0x66+(size), 0x00, 0xff, \
+ 'V', 'C', 'A', 'R', 'D', '_'
* Ignored this warning since I couldn't figure it out, and it's a test file:
WARNING: externs should be avoided in .c files
#2343: FILE: libcacard/link_test.c:7:
+VCardStatus cac_card_init(const char *flags, VCard *card,
v18-v19 changes:
* more merges, down to a single digit number of patches.
* drop enumeration property, use string.
* rebased (trivial)
v17-v18 changes:
* merge vscard_common.h patches.
* actually provide a tree to pull.
v16-v17 changes:
* merged all the "v15->v16" patches
* merged some more wherever it was easy (all same file commits).
* added signed off by to first four patches
* ccid.h: added copyright, removed underscore in defines, and replaced non C89 comments
v15-v16 changes:
* split vscard_common introducing patch for ease of review
* sum of commit logs for the v15-v16 commits: (whitespace fixes
removed for space, see original commit messages in later patches)
* usb-ccid:
* fix abort on client answer after card remove
* enable migration
* remove side affect code from asserts
* return consistent self-powered state
* mask out reserved bits in ccid_set_parameters
* add missing abRFU in SetParameters (no affect on linux guest)
* vscard_common.h protocol change:
* VSCMsgInit capabilities and magic
* removed ReaderResponse, will use Error instead with code==VSC_SUCCESS.
* added Flush and FlushComplete, remove Reconnect.
* define VSCARD_MAGIC
* added error code VSC_SUCCESS.
* ccid-card-passthru
* return correct size
* return error instead of assert if client sent too large ATR
* don't assert if client sent too large a size, but add asserts for indices to buffer
* reset vscard_in indices on chardev disconnect
* handle init from client
* error if no chardev supplied
* use ntoh, hton
* eradicate reader_id_t
* remove Reconnect usage (removed from VSCARD protocol)
* send VSC_SUCCESS on card insert/remove and reader add/remove
* ccid-card-emulated
* fix error reporting in initfn
v14-v15 changes:
* add patch with --enable-smartcard and --disable-smartcard and only disable ccid-card-emulated if nss not found.
* add patch with description strings
* s/libcaccard/libcacard/ in docs/ccid.txt
v13-v14 changes:
- support device_del/device_add on ccid-card-* and usb-ccid
* usb-ccid:
* lose card reference when card device deleted
* check slot number and deny adding a slot if one is already added.
* ccid-card-*: use qdev_simple_unplug_cb in both emulated and passthru ccid cards, the exitfn already takes care of triggering card removal in the usb dev.
* libcacard:
* remove double include of config-host.mak
* add replay of card events to libcacard to support second and more emulation
* don't initialize more then once (doesn't support it right now, so one thread, NSS thread, is left when device_del is done)
* add VCARD_EMUL_INIT_ALREADY_INITED
* ccid-card-emulated:
* take correct mutexes on signaling to fix deadlocks on device_del
* allow card insertion/removal event without proper reader insertion event
v12-v13 changes:
* libcacard:
* fix Makefile clean to remove vscclient
* fix double include of config-host in Makefile
* usb-ccid: remove attach/detach logic, usb is always attached. Guest doesn't care if there is a reader attached with no card anyway.
* ccid-card-passthru: don't close chr_dev on removal, makes it possible to use device_del/device_add to create remove/insertion for debugging.
v11-v12 changes:
* fix out of tree build
v10-v11 changes:
* fix last patch that removed one of the doc files.
* updated flow table in docs/ccid.txt
v8-v10 changes:
* usb-ccid:
* add slot for future use (Gerd)
* ifdef ENABLE_MIGRATION for migration support on account of usb migration not being ready in general. (Gerd)
* verbosified commit messages. (Gerd)
* put libcacard docs in libcacard commit. (Gerd)
v8-v9 changes:
* Blue Swirl comments:
* white space fixes
* enabled by default, disabled only if missing nss
* forgotten fix from v8 (don't build libcacard.so)
* added a note about device being little endian
* library renamed from libcaccard to libcacard
* squashed both of libcacard patches, they touched different files anyway.
v7-v8 changes:
* Blue Swirl comments:
* usb-ccid: deannonymize some structs
* usb-ccid: coding style change - answer_t and bulk_in_t fixed
* usb-ccid: handle endianess conversion between guest and host
* usb-ccid: s/ccid_bulk_in_copy_out/ccid_bulk_in_copy_to_guest/
* ccid-card-emulated: fix segfault if backend not specified
* ccid-card-emulated: let last reader inserted win
* libcaccard: remove double vscard_common.h
v6->v7 changes:
* external libcaccard became internal directory libcaccard
* statically link object files into qemu
* produce libcaccard.so for usage by external projects
* applied coding style to new code (please check me)
- did not use the qemu options parsing for libcaccard, since it seems to draw large amounts of qemu code (monitor for instance).
v5->v6 changes:
* really remove static debug (I apologize for claiming to have done so before)
v4->v5 changes:
* rebased to latest
* remove static debug in card devices
* fix --enable-smartcard to link
* stall instead of assert when exceeding BULK_OUT_DATA_SIZE
* make ccid_reserve_recv_buf for too large len discard message, not exit
* make ccid_reserve_recv_buf return void*
* fix typo
* remove commented code in VMState
v3->v4:
* remove ccid field in CCIDBus
* remove static debug in bus
* add back docs
v2->v3:
* split into bus (usb-ccid.c, uses ccid.h) and card (ccid-card-passthru.c).
* removed documentation (being revised).
v1->v2:
* all QSIMPLEQ turned into fixed sized rings
* all allocated buffers turned into fixed size buffers
* added migration support
* added a message to tell client qemu has migrated to ip:port
* for lack of monitor commands ip:port are 0:0, which causes the updated vscclient to connect to one port higher on the same host. will add monitor commands in a separate patch. tested with current setup.
Alon Levy (7):
trace: move trace objects from Makefile to Makefile.objs qemu-thread.h: include inttypes.h
usb-ccid: add CCID bus
introduce libcacard/vscard_common.h
ccid: add passthru card device
ccid: add ccid-card-emulated device
ccid: add docs
Robert Relyea (3):
libcacard: initial commit
libcacard: add vscclient
libcacard: add docs
Makefile | 38 +- Makefile.objs | 39 ++ Makefile.target | 6 + configure | 60 ++ docs/ccid.txt | 135 ++++ docs/libcacard.txt | 483 +++++++++++++++ hw/ccid-card-emulated.c | 595 ++++++++++++++++++ hw/ccid-card-passthru.c | 340 +++++++++++ hw/ccid.h | 59 ++ hw/usb-ccid.c | 1419 +++++++++++++++++++++++++++++++++++++++++++ libcacard/Makefile | 25 + libcacard/cac.c | 403 ++++++++++++ libcacard/cac.h | 23 + libcacard/card_7816.c | 763 +++++++++++++++++++++++ libcacard/card_7816.h | 62 ++ libcacard/card_7816t.h | 165 +++++ libcacard/event.c | 106 ++++ libcacard/eventt.h | 29 + libcacard/link_test.c | 22 + libcacard/vcard.c | 339 +++++++++++ libcacard/vcard.h | 86 +++ libcacard/vcard_emul.h | 65 ++ libcacard/vcard_emul_nss.c | 1157 +++++++++++++++++++++++++++++++++++ libcacard/vcard_emul_type.c | 57 ++ libcacard/vcard_emul_type.h | 32 + libcacard/vcardt.h | 64 ++ libcacard/vevent.h | 27 + libcacard/vreader.c | 513 ++++++++++++++++ libcacard/vreader.h | 55 ++ libcacard/vreadert.h | 24 + libcacard/vscard_common.h | 178 ++++++ libcacard/vscclient.c | 652 ++++++++++++++++++++ qemu-thread.h | 2 + 33 files changed, 7989 insertions(+), 34 deletions(-) create mode 100644 docs/ccid.txt create mode 100644 docs/libcacard.txt create mode 100644 hw/ccid-card-emulated.c create mode 100644 hw/ccid-card-passthru.c create mode 100644 hw/ccid.h create mode 100644 hw/usb-ccid.c create mode 100644 libcacard/Makefile create mode 100644 libcacard/cac.c create mode 100644 libcacard/cac.h create mode 100644 libcacard/card_7816.c create mode 100644 libcacard/card_7816.h create mode 100644 libcacard/card_7816t.h create mode 100644 libcacard/event.c create mode 100644 libcacard/eventt.h create mode 100644 libcacard/link_test.c create mode 100644 libcacard/vcard.c create mode 100644 libcacard/vcard.h create mode 100644 libcacard/vcard_emul.h create mode 100644 libcacard/vcard_emul_nss.c create mode 100644 libcacard/vcard_emul_type.c create mode 100644 libcacard/vcard_emul_type.h create mode 100644 libcacard/vcardt.h create mode 100644 libcacard/vevent.h create mode 100644 libcacard/vreader.c create mode 100644 libcacard/vreader.h create mode 100644 libcacard/vreadert.h create mode 100644 libcacard/vscard_common.h create mode 100644 libcacard/vscclient.c
Signature · 1 line
1.7.4.2
PATCH v25 1/10 trace: move trace objects from Makefile to Makefile.objs
--- Makefile | 32 -------------------------------- Makefile.objs | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 32 deletions(-)
Makefile +0 -32
@@ -112,38 +112,6 @@ ui/vnc.o: QEMU_CFLAGS += $(VNC_TLS_CFLAGS) bt-host.o: QEMU_CFLAGS += $(BLUEZ_CFLAGS) -ifeq ($(TRACE_BACKEND),dtrace) -trace.h: trace.h-timestamp trace-dtrace.h -else -trace.h: trace.h-timestamp -endif -trace.h-timestamp: $(SRC_PATH)/trace-events config-host.mak - $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN trace.h") - @cmp -s $@ trace.h || cp $@ trace.h - -trace.c: trace.c-timestamp -trace.c-timestamp: $(SRC_PATH)/trace-events config-host.mak - $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -c < $< > $@," GEN trace.c") - @cmp -s $@ trace.c || cp $@ trace.c - -trace.o: trace.c $(GENERATED_HEADERS) - -trace-dtrace.h: trace-dtrace.dtrace - $(call quiet-command,dtrace -o $@ -h -s $<, " GEN trace-dtrace.h") - -# Normal practice is to name DTrace probe file with a '.d' extension -# but that gets picked up by QEMU's Makefile as an external dependancy -# rule file. So we use '.dtrace' instead -trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp -trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events config-host.mak - $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -d < $< > $@," GEN trace-dtrace.dtrace") - @cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace - -trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS) - $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o") - -simpletrace.o: simpletrace.c $(GENERATED_HEADERS) - version.o: $(SRC_PATH)/version.rc config-host.mak $(call quiet-command,$(WINDRES) -I. -o $@ $<," RC $(TARGET_DIR)$@")
Makefile.objs +32 -0
@@ -310,6 +310,38 @@ libdis-$(CONFIG_SPARC_DIS) += sparc-dis.o # trace ifeq ($(TRACE_BACKEND),dtrace) +trace.h: trace.h-timestamp trace-dtrace.h +else +trace.h: trace.h-timestamp +endif +trace.h-timestamp: $(SRC_PATH)/trace-events config-host.mak + $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -h < $< > $@," GEN trace.h") + @cmp -s $@ trace.h || cp $@ trace.h + +trace.c: trace.c-timestamp +trace.c-timestamp: $(SRC_PATH)/trace-events config-host.mak + $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -c < $< > $@," GEN trace.c") + @cmp -s $@ trace.c || cp $@ trace.c + +trace.o: trace.c $(GENERATED_HEADERS) + +trace-dtrace.h: trace-dtrace.dtrace + $(call quiet-command,dtrace -o $@ -h -s $<, " GEN trace-dtrace.h") + +# Normal practice is to name DTrace probe file with a '.d' extension +# but that gets picked up by QEMU's Makefile as an external dependancy +# rule file. So we use '.dtrace' instead +trace-dtrace.dtrace: trace-dtrace.dtrace-timestamp +trace-dtrace.dtrace-timestamp: $(SRC_PATH)/trace-events config-host.mak + $(call quiet-command,sh $(SRC_PATH)/scripts/tracetool --$(TRACE_BACKEND) -d < $< > $@," GEN trace-dtrace.dtrace") + @cmp -s $@ trace-dtrace.dtrace || cp $@ trace-dtrace.dtrace + +trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS) + $(call quiet-command,dtrace -o $@ -G -s $<, " GEN trace-dtrace.o") + +simpletrace.o: simpletrace.c $(GENERATED_HEADERS) + +ifeq ($(TRACE_BACKEND),dtrace) trace-obj-y = trace-dtrace.o else trace-obj-y = trace.o
Signature · 1 line
1.7.4.2
PATCH v25 2/10 qemu-thread.h: include inttypes.h
In reply to Alon Levyqemu-thread.h relies on uint64_t being defined, but doesn't include inttypes.h explicitly. This makes it easier to use it from vscclient (part of libcacard).
--- qemu-thread.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
qemu-thread.h +2 -0
@@ -1,6 +1,8 @@#ifndef __QEMU_THREAD_H#define __QEMU_THREAD_H 1 +#include <inttypes.h> +typedef struct QemuMutex QemuMutex ;typedef struct QemuCond QemuCond ;typedef struct QemuThread QemuThread ;
Signature · 1 line
1.7.4.2
PATCH v25 3/10 usb-ccid: add CCID bus
In reply to Alon LevyA CCID device is a smart card reader. It is a USB device, defined at [1]. This patch introduces the usb-ccid device that is a ccid bus. Next patches will introduce two card types to use it, a passthru card and an emulated card.
[1] http://www.usb.org/developers/devclass_docs/DWG_Smart-Card_CCID_Rev110.
---
changes from v20->v21: (Jes Sorenson review)
* cosmetic changes - fix multi line comments.
* reorder fields in USBCCIDState
* add reference to COPYING
* add --enable-smartcard and --disable-smartcard here (moved from last patch)
changes from v19->v20:
* checkpatch.pl
changes from v18->v19:
* merged: ccid.h: add copyright, fix define and remove non C89 comments
* add qdev.desc
changes from v15->v16:
Behavioral changes:
* fix abort on client answer after card remove
* enable migration
* remove side affect code from asserts
* return consistent self-powered state
* mask out reserved bits in ccid_set_parameters
* add missing abRFU in SetParameters (no affect on linux guest)
whitefixes / comments / consts defines:
* remove stale comment
* remove ccid_print_pending_answers if no DEBUG_CCID
* replace printf's with DPRINTF, remove DEBUG_CCID, add verbosity defines
* use error_report
* update copyright (most of the code is not original)
* reword known bug comment
* add missing closing quote in comment
* add missing whitespace on one line
* s/CCID_SetParameter/CCID_SetParameters/
* add comments
* use define for max packet size
Comment for "return consistent self-powered state":
the Configuration Descriptor bmAttributes claims we are self powered, but we were returning not self powered to USB_REQ_GET_STATUS control message.
In practice, this message is not sent by a linux 2.6.35.10-74.fc14.x86_64 guest (not tested on other guests), unless you issue lsusb -v as root (for example).
--- Makefile.objs | 1 + configure | 11 + hw/ccid.h | 59 +++ hw/usb-ccid.c | 1419 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1490 insertions(+), 0 deletions(-) create mode 100644 hw/ccid.h create mode 100644 hw/usb-ccid.c
Makefile.objs +1 -0
@@ -200,6 +200,7 @@ hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o hw-obj-$(CONFIG_DMA) += dma.o hw-obj-$(CONFIG_HPET) += hpet.o hw-obj-$(CONFIG_APPLESMC) += applesmc.o +hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o # PPC devices hw-obj-$(CONFIG_OPENPIC) += openpic.o
configure +11 -0
@@ -175,6 +175,7 @@ trace_backend="nop" trace_file="trace" spice="" rbd="" +smartcard="" # parse CC options first for opt do
@@ -724,6 +725,10 @@ for opt do ;; --enable-rbd) rbd="yes" ;; + --disable-smartcard) smartcard="no" + ;; + --enable-smartcard) smartcard="yes" + ;; *) echo "ERROR: unknown option $opt"; show_help="yes" ;; esac
@@ -921,6 +926,8 @@ echo " Default:trace-<pid>" echo " --disable-spice disable spice" echo " --enable-spice enable spice" echo " --enable-rbd enable building the rados block device (rbd)" +echo " --disable-smartcard disable smartcard support" +echo " --enable-smartcard enable smartcard support" echo "" echo "NOTE: The object files are built at the place where configure is launched" exit 1
@@ -2822,6 +2829,10 @@ if test "$spice" = "yes" ; then echo "CONFIG_SPICE=y" >> $config_host_mak fi +if test "$smartcard" = "yes" ; then + echo "CONFIG_SMARTCARD=y" >> $config_host_mak +fi + # XXX: suppress that if [ "$bsd" = "yes" ] ; then echo "CONFIG_BSD=y" >> $config_host_mak
hw/ccid.h new file +59 -0
59 lines not on this page · raw message
hw/usb-ccid.c new file +1419 -0
1,419 lines not on this page · raw message
Signature · 1 line
1.7.4.2
PATCH v25 4/10 introduce libcacard/vscard_common.h
In reply to Alon Levy---
v20->v21 changes: (Jes Sorensen review)
* license set to 2+
* long comment fixes, remove empty line at eof.
* add reference to COPYING
v19->v20 changes:
* checkpatch.pl
v15->v16 changes:
Protocol change:
* VSCMsgInit capabilities and magic
* removed ReaderResponse, will use Error instead with code==VSC_SUCCESS.
* adaded Flush and FlushComplete, remove Reconnect.
* define VSCARD_MAGIC
* added error code VSC_SUCCESS.
Fixes:
* update VSCMsgInit comment
* fix message type enum
* remove underscore from wrapping define
* update copyright
* updated comments.
* Header comment updated
* remove C++ style comment
* fix comment for VSCMsgError
* give names to enums in typedefs
--- libcacard/vscard_common.h | 178 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 178 insertions(+), 0 deletions(-) create mode 100644 libcacard/vscard_common.h
libcacard/vscard_common.h new file +178 -0
@@ -0,0 +1,178 @@ +/* Virtual Smart Card protocol definition +* +* This protocol is between a host using virtual smart card readers, +* and a client providing the smart cards, perhaps by emulating them or by +* access to real cards. +* +* Definitions for this protocol: +* Host - user of the card +* Client - owner of the card +* +* The current implementation passes the raw APDU's from 7816 and additionally +* contains messages to setup and teardown readers, handle insertion and +* removal of cards, negotiate the protocol via capabilities and provide +* for error responses. +* +* Copyright (c) 2011 Red Hat. +* +* 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 VSCARD_COMMON_H +#define VSCARD_COMMON_H + +#include <stdint.h> + +#define VERSION_MAJOR_BITS 11 +#define VERSION_MIDDLE_BITS 11 +#define VERSION_MINOR_BITS 10 + +#define MAKE_VERSION (major, middle, minor) \ + ((major << (VERSION_MINOR_BITS + VERSION_MIDDLE_BITS)) \ + | (middle << VERSION_MINOR_BITS) \ + | (minor)) + +/* +* IMPORTANT NOTE on VERSION +* +* The version below MUST be changed whenever a change in this file is made. +* +* The last digit, the minor, is for bug fix changes only. +* +* The middle digit is for backward / forward compatible changes, updates +* to the existing messages, addition of fields. +* +* The major digit is for a breaking change of protocol, presumably +* something that cannot be accomodated with the existing protocol. +*/ + +#define VSCARD_VERSION MAKE_VERSION(0, 0, 2) + +typedef enum VSCMsgType { + VSC_Init =1 , + VSC_Error, + VSC_ReaderAdd, + VSC_ReaderRemove, +VSC_ATR , + VSC_CardRemove, +VSC_APDU , + VSC_Flush, + VSC_FlushComplete +}VSCMsgType ; + +typedef enum VSCErrorCode { +VSC_SUCCESS =0 , +VSC_GENERAL_ERROR =1 , +VSC_CANNOT_ADD_MORE_READERS , +VSC_CARD_ALREAY_INSERTED , +}VSCErrorCode ; + +#define VSCARD_UNDEFINED_READER_ID 0xffffffff +#define VSCARD_MINIMAL_READER_ID 0 + +#define VSCARD_MAGIC (*(uint32_t *)"VSCD") + +/* +* Header +* Each message starts with the header. +* type - message type +* reader_id - used by messages that are reader specific +* length - length of payload (not including header, i.e. zero for +* messages containing empty payloads) +*/ +typedef struct VSCMsgHeader { +uint32_t type; +uint32_t reader_id; +uint32_t length; +uint8_t data[0 ]; +}VSCMsgHeader ; + +/* +* VSCMsgInit Client <-> Host +* Client sends it on connection, with its own capabilities. +* Host replies with VSCMsgInit filling in its capabilities. +* +* It is not meant to be used for negotiation, i.e. sending more then +* once from any side, but could be used for that in the future. +*/ +typedef struct VSCMsgInit { +uint32_t magic; +uint32_t version; +uint32_t capabilities[1 ];/* receiver must check length, +array may grow in the future*/ +}VSCMsgInit ; + +/* +* VSCMsgError Client <-> Host +* This message is a response to any of: +* Reader Add +* Reader Remove +* Card Remove +* If the operation was successful then VSC_SUCCESS +* is returned, other wise a specific error code. +*/ +typedef struct VSCMsgError { +uint32_t code; +}VSCMsgError ; + +/* +* VSCMsgReaderAdd Client -> Host +* Host replies with allocated reader id in VSCMsgError with code==SUCCESS. +* +* name - name of the reader on client side, UTF-8 encoded. Only used +* for client presentation (may be translated to the device presented to the +* guest), protocol wise only reader_id is important. +*/ +typedef struct VSCMsgReaderAdd { +uint8_t name[0 ]; +}VSCMsgReaderAdd ; + +/* +* VSCMsgReaderRemove Client -> Host +* The client's reader has been removed. +*/ +typedef struct VSCMsgReaderRemove { +}VSCMsgReaderRemove ; + +/* +* VSCMsgATR Client -> Host +* Answer to reset. Sent for card insertion or card reset. The reset/insertion +* happens on the client side, they do not require any action from the host. +*/ +typedef struct VSCMsgATR { +uint8_t atr[0 ]; +}VSCMsgATR ; + +/* +* VSCMsgCardRemove Client -> Host +* The client card has been removed. +*/ +typedef struct VSCMsgCardRemove { +}VSCMsgCardRemove ; + +/* +* VSCMsgAPDU Client <-> Host +* Main reason of existance. Transfer a single APDU in either direction. +*/ +typedef struct VSCMsgAPDU { +uint8_t data[0 ]; +}VSCMsgAPDU ; + +/* +* VSCMsgFlush Host -> Client +* Request client to send a FlushComplete message when it is done +* servicing all outstanding APDUs +*/ +typedef struct VSCMsgFlush { +}VSCMsgFlush ; + +/* +* VSCMsgFlush Client -> Host +* Client response to Flush after all APDUs have been processed and +* responses sent. +*/ +typedef struct VSCMsgFlushComplete { +}VSCMsgFlushComplete ; + +#endif /* VSCARD_COMMON_H */
Signature · 1 line
1.7.4.2
PATCH v25 5/10 ccid: add passthru card device
In reply to Alon LevyThe passthru ccid card is a device sitting on the usb-ccid bus and using a chardevice to communicate with a remote device using the VSCard protocol defined in libcacard/vscard_common.h
Usage docs available in following patch in docs/ccid.txt
---
Changes from v23->v24:
* fixed double license line in header.
Changes from v20->v21: (Jes Sorensen review)
* add reference to COPYING in header
* long comment reformatting
Changes from v19->v20:
* checkpatch.pl
Changes from v18->v19:
* add qdev.desc
* remove .qdev.unplug (no hot unplug support for ccid bus)
Changes from v16->v17:
* fix wrong cast when receiving VSC_Error
* ccid-card-passthru: force chardev user wakeup by sending Init see lengthy comment below.
Changes from v15->v16:
Behavioral changes:
* return correct size
* return error instead of assert if client sent too large ATR
* don't assert if client sent too large a size, but add asserts for indices to buffer
* reset vscard_in indices on chardev disconnect
* handle init from client
* error if no chardev supplied
* use ntoh, hton
* eradicate reader_id_t
* remove Reconnect usage (removed from VSCARD protocol)
* send VSC_SUCCESS on card insert/remove and reader add/remove
Style fixes:
* width of line fix
* update copyright
* remove old TODO's
* update file header comment
* use macros for debug levels
* c++ style comment replacement
* update copyright license
* fix ATR size comment
* fix whitespace in struct def
* fix DPRINTF prefix
* line width fix
ccid-card-passthru: force chardev user wakeup by sending Init
The problem: how to wakeup the user of the smartcard when the smartcard device is initialized?
Long term solution: have a callback interface. This was done via the deprecated so called chardev ioctl interface.
Short term solution: do a write. Specifically we write an Init message. And we change the client to send it's own Init message regardless of receiving this one. Additional Init messages will be regarded as acceptable, the first one received after connection establishment is the determining one wrt capabilities.
--- Makefile.objs | 2 +- hw/ccid-card-passthru.c | 340 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 341 insertions(+), 1 deletions(-) create mode 100644 hw/ccid-card-passthru.c
Makefile.objs +1 -1
@@ -200,7 +200,7 @@ hw-obj-$(CONFIG_APM) += pm_smbus.o apm.o hw-obj-$(CONFIG_DMA) += dma.o hw-obj-$(CONFIG_HPET) += hpet.o hw-obj-$(CONFIG_APPLESMC) += applesmc.o -hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o +hw-obj-$(CONFIG_SMARTCARD) += usb-ccid.o ccid-card-passthru.o # PPC devices hw-obj-$(CONFIG_OPENPIC) += openpic.o
hw/ccid-card-passthru.c new file +340 -0
340 lines not on this page · raw message
Signature · 1 line
1.7.4.2
PATCH v25 6/10 libcacard: initial commit
In reply to Alon LevyFrom: Robert Relyea <[email protected]>
libcacard emulates a Common Access Card (CAC) which is a standard for smartcards. It is used by the emulated ccid card introduced in a following patch. Docs are available in docs/libcacard.txt
---
changes from v24->v25:
* Fix out of tree builds.
* Fix build with linux-user targets.
changes from v23->v24: (Jes Sorensen review 2)
* Makefile.target: use obj-$(CONFIG_*) +=
* remove unrequired includes, include qemu-common before qemu-thread
* required adding #define NO_NSPR_10_SUPPORT (harmless)
changes from v22->v23:
* configure fixes: (reported by Stefan Hajnoczi)
* test a = b, not a == b (second isn't portable)
* quote $source_path in case it contains spaces
- this doesn't really help since there are many other places that need similar fixes, not introduced by this patch.
changes from v21->v22:
* fix configure to not link libcacard if nss not found (reported by Stefan Hajnoczi)
* fix vscclient linkage with simpletrace backend (reported by Stefan Hajnoczi)
* card_7816.c: add missing break in ERROR_DATA_NOT_FOUND (reported by William van de Velde)
changes from v20->v21: (Jes Sorensen review)
* use qemu infrastructure: qemu-thread, qemu-common (qemu_malloc and qemu_free), error_report
* assert instead of ASSERT
* cosmetic fixes
* use strpbrk and isspace
* add --disable-nss --enable-nss here, instead of in the final patch.
* split vscclient, passthru and docs to following patches.
changes from v19->v20:
* checkpatch.pl
changes from v15->v16:
Build:
* don't erase self with distclean
* fix make clean after make distclean
* Makefile: make vscclient link quiet
Behavioral:
* vcard_emul_nss: load coolkey in more situations
* vscclient:
* use hton,ntoh
* send init on connect, only start vevent thread on response
* read payload after header check, before type switch
* remove Reconnect
* update for vscard_common changes, empty Flush implementation
Style/Whitespace:
* fix wrong variable usage
* remove unused variable
* use only C style comments
* add copyright header
* fix tabulation
libcacard: fix out of tree builds
--- Makefile | 6 +- Makefile.objs | 5 + Makefile.target | 6 + configure | 49 ++ libcacard/Makefile | 20 + libcacard/cac.c | 403 +++++++++++++++ libcacard/cac.h | 23 + libcacard/card_7816.c | 763 ++++++++++++++++++++++++++++ libcacard/card_7816.h | 62 +++ libcacard/card_7816t.h | 165 ++++++ libcacard/event.c | 106 ++++ libcacard/eventt.h | 29 ++ libcacard/link_test.c | 22 + libcacard/vcard.c | 339 +++++++++++++ libcacard/vcard.h | 86 ++++ libcacard/vcard_emul.h | 65 +++ libcacard/vcard_emul_nss.c | 1157 +++++++++++++++++++++++++++++++++++++++++++ libcacard/vcard_emul_type.c | 57 +++ libcacard/vcard_emul_type.h | 32 ++ libcacard/vcardt.h | 64 +++ libcacard/vevent.h | 27 + libcacard/vreader.c | 513 +++++++++++++++++++ libcacard/vreader.h | 55 ++ libcacard/vreadert.h | 24 + 24 files changed, 4076 insertions(+), 2 deletions(-) create mode 100644 libcacard/Makefile create mode 100644 libcacard/cac.c create mode 100644 libcacard/cac.h create mode 100644 libcacard/card_7816.c create mode 100644 libcacard/card_7816.h create mode 100644 libcacard/card_7816t.h create mode 100644 libcacard/event.c create mode 100644 libcacard/eventt.h create mode 100644 libcacard/link_test.c create mode 100644 libcacard/vcard.c create mode 100644 libcacard/vcard.h create mode 100644 libcacard/vcard_emul.h create mode 100644 libcacard/vcard_emul_nss.c create mode 100644 libcacard/vcard_emul_type.c create mode 100644 libcacard/vcard_emul_type.h create mode 100644 libcacard/vcardt.h create mode 100644 libcacard/vevent.h create mode 100644 libcacard/vreader.c create mode 100644 libcacard/vreader.h create mode 100644 libcacard/vreadert.h
Makefile +4 -2
@@ -141,6 +141,8 @@ check-qlist: check-qlist.o qlist.o qint.o $(CHECK_PROG_DEPS) check-qfloat: check-qfloat.o qfloat.o $(CHECK_PROG_DEPS) check-qjson: check-qjson.o qfloat.o qint.o qdict.o qstring.o qlist.o qbool.o qjson.o json-streamer.o json-lexer.o json-parser.o $(CHECK_PROG_DEPS) +QEMULIBS=libhw32 libhw64 libuser libdis libdis-user + clean: # avoid old build problems by removing potentially incorrect old files rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
@@ -152,7 +154,7 @@ clean: rm -f trace-dtrace.dtrace trace-dtrace.dtrace-timestamp rm -f trace-dtrace.h trace-dtrace.h-timestamp $(MAKE) -C tests clean - for d in $(ALL_SUBDIRS) libhw32 libhw64 libuser libdis libdis-user; do \ + for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard; do \ if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \ rm -f $$d/qemu-options.def; \ done
@@ -163,7 +165,7 @@ distclean: clean rm -f roms/seabios/config.mak roms/vgabios/config.mak rm -f qemu-doc.info qemu-doc.aux qemu-doc.cp qemu-doc.dvi qemu-doc.fn qemu-doc.info qemu-doc.ky qemu-doc.log qemu-doc.pdf qemu-doc.pg qemu-doc.toc qemu-doc.tp qemu-doc.vr rm -f qemu-tech.info qemu-tech.aux qemu-tech.cp qemu-tech.dvi qemu-tech.fn qemu-tech.info qemu-tech.ky qemu-tech.log qemu-tech.pdf qemu-tech.pg qemu-tech.toc qemu-tech.tp qemu-tech.vr - for d in $(TARGET_DIRS) libhw32 libhw64 libuser libdis libdis-user; do \ + for d in $(TARGET_DIRS) $(QEMULIBS); do \ rm -rf $$d || exit 1 ; \ done
Makefile.objs +5 -0
@@ -352,6 +352,11 @@ user-obj-y += qemu-timer-common.o endif endif +###################################################################### +# smartcard + +libcacard-y = cac.o event.o vcard.o vreader.o vcard_emul_nss.o vcard_emul_type.o card_7816.o + vl.o: QEMU_CFLAGS+=$(GPROF_CFLAGS) vl.o: QEMU_CFLAGS+=$(SDL_CFLAGS)
Makefile.target +6 -0
@@ -353,6 +353,12 @@ obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) endif # CONFIG_SOFTMMU +ifndef CONFIG_LINUX_USER +# libcacard needs qemu-thread support, and besides is only needed by devices +# so not requires with linux-user targets +obj-$(CONFIG_SMARTCARD_NSS) += $(addprefix ../libcacard/, $(libcacard-y)) +endif # CONFIG_LINUX_USER + obj-y += $(addprefix ../, $(trace-obj-y)) obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o
configure +49 -0
97 lines not on this page · raw message
libcacard/Makefile new file +20 -0
@@ -0,0 +1,20 @@ +-include ../config-host.mak +-include $(SRC_PATH)/Makefile.objs +-include $(SRC_PATH)/rules.mak + +$(call set-vpath, $(SRC_PATH):$(SRC_PATH)/libcacard) + +ifeq ($(CONFIG_WIN32),y) +QEMU_THREAD=qemu-thread-win32.o +else +QEMU_THREAD=qemu-thread-posix.o +endif + + +QEMU_OBJS=$(addprefix ../, $(QEMU_THREAD) $(oslib-obj-y) $(trace-obj-y) qemu-malloc.o qemu-timer-common.o) + +QEMU_CFLAGS+=-I../ + +clean: + rm -f *.o */*.o *.d */*.d *.a */*.a *~ */*~ +
libcacard/cac.c new file +403 -0
403 lines not on this page · raw message
libcacard/cac.h new file +23 -0
@@ -0,0 +1,23 @@ +/* +* defines the entry point for the cac card. Only used by cac.c anc +* vcard_emul_type.c +* +* 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 CAC_H +#define CAC_H 1 +#include "vcard.h" +#include "vreader.h" +/* +* Initialize the cac card. This is the only public function in this file. All +* the rest are connected through function pointers. +*/ +VCardStatus cac_card_init (VReader *reader,VCard *card,const char *params, +unsigned char *const *cert,int cert_len[], +VCardKey *key[]/* adopt the keys*/ , +int cert_count); + +/* not yet implemented */ +VCardStatus cac_is_cac_card (VReader *reader); +#endif
libcacard/card_7816.c new file +763 -0
763 lines not on this page · raw message
libcacard/card_7816.h new file +62 -0
62 lines not on this page · raw message
libcacard/card_7816t.h new file +165 -0
165 lines not on this page · raw message
libcacard/event.c new file +106 -0
106 lines not on this page · raw message
libcacard/eventt.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* 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 EVENTT_H +#define EVENTT_H 1 +#include "vreadert.h" +#include "vcardt.h" + +typedef struct VEventStruct VEvent ; + +typedef enum { +VEVENT_READER_INSERT , +VEVENT_READER_REMOVE , +VEVENT_CARD_INSERT , +VEVENT_CARD_REMOVE , +VEVENT_LAST , +}VEventType ; + +struct VEventStruct { +VEvent *next; +VEventType type; +VReader *reader; +VCard *card; +}; +#endif + +
libcacard/link_test.c new file +22 -0
@@ -0,0 +1,22 @@ +/* +* 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. +*/ + +#include <stdio.h> +#include "vcard.h" + +VCardStatus cac_card_init (const char *flags,VCard *card, +const unsigned char *cert[], +int cert_len[],VCardKey *key[]/* adopt the keys*/ , +int cert_count); +/* +* this will crash... just test the linkage right now +*/ + +main(int argc, char **argv) +{ + VCard *card; /* no constructor yet */ +cac_card_init ("" , card,NULL ,0 ,NULL ,0 ); +} +
libcacard/vcard.c new file +339 -0
339 lines not on this page · raw message
libcacard/vcard.h new file +86 -0
86 lines not on this page · raw message
libcacard/vcard_emul.h new file +65 -0
65 lines not on this page · raw message
libcacard/vcard_emul_nss.c new file +1157 -0
773 lines not on this page · raw message
libcacard/vcard_emul_type.c new file +57 -0
57 lines not on this page · raw message
libcacard/vcardt.h new file +64 -0
64 lines not on this page · raw message
libcacard/vreader.c new file +513 -0
513 lines not on this page · raw message
libcacard/vreader.h new file +55 -0
55 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.4.2
Part of the diff is not shown here. View the raw message.
Quoted 4 lines · Alon Levy
This patchset adds three new devices, usb-ccid, ccid-card-passthru and ccid-card-emulated, providing a CCID bus, a simple passthru protocol implementing card requiring a client, and a standalone emulated card.
Please note that patches 0,1,2,3,4,5 got sent as duplicate, I apologize for the noise, and patches 7,8,9,10 are not linked to the cover letter since I had to send them separately and didn't set the correct header.
Alon
Quoted 303 lines
It also introduces a new directory libcaccard with CAC card emulation, CAC is a type of ISO 7816 smart card.
Tree for pull:
git://anongit.freedesktop.org/~alon/qemuusb_ccid.v25.clean
v24->v25changes:
* libcacard:
* Fix out of tree build
* Fix build for linux-user targets
v23->v24changes:
* libcacard:
= changed patches: (that need re-review)
* 6 - libcacard: initial commit
* 7 - libcacard: add vscclient
= changed but trust me don't need rereview:
* 5 - ccid: add passthru card device (removed a duplicate line in the header, had two licenses).
* drop "libcacard add passthru" patch, not ready, not used.
* remove unrequired includes
* use stderr in vscclient for printing errors
* cosmetic fixes
v22->v23changes:
* libcacard
* configure fixes: (reported by Stefan Hajnoczi)
* test a = b, not a == b (second isn't portable)
* quote $source_path in case it contains spaces
- this doesn't really help since there are many other places that need similar fixes, not introduced by this patch.
v21->v22changes:
* libcacard:
* fix configure to not link libcacard if nss not found (reported by Stefan Hajnoczi)
* fix vscclient linkage with simpletrace backend (reported by Stefan Hajnoczi)
*card_7816.c: add missing break inERROR_DATA_NOT_FOUND(reported by William van de Velde)
v20->v21changes:
* all: cosmetics
* libcacard, ccid-card-passthru:
* use qemu-{malloc,free} and qemu-thread,error_report
* libcacard:
* split to multiple patches
v19->v20changes:
* checkpatch.pl. Here are the remaining errors with explanation:
* ignored 5 macro errors of the type
"ERROR: Macros with complex values should be enclosed in parenthesis" because fixing them breaks current code, if it really bothers someone I can fix it.
* four of them are inlibcacard/card_7816t.h:/* give the subfields a unified look */ ..#define
a_claa_header->ah_cla/* class */
#definea_insa_header->ah_ins/* instruction */
#definea_p1a_header->ah_p1/* parameter 1 */
#definea_p2a_header->ah_p2/* parameter 2 */
* and the fifth:
#4946: FILE:libcacard/vcardt.h:31:(quoted diff) +2
-0+#define VCARD_ATR_PREFIX(size) 0x3b, 0x66+(size), 0x00, 0xff, \ + 'V', 'C', 'A', 'R', 'D', '_' * Ignored this warning since I couldn't figure it out, and it's a test file:WARNING: externs should be avoided in .c files #2343: FILE:
libcacard/link_test.c:7:
+VCardStatus cac_card_init(const char *flags, VCard *card,v18-v19 changes:
* more merges, down to a single digit number of patches.
* drop enumeration property, use string.
* rebased (trivial)v17-v18 changes:
* mergevscard_common.hpatches.
* actually provide a tree to pull.v16-v17 changes:
* merged all the "v15->v16" patches
* merged some more wherever it was easy (all same file commits).
* added signed off by to first four patches
*ccid.h: added copyright, removed underscore in defines, and replaced non C89 commentsv15-v16 changes:
* splitvscard_commonintroducing patch for ease of review
* sum of commit logs for the v15-v16 commits: (whitespace fixes
removed for space, see original commit messages in later patches)
* usb-ccid:
* fix abort on client answer after card remove
* enable migration
* remove side affect code from asserts
* return consistent self-powered state
* mask out reserved bits inccid_set_parameters
* add missing abRFU in SetParameters (no affect on linux guest)
*vscard_common.hprotocol change:
* VSCMsgInit capabilities and magic
* removed ReaderResponse, will use Error instead with code==VSC_SUCCESS.
* added Flush and FlushComplete, remove Reconnect.
* defineVSCARD_MAGIC
* added error codeVSC_SUCCESS.
* ccid-card-passthru
* return correct size
* return error instead of assert if client sent too large ATR
* don't assert if client sent too large a size, but add asserts for indices to buffer
* resetvscard_inindices on chardev disconnect
* handle init from client
* error if no chardev supplied
* use ntoh, hton
* eradicatereader_id_t
* remove Reconnect usage (removed from VSCARD protocol)
* sendVSC_SUCCESSon card insert/remove and reader add/remove
* ccid-card-emulated
* fix error reporting in initfnv14-v15 changes:
* add patch with --enable-smartcard and --disable-smartcard and only disable ccid-card-emulated if nss not found.
* add patch with description strings
* s/libcaccard/libcacard/ indocs/ccid.txtv13-v14 changes:
- support device_del/device_add on ccid-card-* and usb-ccid
* usb-ccid:
* lose card reference when card device deleted
* check slot number and deny adding a slot if one is already added.
* ccid-card-*: useqdev_simple_unplug_cbin both emulated and passthru ccid cards, the exitfn already takes care of triggering card removal in the usb dev.
* libcacard:
* remove double include of config-host.mak
* add replay of card events to libcacard to support second and more emulation
* don't initialize more then once (doesn't support it right now, so one thread, NSS thread, is left whendevice_delis done)
* addVCARD_EMUL_INIT_ALREADY_INITED
* ccid-card-emulated:
* take correct mutexes on signaling to fix deadlocks ondevice_del
* allow card insertion/removal event without proper reader insertion eventv12-v13 changes:
* libcacard:
* fixMakefileclean to remove vscclient
* fix double include of config-host inMakefile
* usb-ccid: remove attach/detach logic, usb is always attached. Guest doesn't care if there is a reader attached with no card anyway.
* ccid-card-passthru: don't closechr_devon removal, makes it possible to use device_del/device_add to create remove/insertion for debugging.v11-v12 changes:
* fix out of tree buildv10-v11 changes:
* fix last patch that removed one of the doc files.
* updated flow table indocs/ccid.txtv8-v10 changes:
* usb-ccid:
* add slot for future use (Gerd)
* ifdefENABLE_MIGRATIONfor migration support on account of usb migration not being ready in general. (Gerd)
* verbosified commit messages. (Gerd)
* put libcacard docs in libcacard commit. (Gerd)v8-v9 changes:
* Blue Swirl comments:
* white space fixes
* enabled by default, disabled only if missing nss
* forgotten fix from v8 (don't build libcacard.so)
* added a note about device being little endian
* library renamed from libcaccard to libcacard
* squashed both of libcacard patches, they touched different files anyway.v7-v8 changes:
* Blue Swirl comments:
* usb-ccid: deannonymize some structs
* usb-ccid: coding style change -answer_tandbulk_in_tfixed
* usb-ccid: handle endianess conversion between guest and host
* usb-ccid: s/ccid_bulk_in_copy_out/ccid_bulk_in_copy_to_guest/
* ccid-card-emulated: fix segfault if backend not specified
* ccid-card-emulated: let last reader inserted win
* libcaccard: remove doublevscard_common.h
v6->v7changes:
* external libcaccard became internal directory libcaccard
* statically link object files into qemu
* produce libcaccard.so for usage by external projects
* applied coding style to new code (please check me)
- did not use the qemu options parsing for libcaccard, since it seems to draw large amounts of qemu code (monitor for instance).
v5->v6changes:
* really remove static debug (I apologize for claiming to have done so before)
v4->v5changes:
* rebased to latest
* remove static debug in card devices
* fix --enable-smartcard to link
* stall instead of assert when exceedingBULK_OUT_DATA_SIZE
* makeccid_reserve_recv_buffor too large len discard message, not exit
* makeccid_reserve_recv_bufreturn void*
* fix typo
* remove commented code in VMState
v3->v4:
* remove ccid field in CCIDBus
* remove static debug in bus
* add back docs
v2->v3:
* split into bus (usb-ccid.c, usesccid.h) and card (ccid-card-passthru.c).
* removed documentation (being revised).
v1->v2:
* all QSIMPLEQ turned into fixed sized rings
* all allocated buffers turned into fixed size buffers
* added migration support
* added a message to tell client qemu has migrated to ip:port
* for lack of monitor commands ip:port are 0:0, which causes the updated vscclient to connect to one port higher on the same host. will add monitor commands in a separate patch. tested with current setup.Alon Levy (7):
trace: move trace objects fromMakefileto Makefile.objsqemu-thread.h: includeinttypes.h
usb-ccid: add CCID bus
introducelibcacard/vscard_common.h
ccid: add passthru card device
ccid: add ccid-card-emulated device
ccid: add docsRobert Relyea (3):
libcacard: initial commit
libcacard: add vscclient
libcacard: add docsMakefile | 38 +- Makefile.objs | 39 ++ Makefile.target | 6 + configure | 60 ++ docs/ccid.txt | 135 ++++ docs/libcacard.txt | 483 +++++++++++++++ hw/ccid-card-emulated.c | 595 ++++++++++++++++++ hw/ccid-card-passthru.c | 340 +++++++++++ hw/ccid.h | 59 ++ hw/usb-ccid.c | 1419 +++++++++++++++++++++++++++++++++++++++++++ libcacard/Makefile | 25 + libcacard/cac.c | 403 ++++++++++++ libcacard/cac.h | 23 + libcacard/card_7816.c | 763 +++++++++++++++++++++++ libcacard/card_7816.h | 62 ++ libcacard/card_7816t.h | 165 +++++ libcacard/event.c | 106 ++++ libcacard/eventt.h | 29 + libcacard/link_test.c | 22 + libcacard/vcard.c | 339 +++++++++++ libcacard/vcard.h | 86 +++ libcacard/vcard_emul.h | 65 ++ libcacard/vcard_emul_nss.c | 1157 +++++++++++++++++++++++++++++++++++ libcacard/vcard_emul_type.c | 57 ++ libcacard/vcard_emul_type.h | 32 + libcacard/vcardt.h | 64 ++ libcacard/vevent.h | 27 + libcacard/vreader.c | 513 ++++++++++++++++ libcacard/vreader.h | 55 ++ libcacard/vreadert.h | 24 + libcacard/vscard_common.h | 178 ++++++ libcacard/vscclient.c | 652 ++++++++++++++++++++ qemu-thread.h | 2 + 33 files changed, 7989 insertions(+), 34 deletions(-) create mode 100644 docs/ccid.txt create mode 100644 docs/libcacard.txt create mode 100644 hw/ccid-card-emulated.c create mode 100644 hw/ccid-card-passthru.c create mode 100644 hw/ccid.h create mode 100644 hw/usb-ccid.c create mode 100644 libcacard/Makefile create mode 100644 libcacard/cac.c create mode 100644 libcacard/cac.h create mode 100644 libcacard/card_7816.c create mode 100644 libcacard/card_7816.h create mode 100644 libcacard/card_7816t.h create mode 100644 libcacard/event.c create mode 100644 libcacard/eventt.h create mode 100644 libcacard/link_test.c create mode 100644 libcacard/vcard.c create mode 100644 libcacard/vcard.h create mode 100644 libcacard/vcard_emul.h create mode 100644 libcacard/vcard_emul_nss.c create mode 100644 libcacard/vcard_emul_type.c create mode 100644 libcacard/vcard_emul_type.h create mode 100644 libcacard/vcardt.h create mode 100644 libcacard/vevent.h create mode 100644 libcacard/vreader.c create mode 100644 libcacard/vreader.h create mode 100644 libcacard/vreadert.h create mode 100644 libcacard/vscard_common.h create mode 100644 libcacard/vscclient.cSignature · 1 line
1.7.4.2