1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-04 23:35:36 -08:00

Retry on empty passphrase

They must not be empty, or else creation/unlock fails (and boot loaders
would not be able to abort and drop back to the boot> prompt).

[-p passfile] handles this with "invalid passphrase length", so align
the interactive prompt and retry there.

-s remains a one-shot whilst getting a better error message.

This is user friendlier and fixes the last installer "bug" on my list
wrt. disk encryption where hitting Enter twice at the passphrase prompt
would abort bioctl(8) and thus the installation.

OK deraadt
This commit is contained in:
kn 2023-10-07 12:20:10 +00:00
parent 09b34e9cf9
commit 1302b32905

View File

@ -1,4 +1,4 @@
/* $OpenBSD: bioctl.c,v 1.156 2023/10/06 09:55:02 kn Exp $ */
/* $OpenBSD: bioctl.c,v 1.157 2023/10/07 12:20:10 kn Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
@ -1361,6 +1361,12 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz,
if (readpassphrase(prompt, passphrase, sizeof(passphrase),
rpp_flag) == NULL)
err(1, "unable to read passphrase");
if (*passphrase == '\0') {
warnx("invalid passphrase length");
if (interactive)
goto retry;
exit(1);
}
}
if (verify && !passfile) {