Antonio Alvarez Feijoo
5cef6b5393
cryptsetup-tokens: fix pin asserts
If a user only presses ENTER when the PIN is requested (without actually typing
the PIN), an assertion is reached and no other unlock method is requested.
```
sh-5.2# systemctl status systemd-cryptsetup@cr_root
× systemd-cryptsetup@cr_root.service - Cryptography Setup for cr_root
Loaded: loaded (/etc/crypttab; generated)
Drop-In: /etc/systemd/system/systemd-cryptsetup@.service.d
└─pcr-signature.conf
Active: failed (Result: core-dump) since Thu 2024-04-25 08:44:30 UTC; 10min ago
Docs: man:crypttab(5)
man:systemd-cryptsetup-generator(8)
man:systemd-cryptsetup@.service(8)
Process: 559 ExecStartPre=/usr/bin/pcr-signature.sh (code=exited, status=0/SUCCESS)
Process: 604 ExecStart=/usr/bin/systemd-cryptsetup attach cr_root /dev/disk/by-uuid/a8cbd937-6975-4e61-9120-ce5c03138700 none x-initrd.attach,tpm2-device=auto (code=dumped, signal=ABRT)
Main PID: 604 (code=dumped, signal=ABRT)
CPU: 19ms
Apr 25 08:44:29 localhost systemd[1]: Starting Cryptography Setup for cr_root...
Apr 25 08:44:30 localhost systemd-cryptsetup[604]: Assertion '!pin || pin_size > 0' failed at src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c:60, function cryptsetup_token_open_pin(). Aborting.
Apr 25 08:44:30 localhost systemd[1]: systemd-cryptsetup@cr_root.service: Main process exited, code=dumped, status=6/ABRT
Apr 25 08:44:30 localhost systemd[1]: systemd-cryptsetup@cr_root.service: Failed with result 'core-dump'.
Apr 25 08:44:30 localhost systemd[1]: Failed to start Cryptography Setup for cr_root.
```
In this case, `cryptsetup_token_open_pin()` receives an empty (non-NULL) `pin`
with `pin_size` equals to 0.
```
🔐 Please enter LUKS2 token PIN:
Breakpoint 3, cryptsetup_token_open_pin (cd=0x5555555744c0, token=0, pin=0x5555555b3cc0 "", pin_size=0, ret_password=0x7fffffffd380,
ret_password_len=0x7fffffffd378, usrptr=0x0) at ../src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c:42
42 void *usrptr /* plugin defined parameter passed to crypt_activate_by_token*() API */) {
(gdb) continue
Assertion '!pin || pin_size > 0' failed at src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-tpm2.c:60, function cryptsetup_token_open_pin(). Aborting.
```
2024-04-25 17:07:11 +02:00
..
2024-04-22 12:40:09 +02:00
2024-04-07 11:15:19 +02:00
2024-04-04 21:29:57 +01:00
2024-04-24 17:33:38 +02:00
2024-04-19 23:59:13 +02:00
2024-03-26 21:08:49 +08:00
2024-04-25 13:40:41 +02:00
2024-04-10 16:54:03 +09:00
2024-04-15 15:53:12 +02:00
2024-04-24 17:32:56 +02:00
2024-04-25 17:07:11 +02:00
2024-04-04 16:17:38 +02:00
2024-04-06 16:08:24 +02:00
2024-03-07 18:47:50 +01:00
2024-03-20 15:18:21 +01:00
2024-04-19 05:58:46 -07:00
2024-04-18 17:39:34 +02:00
2024-03-11 15:34:05 +08:00
2024-04-09 09:40:21 +02:00
2024-04-17 17:03:48 +02:00
2024-03-20 15:13:44 +01:00
2024-04-03 11:50:25 +01:00
2024-04-25 00:56:04 +08:00
2024-04-17 21:50:22 +08:00
2024-04-22 22:38:11 +02:00
2024-04-23 19:36:53 +02:00
2024-04-24 12:22:05 +09:00
2024-04-09 21:19:15 +02:00
2024-03-20 15:13:44 +01:00
2024-04-18 17:39:34 +02:00
2024-04-22 22:37:05 +02:00
2024-04-04 18:16:45 +02:00
2024-04-13 05:44:04 +09:00
2024-04-24 12:26:25 +09:00
2024-04-22 23:00:22 +08:00
2024-04-12 05:55:27 +09:00
2024-03-20 15:18:21 +01:00
2024-04-22 12:40:09 +02:00
2024-04-22 12:40:09 +02:00
2024-04-22 12:40:09 +02:00
2024-04-19 13:25:32 +01:00
2024-03-08 08:25:07 +01:00
2024-03-10 23:11:47 +08:00
2024-04-22 15:16:54 +02:00
2024-04-25 10:58:56 +02:00
2024-04-25 10:58:56 +02:00
2024-04-23 11:04:08 +02:00
2024-04-06 02:16:54 +08:00
2024-04-02 18:08:22 +02:00
2024-04-05 01:49:20 +09:00
2024-04-23 16:15:55 +02:00
2024-04-24 21:31:28 +02:00
2024-04-22 18:40:10 +09:00
2024-04-13 05:44:04 +09:00
2024-04-03 11:50:25 +01:00
2024-03-07 02:01:57 +08:00
2024-04-24 15:17:49 +02:00
2024-04-20 09:15:07 +09:00
2024-04-03 11:50:25 +01:00
2024-04-03 11:50:25 +01:00
2024-04-22 12:40:09 +02:00
2024-04-18 08:25:03 +02:00
2024-04-22 20:38:16 +02:00
2024-04-18 17:39:34 +02:00
2024-04-18 17:39:34 +02:00
2024-04-20 12:10:42 +02:00
2024-04-19 13:25:32 +01:00
2024-03-07 18:49:44 +01:00