diff options
author | Joel Sing <jsing@cvs.openbsd.org> | 2016-09-08 19:08:15 +0000 |
---|---|---|
committer | Joel Sing <jsing@cvs.openbsd.org> | 2016-09-08 19:08:15 +0000 |
commit | bc26ebee2b836e87a877b2622ad850af4385403b (patch) | |
tree | 140960a18580cb67db9e660931c321944f2f8902 /sbin/bioctl | |
parent | e3458c599704f3f1a058bf9a26837c7b6851d677 (diff) |
When changing the passphrase, keep the previous number of rounds, unless
specified otherwise.
Part of a diff from halex@
Diffstat (limited to 'sbin/bioctl')
-rw-r--r-- | sbin/bioctl/bioctl.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index 7fc057d0ac6..8a6fe987382 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioctl.c,v 1.133 2016/09/08 18:41:04 jsing Exp $ */ +/* $OpenBSD: bioctl.c,v 1.134 2016/09/08 19:08:14 jsing Exp $ */ /* * Copyright (c) 2004, 2005 Marco Peereboom @@ -87,7 +87,7 @@ int devh = -1; int human; int verbose; u_int32_t cflags = 0; -int rflag = 8192; +int rflag = 0; char *password; void *bio_cookie; @@ -965,7 +965,7 @@ bio_kdf_generate(struct sr_crypto_kdfinfo *kdfinfo) kdfinfo->pbkdf2.len = sizeof(kdfinfo->pbkdf2); kdfinfo->pbkdf2.type = SR_CRYPTOKDFT_PBKDF2; - kdfinfo->pbkdf2.rounds = rflag; + kdfinfo->pbkdf2.rounds = rflag ? rflag : 8192; kdfinfo->flags = SR_CRYPTOKDF_KEY | SR_CRYPTOKDF_HINT; kdfinfo->len = sizeof(*kdfinfo); @@ -1105,6 +1105,10 @@ bio_changepass(char *dev) /* Current passphrase. */ bio_kdf_derive(&kdfinfo1, &kdfhint, "Old passphrase: ", 0); + /* Keep the previous number of rounds, unless specified. */ + if (!rflag) + rflag = kdfhint.rounds; + /* New passphrase. */ bio_kdf_generate(&kdfinfo2); |