<div dir="ltr"><div>My FST-01 is in a state where it can't be unblocked using gpg, nor can it be reflashed using an SWD connection. Here is my story.</div><div><br></div><div>I ordered two FST-01 devices from SeeedStudio. They arrived today. I inserted one into my Linux machine and updated the firmware to the latest version using this guide: <a href="https://raymii.org/s/tutorials/FST-01_firmware_upgrade_via_usb.html">https://raymii.org/s/tutorials/FST-01_firmware_upgrade_via_usb.html</a>. The most recent commit was this:</div><div><br></div><div>commit 4ff0b3c5f896750a14b6a5d1853ac9246ecc506e</div><div>Author: NIIBE Yutaka <<a href="mailto:gniibe@fsij.org">gniibe@fsij.org</a>></div><div>Date:   Tue Jan 9 09:39:42 2018 +0900</div><div><br></div><div>    tests: Fix for card readers.</div><div><br></div><div>gpg2 --card-status seemed to work fine, and usb_strings.py reported version 1.2.7:</div><div><br></div><div>$ ./tool/usb_strings.py </div><div>    Vendor: Free Software Initiative of Japan</div><div>   Product: Gnuk Token</div><div>    Serial: FSIJ-1.2.7-87061942</div><div>  Revision: release/1.2.7-3-g4ff0b3c</div><div>    Config: FST_01:dfu=no:debug=no:pinpad=no:certdo=no:factory_reset=no</div><div>       Sys: 1.0</div><div><br></div><div>I then began configuring the device as a normal OpenPGP smart card. I set the admin PIN, reset code, and user PIN. I then attempted a "keytocard" operation with my existing RSA-4096 encryption key, but when I was prompted for the admin PIN, it failed. I entered it again, being careful that it was the same one that I had set minutes earlier. It didn't work. I eventually locked myself out of the device:</div><div><br></div><div>$ gpg2 --card-status</div><div>Reader ...........: 234B:0000:FSIJ-1.2.7-87061942:0</div><div>Application ID ...: D276000124010200FFFE870619420000</div><div>Version ..........: 2.0</div><div>Manufacturer .....: unmanaged S/N range</div><div>Serial number ....: 87061942</div><div>Name of cardholder: Mike Tsao</div><div>Language prefs ...: [not set]</div><div>Sex ..............: unspecified</div><div>URL of public key : <a href="https://keybase.io/sowbug/key.asc">https://keybase.io/sowbug/key.asc</a></div><div>Login data .......: [not set]</div><div>Signature PIN ....: forced</div><div>Key attributes ...: rsa2048 rsa4096 rsa2048</div><div>Max. PIN lengths .: 127 127 127</div><div>PIN retry counter : 0 3 0</div><div>Signature counter : 0</div><div>Signature key ....: [none]</div><div>Encryption key....: [none]</div><div>Authentication key: [none]</div><div>General key info..: [none]</div><div><br></div><div>I concluded that I would have to reflash the device using stlinkv2.py -u, but it gave an unexpected error:</div><div><br></div><div>$ sudo ./tool/stlinkv2.py -u</div><div>ST-Link/V2 version info: 2 29 7</div><div>Change ST-Link/V2 mode 0002 -> 0002</div><div>Core does not halt, try API V2 halt.</div><div>ValueError('Status of core is not halt.', 128)</div><div><br></div><div>I attempted to connect to the device using a Windows machine and the official STM STLink utility. It didn't work. I then connected to the second FST-01, which was still new. The Windows STLink utility recognized it. usb_strings.py also recognizes it:</div><div><br></div><div>$ ./tool/usb_strings.py </div><div>    Vendor: Free Software Initiative of Japan</div><div>   Product: FSIJ USB Token</div><div>    Serial: FSIJ-1.0.1-50FF6E06</div><div>  Revision: release/1.0.1</div><div>    Config: FST_01:dfu=no:debug=no:pinpad=no:certdo=yes:keygen=yes</div><div>       Sys: 1.0</div><div><br></div><div>At this point I know the following:</div><div><br></div><div>- My ST-Link v2 programmer works.</div><div>- My jumper connections are correct.</div><div>- The second FST-01 is able to talk to the ST-Link programmer and utility.</div><div>- The first FST-01 is not able to connect to the ST-Link or be reflashed.</div><div>- I believe I fell victim to the issue where PINs cannot be set until the FST-01 has at least one key loaded on it (I read about this after making the mistake).</div><div>- I do not understand why the first FST-01 no longer responds to the ST-Link SWD connection.</div><div>- I built the gnuk software with its defaults, so it doesn't have the factory reset option.</div><div>- My FST-01 is now useless, because it is running gnuk with PIN retry counter : 0 3 0</div><div><br></div><div>What can I do to unbrick this device?</div></div>