[svn] GnuPG - r4974 - trunk/scd

svn author wk cvs at cvs.gnupg.org
Wed Apr 1 16:38:22 CEST 2009


Author: wk
Date: 2009-04-01 16:38:22 +0200 (Wed, 01 Apr 2009)
New Revision: 4974

Modified:
   trunk/scd/ChangeLog
   trunk/scd/app-openpgp.c
Log:
Prepare for OpenPGP cards with extended length support.


Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog	2009-04-01 13:23:27 UTC (rev 4973)
+++ trunk/scd/ChangeLog	2009-04-01 14:38:22 UTC (rev 4974)
@@ -1,3 +1,8 @@
+2009-04-01  Werner Koch  <wk at g10code.com>
+
+	* app-openpgp.c (do_setattr, do_writekey): Prepare for extended
+	length cards.
+
 2009-03-31  Werner Koch  <wk at g10code.com>
 
 	* command.c (percent_plus_unescape): Remove.

Modified: trunk/scd/app-openpgp.c
===================================================================
--- trunk/scd/app-openpgp.c	2009-04-01 13:23:27 UTC (rev 4973)
+++ trunk/scd/app-openpgp.c	2009-04-01 14:38:22 UTC (rev 4974)
@@ -1772,9 +1772,11 @@
      will reread the data from the card and thus get synced in case of
      errors (e.g. data truncated by the card). */
   flush_cache_item (app, table[idx].tag);
-  /* For command chaining we use a value of 254 for this card.  */
-  if (app->app_local->cardcap.cmd_chaining && valuelen > 254)
-    exmode = -254;
+
+  if (app->app_local->cardcap.ext_lc_le && valuelen > 254)
+    exmode = 1;    /* Use extended length w/o a limit.  */
+  else if (app->app_local->cardcap.cmd_chaining && valuelen > 254)
+    exmode = -254; /* Command chaining with max. 254 bytes.  */
   else
     exmode = 0;
   rc = iso7816_put_data (app->slot, exmode, table[idx].tag, value, valuelen);
@@ -2432,7 +2434,9 @@
         goto leave;
 
       /* Store the key. */
-      if (app->app_local->cardcap.cmd_chaining && template_len > 254)
+      if (app->app_local->cardcap.ext_lc_le && template_len > 254)
+        exmode = 1;    /* Use extended length w/o a limit.  */
+      else if (app->app_local->cardcap.cmd_chaining && template_len > 254)
         exmode = -254;
       else
         exmode = 0;




More information about the Gnupg-commits mailing list