[Gnuk-users] Upgrading gnuk on a nitrokey start

NIIBE Yutaka gniibe at fsij.org
Wed Aug 24 01:51:34 UTC 2016


Hello,

Thanks for further experiment with Nitrokey Start.

On 08/24/2016 02:26 AM, Remy van Elst wrote:
> $ python2 ./upgrade_by_passwd.py  ../regnual/regnual.bin
> ../src/build/gnuk.bin
> Admin password:
> ../regnual/regnual.bin: 4372
> ../src/build/gnuk.bin: 110592
> CRC32: 8d82b2df
> 
> Device:
> Configuration: 1
> Interface: 0
> 20001400:20004a00
> Downloading flash upgrade program...
> start 20001400
> end   20002500
> Run flash upgrade program...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> Wait 1 seconds...
> 
> 
> This goes on and on and on. Here's the dmesg output:
> 
> dmesg -wH
> [  +2.755257] usb 1-1.1: new full-speed USB device number 4 using ehci-pci
> [  +2.755257] usb 1-1.1: new full-speed USB device number 4 using ehci-pci
> [ +17.034260] usb 1-1-port1: disabled by hub (EMI?), re-enabling...
> [  +0.000008] usb 1-1.1: USB disconnect, device number 4
> [  +0.188718] usb 1-1.1: new low-speed USB device number 5 using ehci-pci
> [  +0.066661] usb 1-1.1: device descriptor read/64, error -32
> [  +0.170001] usb 1-1.1: device descriptor read/64, error -32
> [  +0.173339] usb 1-1.1: new low-speed USB device number 6 using ehci-pci
> [  +0.066655] usb 1-1.1: device descriptor read/64, error -32
> [  +0.169995] usb 1-1.1: device descriptor read/64, error -32
> [  +0.173326] usb 1-1.1: new low-speed USB device number 7 using ehci-pci
> [  +0.406782] usb 1-1.1: device not accepting address 7, error -32
> [  +0.069870] usb 1-1.1: new low-speed USB device number 8 using ehci-pci
> [  +0.406659] usb 1-1.1: device not accepting address 8, error -32
> [  +0.000199] usb 1-1-port1: unable to enumerate USB device

So, reGNUal doesn't work well on the device (USB does not work).

> I also have ordered two FST-01 without case, to see if the upgrade works
> there. If that is the case, there might be a nitrokey issue. If not, then I
> hope my STM adapter comes in soon to restore these devices and see if the
> upgrade works via the stm.
> 
> I still have the nitrokey plugged in, lights blinking. If someone has some
> magic USB scripts or so, I'll leave it plugged in as long as it goes.

I think that there is no way to recover, as USB seems not to be working.

For your information, I show my session log with FST-01.

I inserted FST-01 with Gnuk 1.0.1 on my PC.

=========================================  my session log
$ pwd
/home/gniibe/work/gnuk-1.2.1
$ cd src
$ ./configure --vidpid=234b:0000
Header file is: board-fst-01.h
Debug option disabled
Configured for bare system (no-DFU)
PIN pad option disabled
CERT.3 Data Object is NOT supported
Card insert/removal by HID device is NOT supported
$ cd ..
$ lsusb -d 234b:0000 -v

Bus 001 Device 004: ID 234b:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x234b
  idProduct          0x0000
  bcdDevice            2.00
  iManufacturer           1 Free Software Initiative of Japan
  iProduct                2 FSIJ USB Token
  iSerial                 3 FSIJ-1.0.1-50FF6E06
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           86
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass        11 Chip/SmartCard
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      ChipCard Interface Descriptor:
        bLength                54
        bDescriptorType        33
        bcdCCID              1.10  (Warning: Only accurate for version 1.0)
        nMaxSlotIndex           0
        bVoltageSupport         1  5.0V
        dwProtocols             2  T=1
        dwDefaultClock       3571
        dwMaxiumumClock      3571
        bNumClockSupported      1
        dwDataRate           9600 bps
        dwMaxDataRate        9600 bps
        bNumDataRatesSupp.      1
        dwMaxIFSD             254
        dwSyncProtocols  00000000
        dwMechanical     00000000
        dwFeatures       00020842
          Auto configuration based on ATR
          Auto parameter negotation made by CCID
          Short APDU level exchange
        dwMaxCCIDMsgLen       271
        bClassGetResponse    echo
        bClassEnvelope       echo
        wlcdLayout           none
        bPINSupport             0
        bMaxCCIDBusySlots       1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
Device Status:     0x0000
  (Bus Powered)
$ cd tool
$ ./upgrade_by_passwd.py -f ../regnual/regnual.bin ../src/build/gnuk.bin
../regnual/regnual.bin: 4428
../src/build/gnuk.bin: 110592
CRC32: d746d12a

Device:
Configuration: 1
Interface: 0
20001400:20004a00
Downloading flash upgrade program...
start 20001400
end   20002500
Run flash upgrade program...
Wait 1 seconds...
Device:
08001000:08020000
Downloading the program
start 08001000
end   0801b000
$ lsusb -d 234b:0000 -v

Bus 001 Device 006: ID 234b:0000
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        64
  idVendor           0x234b
  idProduct          0x0000
  bcdDevice            2.00
  iManufacturer           1 Free Software Initiative of Japan
  iProduct                2 Gnuk Token
  iSerial                 3 FSIJ-1.2.1-87061034
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           93
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass        11 Chip/SmartCard
      bInterfaceSubClass      0
      bInterfaceProtocol      0
      iInterface              0
      ChipCard Interface Descriptor:
        bLength                54
        bDescriptorType        33
        bcdCCID              1.10  (Warning: Only accurate for version 1.0)
        nMaxSlotIndex           0
        bVoltageSupport         1  5.0V
        dwProtocols             2  T=1
        dwDefaultClock       4000
        dwMaxiumumClock      4000
        bNumClockSupported      0
        dwDataRate           9600 bps
        dwMaxDataRate        9600 bps
        bNumDataRatesSupp.      0
        dwMaxIFSD             254
        dwSyncProtocols  00000000
        dwMechanical     00000000
        dwFeatures       0002047A
          Auto configuration based on ATR
          Auto voltage selection
          Auto clock change
          Auto baud rate change
          Auto parameter negotation made by CCID
          Auto IFSD exchange
          Short APDU level exchange
        dwMaxCCIDMsgLen       271
        bClassGetResponse    echo
        bClassEnvelope         FF
        wlcdLayout           none
        bPINSupport             0
        bMaxCCIDBusySlots       1
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0004  1x 4 bytes
        bInterval             255
Device Status:     0x0000
  (Bus Powered)
$ cd ../test
$ nosetests --with-freshen
............................................................................................................................................................................................................................................................................................................................................................................................
----------------------------------------------------------------------
Ran 380 tests in 473.934s

OK
$
=========================================

I just found that test may not work well in some environment (it has
been working well for me, but newer Python-usb would cause a problem),
so, I fixed in 23bbc9c755493ba5fe8317e401e0876fd7524d40.
-- 



More information about the gnuk-users mailing list