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@fsij.org>
(cherry picked from commit d63b7966cd)
This commit is contained in:
NIIBE Yutaka 2017-10-30 11:59:11 +09:00 committed by Werner Koch
parent 6070f5a61d
commit f183b9768b
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
1 changed files with 0 additions and 14 deletions

View File

@ -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);