[PATCH libcacard] Do not fail, if the caller didn't pick up response from previous call

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

 



Hello all,
cross-posting the originally opened pull request on github [1] (with attached patch):

During our testing of a new CAC driver in OpenSC, with this library, we encountered a problem with |libcacard| failing and the driver returning only a fraction of the requested objects.

The problem is that the Emulator wants to return the data (properly signalized by 61 (RESPONSE BYTES) in SW1), but this is ignored for some reason in some of our calls from OpenSC. The Emulator should not fail hard for the next independent request, rather silently drop the buffer and serve the ongoing APDU request (I would left for consideration to somehow log such problem).

Patch was successfully tested on Fedora 24 host and solves our problem (though we worked around the problem already in the driver too).

[1] https://github.com/SPICE/libcacard/pull/1

Kind regards,
Jakub Jelen
>From 9ea4232c2bf3a51d17a1419d255297c6b7dc7809 Mon Sep 17 00:00:00 2001
From: Jakub Jelen <jjelen@xxxxxxxxxx>
Date: Fri, 12 Aug 2016 11:31:37 +0200
Subject: [PATCH] Do not fail, if the caller didn't pick up response from
 previous call

---
 src/card_7816.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/card_7816.c b/src/card_7816.c
index 8b12689..b598ef9 100644
--- a/src/card_7816.c
+++ b/src/card_7816.c
@@ -732,11 +732,9 @@ vcard_process_apdu(VCard *card, VCardAPDU *apdu, VCardResponse **response)
     }
     buffer_response = vcard_get_buffer_response(card);
     if (buffer_response && apdu->a_ins != VCARD7816_INS_GET_RESPONSE) {
-        /* clear out buffer_response, return an error */
+        /* clear out buffer_response, do not return an error */
         vcard_set_buffer_response(card, NULL);
         vcard_buffer_response_delete(buffer_response);
-        *response = vcard_make_response(VCARD7816_STATUS_EXC_ERROR);
-        return VCARD_DONE;
     }
 
     status = vcard_process_applet_apdu(card, apdu, response);
-- 
2.7.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://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]