[pkg-opensc-commit] [opensc] 42/295: card-starcos: use transceive length from EF.ATR

Eric Dorland eric at moszumanska.debian.org
Sat Jun 24 21:11:14 UTC 2017


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository opensc.

commit b232c9b675fb286a5a9df02fb1fb5f39cbc96cd2
Author: Frank Morgner <frankmorgner at gmail.com>
Date:   Thu Jun 30 08:25:44 2016 +0200

    card-starcos: use transceive length from EF.ATR
    
    fixes https://github.com/OpenSC/OpenSC/issues/765
---
 src/libopensc/card-starcos.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/libopensc/card-starcos.c b/src/libopensc/card-starcos.c
index cc87fad..18eb4a0 100644
--- a/src/libopensc/card-starcos.c
+++ b/src/libopensc/card-starcos.c
@@ -26,9 +26,10 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "internal.h"
 #include "asn1.h"
 #include "cardctl.h"
+#include "internal.h"
+#include "iso7816.h"
 
 static struct sc_atr_table starcos_atrs[] = {
 	{ "3B:B7:94:00:c0:24:31:fe:65:53:50:4b:32:33:90:00:b4", NULL, NULL, SC_CARD_TYPE_STARCOS_GENERIC, 0, NULL },
@@ -151,6 +152,18 @@ static int starcos_init(sc_card_t *card)
 		card->max_recv_size = 128;
 	}
 
+	if (sc_parse_ef_atr(card) == SC_SUCCESS) {
+		if (card->ef_atr->card_capabilities & ISO7816_CAP_EXTENDED_LENGTH) {
+			card->caps |= SC_CARD_CAP_APDU_EXT;
+		}
+		if (card->ef_atr->max_response_apdu > 0) {
+			card->max_recv_size = card->ef_atr->max_response_apdu;
+		}
+		if (card->ef_atr->max_command_apdu > 0) {
+			card->max_send_size = card->ef_atr->max_command_apdu;
+		}
+	}
+
 	return 0;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/opensc.git



More information about the pkg-opensc-commit mailing list