Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YubiHSM causes (harmless) ValueError: Invalid PID #288

Closed
emlun opened this issue Dec 2, 2019 · 0 comments · Fixed by #289
Closed

YubiHSM causes (harmless) ValueError: Invalid PID #288

emlun opened this issue Dec 2, 2019 · 0 comments · Fixed by #289
Assignees
Labels

Comments

@emlun
Copy link
Member

emlun commented Dec 2, 2019

  • YubiKey Manager (ykman) version: master
  • How was it installed?: built from source
  • Operating system and version: linux
  • YubiKey model and version: any
  • Bug description summary: YubiHSM causes (harmless) ValueError: <x> is not a valid PID while plugged in

Steps to reproduce

  1. Plug in any YubiKey
  2. Plug in a YubiHSM or YubiHSM 2
  3. Run any ykman command

Expected result

Nothing remarkable happens.

Actual results and logs

With a YubiHSM 2 (1050:0030) plugged in, ykman logs ValueError: 48 is not a valid PID on every poll of the device:

$ lsusb -d 1050:
Bus 001 Device 021: ID 1050:0030 Yubico.com YubiKey OTP+FIDO+CCID
Bus 001 Device 022: ID 1050:0407 Yubico.com Yubikey 4 OTP+U2F+CCID

 $ ykman --log-level DEBUG info
2019-12-02T14:48:40+0100 INFO [ykman.logging_setup.setup:58] Initialized logging for ykman version: 3.1.0
2019-12-02T14:48:40+0100 DEBUG [ykman.descriptor._gen_descriptors:143] Invalid PID
ValueError: 48 is not a valid PID

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/emlun/dev/yubikey-manager/ykman/descriptor.py", line 141, in _gen_descriptors
    yield Descriptor.from_usb(dev, backend)
  File "/home/emlun/dev/yubikey-manager/ykman/descriptor.py", line 122, in from_usb
    pid = PID(usb_dev.idProduct)
  File "/usr/lib/python3.8/enum.py", line 304, in __call__
    return cls.__new__(cls, value)
  File "/usr/lib/python3.8/enum.py", line 595, in __new__
    raise exc
  File "/usr/lib/python3.8/enum.py", line 579, in __new__
    result = cls._missing_(value)
  File "/usr/lib/python3.8/enum.py", line 608, in _missing_
    raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 48 is not a valid PID
2019-12-02T14:48:40+0100 DEBUG [ykman.descriptor.Descriptor.open_device:86] transports: 0x7, self.mode.transports: 0x7
2019-12-02T14:48:40+0100 DEBUG [ykman.descriptor.open_device:91] Opening driver for serial: None, type: YUBIKEY.YK4, mode: OTP+FIDO+CCID
2019-12-02T14:48:40+0100 DEBUG [ykman.descriptor.open_device:94] Attempt 1 of 10
2019-12-02T14:48:40+0100 DEBUG [ykman.descriptor.open_device:97] Found driver: <ykman.driver_ccid.CCIDDriver object at 0x7fede8210fa0>, key_type: YUBIKEY.YK4, mode: OTP+FIDO+CCID
2019-12-02T14:48:40+0100 DEBUG [ykman.device.__init__:198] Read config from device...
2019-12-02T14:48:40+0100 DEBUG [ykman.driver_ccid.send_apdu:228] SEND: b'00a4040008a000000527471117'
2019-12-02T14:48:40+0100 DEBUG [ykman.driver_ccid.send_apdu:230] RECV: b'5669727475616c206d6772202d2046572076657273696f6e20352e312e309000'
2019-12-02T14:48:40+0100 DEBUG [ykman.driver_ccid.send_apdu:228] SEND: b'001d000000'
2019-12-02T14:48:40+0100 DEBUG [ykman.driver_ccid.send_apdu:230] RECV: b'230102023f0302023f020400844f9804010205030501000602000007010f0801000a01009000'
2019-12-02T14:48:40+0100 DEBUG [ykman.device.__init__:200] Success!
2019-12-02T14:48:40+0100 DEBUG [ykman.device.__init__:289] Identified YubiKey 5
Device type: YubiKey 5 Nano
Serial number: 8671128
Firmware version: 5.1.0
Form factor: Nano (USB-A)
Enabled USB interfaces: OTP+FIDO+CCID

Applications
OTP             Enabled
FIDO U2F        Enabled
OpenPGP         Enabled
PIV             Enabled
OATH            Enabled
FIDO2           Enabled
2019-12-02T14:48:40+0100 DEBUG [ykman.driver_ccid.close:269] Close <ykman.driver_ccid.CCIDDriver object at 0x7fede8210fa0>
2019-12-02T14:48:40+0100 DEBUG [ykman.driver_ccid.__del__:273] Destroy <ykman.driver_ccid.CCIDDriver object at 0x7fede8210fa0>
2019-12-02T14:48:40+0100 DEBUG [ykman.driver_ccid.close:269] Close <ykman.driver_ccid.CCIDDriver object at 0x7fede8210fa0>

The same happens with a YubiHSM 1 (1050:0018), except it says 24 is not a valid PID instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant