From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=58525 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q4BoB-0002wr-IT for qemu-devel@nongnu.org; Mon, 28 Mar 2011 08:44:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q4Bfk-00008i-AQ for qemu-devel@nongnu.org; Mon, 28 Mar 2011 08:35:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q4Bfj-00008e-Q8 for qemu-devel@nongnu.org; Mon, 28 Mar 2011 08:35:52 -0400 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2SCZoTV019048 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Mar 2011 08:35:50 -0400 Message-ID: <4D90808B.1090605@redhat.com> Date: Mon, 28 Mar 2011 14:35:23 +0200 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v23 06/11] libcacard: initial commit References: <1300886393-2799-1-git-send-email-alevy@redhat.com> <1300886393-2799-7-git-send-email-alevy@redhat.com> In-Reply-To: <1300886393-2799-7-git-send-email-alevy@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alon Levy Cc: qemu-devel@nongnu.org On 03/23/11 14:19, Alon Levy wrote: > From: Robert Relyea > > 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 > > Signed-off-by: Alon Levy A couple of minor nits. > diff --git a/Makefile.objs b/Makefile.objs > index 744e1d3..f513ffa 100644 > --- a/Makefile.objs > +++ b/Makefile.objs > @@ -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) > diff --git a/Makefile.target b/Makefile.target > index 62b102a..7f163e3 100644 > --- a/Makefile.target > +++ b/Makefile.target > @@ -353,6 +353,8 @@ obj-y += $(addprefix $(HWDIR)/, $(hw-obj-y)) > > endif # CONFIG_SOFTMMU > > +obj-y += $(addprefix ../libcacard/, $(libcacard-$(CONFIG_SMARTCARD_NSS))) > + > obj-y += $(addprefix ../, $(trace-obj-y)) > obj-$(CONFIG_GDBSTUB_XML) += gdbstub-xml.o This is a bit backwards, normally we do foobar-$(CONFIG_FOOBAR) = foo.o bar.o and then later obj-y = $(foobar-y) > diff --git a/libcacard/cac.c b/libcacard/cac.c > new file mode 100644 > index 0000000..7a910d8 > --- /dev/null > +++ b/libcacard/cac.c > @@ -0,0 +1,406 @@ > +/* > + * implement the applets for the CAC card. > + * > + * This code is licensed under the GNU LGPL, version 2.1 or later. > + * See the COPYING.LIB file in the top-level directory. > + * > + */ > +#include > +#include > + > +#include "qemu-common.h" stdlib.h and string.h are both included by qemu-common.h > diff --git a/libcacard/card_7816.c b/libcacard/card_7816.c > new file mode 100644 > index 0000000..4c10cae > --- /dev/null > +++ b/libcacard/card_7816.c > @@ -0,0 +1,764 @@ > +/* > + * Implement the 7816 portion of the card spec > + * > + * This code is licensed under the GNU LGPL, version 2.1 or later. > + * See the COPYING.LIB file in the top-level directory. > + */ > + > +#include > +#include > +#include "qemu-common.h" same here > diff --git a/libcacard/event.c b/libcacard/event.c > new file mode 100644 > index 0000000..12722cc > --- /dev/null > +++ b/libcacard/event.c > @@ -0,0 +1,108 @@ > +/* > + * event queue implementation. > + * > + * This code is licensed under the GNU LGPL, version 2.1 or later. > + * See the COPYING.LIB file in the top-level directory. > + */ > + > +#include > + > +#include "qemu-thread.h" > +#include "qemu-common.h" again here > diff --git a/libcacard/vcard.c b/libcacard/vcard.c > new file mode 100644 > index 0000000..d7828a2 > --- /dev/null > +++ b/libcacard/vcard.c > @@ -0,0 +1,341 @@ > +/* > + * implement the Java card standard. > + * > + * 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 > +#include > + > +#include "qemu-common.h" and here > diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c > new file mode 100644 > index 0000000..d3ab7ea > --- /dev/null > +++ b/libcacard/vcard_emul_nss.c > @@ -0,0 +1,1159 @@ > +/* > + * This is the actual card emulator. > + * > + * These functions can be implemented in different ways on different platforms > + * using the underlying system primitives. For Linux it uses NSS, though direct > + * to PKCS #11, openssl+pkcs11, or even gnu crypto libraries+pkcs #11 could be > + * used. On Windows CAPI could be used. > + * > + * 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. > + */ > + > +/* > + * system headers > + */ > +#include > +#include > + > +/* > + * NSS headers > + */ > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include "qemu-common.h" again here prthread.h do you have a check for it in configure? I have to admit I really would prefer QEMU not relying on the NSPR stuff, but I don't know if it can be avoided with the ccid code? > diff --git a/libcacard/vreader.c b/libcacard/vreader.c > new file mode 100644 > index 0000000..0b67c6c > --- /dev/null > +++ b/libcacard/vreader.c > @@ -0,0 +1,519 @@ > +/* > + * emulate the reader > + * > + * 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. > + */ > + > +/* > + * System includes > + */ > +#include > +#include > + > +#include "qemu-thread.h" > +#include "qemu-common.h" and a last one.... Cheers, Jes