Re: [xf86-video-qxl v6] Enable smartcard support for XSpice.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jeremy,

Ack.

Please see two minor comments below.

Thanks,
    Uri.


On 12/16/2014 12:24 AM, Jeremy White wrote:
This is done by creating a Unix domain socket to which smartcard
messages are transferred, using the vscard protocol.

A further system library, spiceccid, is used to provide an interface into
pcsc-lite, specifically the pcsc-lite daemon, so that regular Unix applications
can access the passed through smartcard information.

Signed-off-by: Jeremy White<jwhite@xxxxxxxxxxxxxxx>
---
  configure.ac                           |   25 ++
  examples/spiceqxl.xorg.conf.example    |    3 +
  src/Makefile.am                        |    3 +-
  src/qxl.h                              |    2 +
  src/qxl_driver.c                       |   14 +-
  src/spiceccid/Makefile.am              |   29 ++
  src/spiceccid/spice.pcsc.conf.template |    7 +
  src/spiceccid/spiceccid.c              |  477 ++++++++++++++++++++++++++++++++
  src/spiceqxl_smartcard.c               |  193 +++++++++++++
  src/spiceqxl_smartcard.h               |   31 +++
  10 files changed, 782 insertions(+), 2 deletions(-)
  create mode 100644 src/spiceccid/Makefile.am
  create mode 100644 src/spiceccid/spice.pcsc.conf.template
  create mode 100644 src/spiceccid/spiceccid.c
  create mode 100644 src/spiceqxl_smartcard.c
  create mode 100644 src/spiceqxl_smartcard.h

+++ b/src/spiceccid/spiceccid.c
@@ -0,0 +1,477 @@
+/*
+ * Copyright (C) 2014 CodeWeavers, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors:
+ *    Jeremy White<jwhite@xxxxxxxxxxxxxxx>
+ */
+
+/*----------------------------------------------------------------------------
+  Chip/Smart Card Interface Devices driver for Spice
+
+    This driver is built to interface to pcsc-lite as a serial smartcard
+  device.
+    It translates the IFD (Interface device) ABI into the Spice protocol.
+----------------------------------------------------------------------------*/
+

+
+static void process_atr(smartcard_ccid_t *ccid, VSCMsgHeader *h, char *data)
+{
+    ccid->atr_len = h->length;
+    if (h->length > 0 && h->length > sizeof(ccid->atr)) {

h->length is unsigned.
1. Why is there a need to check that h->length > 0 ?
2. What happens if h->length == 0 ?

+        fprintf(stderr, "Supplied ATR of length %d exceeds %d maximum\n",
+            h->length, sizeof(ccid->atr));
+        send_reply(ccid, VSC_GENERAL_ERROR);
+        return;
+    }
+
+    memset(ccid->atr, 0, sizeof(ccid->atr));
+    memcpy(ccid->atr, data, ccid->atr_len);
+
+    send_reply(ccid, VSC_SUCCESS);
+}
+
+static void process_apdu(smartcard_ccid_t *ccid, VSCMsgHeader *h, char *data)
+{
+    if (ccid->state & STATE_READER_ADDED)
+        push_apdu(ccid, data, h->length);

Maybe add: else { fprintf(stderr, "warning ..." }

+}
+
+static void process_card_remove(smartcard_ccid_t *ccid, VSCMsgHeader *h)
+{
+    ccid->atr_len = 0;
+    memset(ccid->atr, 0, sizeof(ccid->atr));
+    send_reply(ccid, VSC_SUCCESS);
+}
+
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]