summaryrefslogtreecommitdiff
path: root/sbin/bioctl/bioctl.c
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2009-10-25 17:53:08 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2009-10-25 17:53:08 +0000
commit89787b6dfd14b16e880e31870261e9568398b29e (patch)
tree895e4a2071e7a8f7bf0de16e2397853a2838cce6 /sbin/bioctl/bioctl.c
parent99a4c043cddaad739fc41c40a236240038f2c4b5 (diff)
Somehow during my testing I missed a test case where an existing crypto
volume could no longer be brought up. Found by Pedro la Peu <pedro@am-gen.org>, thanks for the report.
Diffstat (limited to 'sbin/bioctl/bioctl.c')
-rw-r--r--sbin/bioctl/bioctl.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c
index 509b9fbdfda..d7a2ffc86c5 100644
--- a/sbin/bioctl/bioctl.c
+++ b/sbin/bioctl/bioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bioctl.c,v 1.83 2009/10/22 15:27:15 jmc Exp $ */
+/* $OpenBSD: bioctl.c,v 1.84 2009/10/25 17:53:07 marco Exp $ */
/*
* Copyright (c) 2004, 2005 Marco Peereboom
@@ -951,7 +951,10 @@ derive_key_pkcs(int rounds, u_int8_t *key, size_t keysz, u_int8_t *salt,
errx(1, "Too less rounds: %d", rounds);
/* get passphrase */
- if (password && verify == 0) {
+ if (password && verify)
+ errx(1, "can't specify passphrase file during initial "
+ "creation of crypto volume");
+ if (password) {
if ((f = fopen(password, "r")) == NULL)
err(1, "invalid passphrase file");
@@ -971,13 +974,11 @@ derive_key_pkcs(int rounds, u_int8_t *key, size_t keysz, u_int8_t *salt,
errx(1, "invalid passphrase length");
fclose(f);
- } else if (password == NULL && verify) {
+ } else {
if (readpassphrase("Passphrase: ", passphrase,
sizeof(passphrase), RPP_REQUIRE_TTY) == NULL)
errx(1, "unable to read passphrase");
- } else
- errx(1, "can't specify passphrase file during initial "
- "creation of crypto volume");
+ }
if (verify) {
/* request user to re-type it */