[svn] GnuPG - r4231 - trunk/scd

svn author marcus cvs at cvs.gnupg.org
Tue Aug 29 20:29:32 CEST 2006


Author: marcus
Date: 2006-08-29 20:29:30 +0200 (Tue, 29 Aug 2006)
New Revision: 4231

Modified:
   trunk/scd/ChangeLog
   trunk/scd/app-openpgp.c
Log:
2006-08-28  Marcus Brinkmann  <marcus at g10code.de>

        * app-openpgp.c (do_decipher, do_sign): Allow "OPENPGP.2"
        resp. "OPENPGP.1" for KEYIDSTR.



Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog	2006-08-29 16:18:30 UTC (rev 4230)
+++ trunk/scd/ChangeLog	2006-08-29 18:29:30 UTC (rev 4231)
@@ -1,3 +1,8 @@
+2006-08-28  Marcus Brinkmann  <marcus at g10code.de>
+
+	* app-openpgp.c (do_decipher, do_sign): Allow "OPENPGP.2"
+	resp. "OPENPGP.1" for KEYIDSTR.
+
 2006-08-21  Werner Koch  <wk at g10code.com>
 
 	* pcsc-wrapper.c (handle_open, handle_close): Reset card and

Modified: trunk/scd/app-openpgp.c
===================================================================
--- trunk/scd/app-openpgp.c	2006-08-29 16:18:30 UTC (rev 4230)
+++ trunk/scd/app-openpgp.c	2006-08-29 18:29:30 UTC (rev 4231)
@@ -2128,27 +2128,31 @@
     }
 
   /* Check whether an OpenPGP card of any version has been requested. */
-  if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
-    return gpg_error (GPG_ERR_INV_ID);
-  
-  for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
+  if (!strcmp (keyidstr, "OPENPGP.1"))
     ;
-  if (n != 32)
+  else if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
     return gpg_error (GPG_ERR_INV_ID);
-  else if (!*s)
-    ; /* no fingerprint given: we allow this for now. */
-  else if (*s == '/')
-    fpr = s + 1; 
   else
-    return gpg_error (GPG_ERR_INV_ID);
+    {
+      for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
+	;
+      if (n != 32)
+	return gpg_error (GPG_ERR_INV_ID);
+      else if (!*s)
+	; /* no fingerprint given: we allow this for now. */
+      else if (*s == '/')
+	fpr = s + 1; 
+      else
+	return gpg_error (GPG_ERR_INV_ID);
 
-  for (s=keyidstr, n=0; n < 16; s += 2, n++)
-    tmp_sn[n] = xtoi_2 (s);
+      for (s=keyidstr, n=0; n < 16; s += 2, n++)
+	tmp_sn[n] = xtoi_2 (s);
 
-  if (app->serialnolen != 16)
-    return gpg_error (GPG_ERR_INV_CARD);
-  if (memcmp (app->serialno, tmp_sn, 16))
-    return gpg_error (GPG_ERR_WRONG_CARD);
+      if (app->serialnolen != 16)
+	return gpg_error (GPG_ERR_INV_CARD);
+      if (memcmp (app->serialno, tmp_sn, 16))
+	return gpg_error (GPG_ERR_WRONG_CARD);
+    }
 
   /* If a fingerprint has been specified check it against the one on
      the card.  This is allows for a meaningful error message in case
@@ -2322,28 +2326,32 @@
     return gpg_error (GPG_ERR_INV_VALUE);
 
   /* Check whether an OpenPGP card of any version has been requested. */
-  if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
-    return gpg_error (GPG_ERR_INV_ID);
-  
-  for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
+  if (!strcmp (keyidstr, "OPENPGP.2"))
     ;
-  if (n != 32)
+  else if (strlen (keyidstr) < 32 || strncmp (keyidstr, "D27600012401", 12))
     return gpg_error (GPG_ERR_INV_ID);
-  else if (!*s)
-    ; /* no fingerprint given: we allow this for now. */
-  else if (*s == '/')
-    fpr = s + 1; 
   else
-    return gpg_error (GPG_ERR_INV_ID);
+    {
+      for (s=keyidstr, n=0; hexdigitp (s); s++, n++)
+	;
+      if (n != 32)
+	return gpg_error (GPG_ERR_INV_ID);
+      else if (!*s)
+	; /* no fingerprint given: we allow this for now. */
+      else if (*s == '/')
+	fpr = s + 1; 
+      else
+	return gpg_error (GPG_ERR_INV_ID);
+      
+      for (s=keyidstr, n=0; n < 16; s += 2, n++)
+	tmp_sn[n] = xtoi_2 (s);
+      
+      if (app->serialnolen != 16)
+	return gpg_error (GPG_ERR_INV_CARD);
+      if (memcmp (app->serialno, tmp_sn, 16))
+	return gpg_error (GPG_ERR_WRONG_CARD);
+    }
 
-  for (s=keyidstr, n=0; n < 16; s += 2, n++)
-    tmp_sn[n] = xtoi_2 (s);
-
-  if (app->serialnolen != 16)
-    return gpg_error (GPG_ERR_INV_CARD);
-  if (memcmp (app->serialno, tmp_sn, 16))
-    return gpg_error (GPG_ERR_WRONG_CARD);
-
   /* If a fingerprint has been specified check it against the one on
      the card.  This is allows for a meaningful error message in case
      the key on the card has been replaced but the shadow information




More information about the Gnupg-commits mailing list