arekinath / pivy

Tools for using PIV tokens (like Yubikeys) as an SSH agent, for encrypting data at rest, and more
190 stars 26 forks source link

Nitrokey 3: pivtool change-puk: Segmentation fault #46

Open matthiasbock opened 6 months ago

matthiasbock commented 6 months ago

Hi,

as described in issue #45, I am trying to set-up a Nitrokey 3. This issue looks different than the aforementioned one:

Changing the PIN seems to work...

$ ./pivy-tool change-pin
Enter current PIV PIN (2B671D88): 
Enter new PIV PIN (2B671D88): 
Confirm new PIV PIN (2B671D88): 

...but changing the PUK results in a segmentation fault:

$ ./pivy-tool change-puk
Enter current PUK (2B671D88): 
Enter new PUK (2B671D88): 
pivy-tool: PIN must be 4-8 characters
Enter current PUK (2B671D88): 
Enter new PUK (2B671D88): 
Confirm new PUK (2B671D88): 
Segmentation fault

I tried different numbers of characters, alphanumeric charset, only digits, but the problem persists. Any suggestions?

Cheers, Matthias

jclulow commented 6 months ago

What OS are you running this on? Do you get a core file from the segmentation fault?

matthiasbock commented 6 months ago

I use Debian Linux (bookworm), Linux kernel 5.10.0-19, amd64.

The error message above is the only output I get. How can I create a core file?

jclulow commented 6 months ago

You may not actually need to, you could try running it under the debugger? Maybe something like:

$ gdb ./pivy-tool
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1
...

(gdb) run change-puk
... [presumably it will crash here]

(gdb) backtrace