[svn] GnuPG - r4750 - trunk/scd

svn author wk cvs at cvs.gnupg.org
Mon Apr 21 09:53:21 CEST 2008


Author: wk
Date: 2008-04-21 09:53:20 +0200 (Mon, 21 Apr 2008)
New Revision: 4750

Modified:
   trunk/scd/ChangeLog
   trunk/scd/app-openpgp.c
Log:
Use default PIN flag


Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog	2008-04-18 09:20:25 UTC (rev 4749)
+++ trunk/scd/ChangeLog	2008-04-21 07:53:20 UTC (rev 4750)
@@ -1,3 +1,7 @@
+2008-04-21  Werner Koch  <wk at g10code.com>
+
+	* app-openpgp.c (verify_a_chv): Make use of the default CHV flag.
+
 2008-03-26  Werner Koch  <wk at g10code.com>
 
 	* app-openpgp.c (verify_chv3): Support the keypad.

Modified: trunk/scd/app-openpgp.c
===================================================================
--- trunk/scd/app-openpgp.c	2008-04-18 09:20:25 UTC (rev 4749)
+++ trunk/scd/app-openpgp.c	2008-04-21 07:53:20 UTC (rev 4750)
@@ -481,7 +481,7 @@
   return n;
 }
 
-/* GnuPG makes special use of the login-data DO, this fucntion parses
+/* GnuPG makes special use of the login-data DO, this function parses
    the login data to store the flags for later use.  It may be called
    at any time and should be called after changing the login-data DO.
 
@@ -1300,6 +1300,25 @@
 
   *pinvalue = NULL;
 
+  if (chvno == 2 && app->app_local->flags.def_chv2)
+    {
+      /* Special case for def_chv2 mechanism. */
+      if (opt.verbose)
+        log_info (_("using default PIN as %s\n"), "CHV2");
+      rc = iso7816_verify (app->slot, 0x82, "123456", 6);
+      if (rc)
+        {
+          /* Verification of CHV2 with the default PIN failed,
+             although the card pretends to have the default PIN set as
+             CHV2.  We better disable the def_chv2 flag now. */
+          log_info (_("failed to use default PIN as %s: %s"
+                      " - disabling further default use\n"),
+                    "CHV2", gpg_strerror (rc));
+          app->app_local->flags.def_chv2 = 0;
+        }
+      return rc;
+    }
+
   memset (&pininfo, 0, sizeof pininfo);
   pininfo.mode = 1;
   pininfo.minlen = minlen;




More information about the Gnupg-commits mailing list