[pkg-opensc-commit] [opensc] 40/295: EF.ATR: removed IAS/ECC workaround

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 9a325fc1db6e0be9aa7560c84d6f08418eacd070
Author: Frank Morgner <frankmorgner at gmail.com>
Date:   Thu Jun 30 13:18:45 2016 +0200

    EF.ATR: removed IAS/ECC workaround
    
    - IAS/ECC has the category indicator byte in EF.ATR, which is a
      violation of ISO 7816-4, where it is only allowed in the historical
      bytes of ATR. Removing the IAS/ECC specific modification of EF.ATR
      allows reading ISO complient EF.ATR again.
    - IAS/ECC parsing should still be successfull. We now always try to
      check for ISO7816_TAG_II_STATUS_SW ignoring the category indicator
      byte
---
 src/libopensc/ef-atr.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/src/libopensc/ef-atr.c b/src/libopensc/ef-atr.c
index ff9d5f6..738306c 100644
--- a/src/libopensc/ef-atr.c
+++ b/src/libopensc/ef-atr.c
@@ -38,16 +38,10 @@ sc_parse_ef_atr_content(struct sc_card *card, unsigned char *buf, size_t buflen)
 	const unsigned char *tag = NULL;
 	size_t taglen;
 	struct sc_ef_atr ef_atr;
-	unsigned char category;
 
 	LOG_FUNC_CALLED(ctx);
 
-	category = *buf;
-
 	memset(&ef_atr, 0, sizeof(struct sc_ef_atr));
-	/* IAS/ECC specific: skip second 'zero' byte */
-	if (*(++buf)  == 0x00)	
-		++buf;
 
 	tag = sc_asn1_find_tag(ctx, buf, buflen, ISO7816_TAG_II_CARD_SERVICE, &taglen);
 	if (tag && taglen >= 1)   {
@@ -105,12 +99,10 @@ sc_parse_ef_atr_content(struct sc_card *card, unsigned char *buf, size_t buflen)
 		}
 	}
 
-	if (category == ISO7816_II_CATEGORY_TLV)   {
-		tag = sc_asn1_find_tag(ctx, buf, buflen, ISO7816_TAG_II_STATUS_SW, &taglen);
-		if (tag && taglen == 2)   {
-			ef_atr.status = *(tag + 0) * 0x100 + *(tag + 1);
-			sc_log(ctx, "EF.ATR: status word 0x%X", ef_atr.status);
-		}
+	tag = sc_asn1_find_tag(ctx, buf, buflen, ISO7816_TAG_II_STATUS_SW, &taglen);
+	if (tag && taglen == 2)   {
+		ef_atr.status = *(tag + 0) * 0x100 + *(tag + 1);
+		sc_log(ctx, "EF.ATR: status word 0x%X", ef_atr.status);
 	}
 
 	if (!card->ef_atr)

-- 
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