[Pkg-gnupg-commit] [gnupg2] 34/49: g10: Simplify "factory-reset" procedure.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Wed Nov 8 19:30:55 UTC 2017


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

dkg pushed a commit to branch master
in repository gnupg2.

commit f183b9768b42a6792c55a6129488bd8fbf5e8e6d
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Mon Oct 30 11:59:11 2017 +0900

    g10: Simplify "factory-reset" procedure.
    
    * g10/card-util.c (factory_reset): Simplify.
    
    --
    
    In this summer, I got report about old code before this change didn't
    work with newer Yubikey.  I got another report test version of OpenPGP
    card V3.3 implementation didn't work, either.  Then, I confirmed that
    according to the OpenPGP card specification, the procedure of old code
    is not expected by its author.
    
    This change simplify "factory-reset" as simple.
    
    Only versions of Gnuk 1.2.2, 1.2.3, 1.2.4, won't work with this
    change.  That's because the factory-reset feature of Gnuk was
    introduced by reading the implementation of GnuPG, instead of reading
    the specification.  Gnuk 1.2.5 and later works well.  All OpenPGPcard
    implementations I have work well (2.0, 2.1, 2.2, test version of 3).
    
    GnuPG-bug-id: 3286
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
    (cherry picked from commit d63b7966cdd72548c60466c620de5cd6104a779e)
---
 g10/card-util.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/g10/card-util.c b/g10/card-util.c
index ef67610..a396b7d 100644
--- a/g10/card-util.c
+++ b/g10/card-util.c
@@ -1760,9 +1760,6 @@ factory_reset (void)
         scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
         scd apdu 00 20 00 83 08 40 40 40 40 40 40 40 40
         scd apdu 00 e6 00 00
-        scd reset
-        scd serialno undefined
-        scd apdu 00 A4 04 00 06 D2 76 00 01 24 01
         scd apdu 00 44 00 00
         /echo Card has been reset to factory defaults
 
@@ -1837,17 +1834,6 @@ factory_reset (void)
         goto leave;
     }
 
-  /* The card is in termination state - reset and select again.  */
-  err = send_apdu (NULL, "RESET", 0);
-  if (err)
-    goto leave;
-  err = send_apdu ("undefined", "dummy select", 0);
-  if (err)
-    goto leave;
-
-  /* Select the OpenPGP application. (no error checking here). */
-  send_apdu ("00A4040006D27600012401", "SELECT AID", 0xffff);
-
   /* Send activate datafile command.  This is used without
      confirmation if the card is already in termination state.  */
   err = send_apdu ("00440000", "ACTIVATE DF", 0);

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



More information about the Pkg-gnupg-commit mailing list