From: kn Date: Sat, 7 Oct 2023 12:20:10 +0000 (+0000) Subject: Retry on empty passphrase X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1302b329055d055ef6e561a837a38be1a8bdef02;p=openbsd 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 --- diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index d84a701fdd6..2e25d5801d9 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -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) {