summaryrefslogtreecommitdiff
path: root/libcacard/vreader.c
AgeCommit message (Collapse)AuthorFilesLines
2014-06-11Merge remote-tracking branch 'remotes/bonzini/configure' into stagingPeter Maydell1-10/+8
* remotes/bonzini/configure: rules.mak: Rewrite unnest-vars configure: unset interfering variables configure: duplicate/incorrect order of -lrt libcacard: improve documentation libcacard: actually use symbols file libcacard: replace qemu thread primitives with glib ones vscclient: use glib thread primitives not qemu glib-compat.h: add new thread API emulation on top of pre-2.31 API Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-06-10libcacard: Clean up dead stores before g_free()Markus Armbruster1-2/+0
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-06-10libcacard: Drop superfluous conditionals around g_free()Markus Armbruster1-3/+1
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-06-10libcacard: replace qemu thread primitives with glib onesMichael Tokarev1-10/+8
Replace QemuMutex with GMutex and QemuCond with GCond (with corresponding function changes), to make libcacard independent of qemu internal functions. After this step, none of libcacard internals use any qemu-provided symbols. Maybe it's a good idea to stop including qemu-common.h internally too. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Alon Levy <alevy@redhat.com> Tested-by: Alon Levy <alevy@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-05-26libcacard: remove useless initializersMichael Tokarev1-5/+5
libcacard has many functions which initializes local variables at declaration time, which are always assigned some values later (often right after declaration). Clean up these initializers. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-05-24libcacard/vreader: Tighten assertion to clarify intentMarkus Armbruster1-1/+1
Bonus: hushes up Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-05-24libcacard/vreader: Drop broken recovery from failed assertionMarkus Armbruster1-5/+3
We suppress some code when we got unexpected status and assertion checking is off: assert(card_status == VCARD_DONE); if (card_status == VCARD_DONE) { int size = MIN(*receive_buf_len, response->b_total_len); memcpy(receive_buf, response->b_data, size); *receive_buf_len = size; } Such "recovery" is of dubious value even when it works. This one doesn't: it fails to assign to receive_buf[] and *receive_buf_len, which the callers expect. Make the code unconditional. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Alon Levy <alevy@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-05-24libcacard: g_malloc cleanupsMichael Tokarev1-8/+3
This patch replaces g_malloc() in libcacard into g_new() or g_new0() where appropriate (removing some init-to-zero surrounding code), g_malloc+memcpy into g_memdup() and the like. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Reviewed-by: Alon Levy <alevy@redhat.com>
2014-05-07libcacard: remove unnecessary EOL from debug printsAlon Levy1-2/+2
Signed-off-by: Alon Levy <alevy@redhat.com> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2013-04-24libcacard/vreader: add debugging messages for apduAlon Levy1-0/+77
Using g_debug with log domain libcacard Signed-off-by: Alon Levy <alevy@redhat.com> Reviewed-by: Marc-André Lureau <mlureau@redhat.com>
2013-01-30libcacard: Fix unchecked strdup() by converting to g_strdup()Markus Armbruster1-1/+1
Note that we already free with g_free(). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-19misc: move include files to include/qemu/Paolo Bonzini1-1/+1
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-10-05cleanup useless return sentenceAmos Kong1-1/+0
This patch cleans up return sentences in the end of void functions. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2011-08-20Use glib memory allocation and free functionsAnthony Liguori1-7/+7
qemu_malloc/qemu_free no longer exist after this commit. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-04-01libcacard: initial commitRobert Relyea1-0/+513
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 <alevy@redhat.com> --- 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 Signed-off-by: Alon Levy <alevy@redhat.com> libcacard: fix out of tree builds