From 8fd3ad37519db2bc8b4744bb3b0080ae43623c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Gallou=C3=ABt?= Date: Mon, 8 Jun 2020 20:10:37 +0000 Subject: [PATCH] Check passphrase for deterministic secrets too MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Adrien Gallouët --- secret.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/secret.c b/secret.c index c6e7d9d..523ab2c 100644 --- a/secret.c +++ b/secret.c @@ -311,7 +311,7 @@ s_get_secret(int fd, const char *key, int create) char check[sizeof(s.x.key)]; s_ask_pass(check, sizeof(check), - "It's the first time you use this passphrase.\n" + "No secrets stored with this passphrase.\n" "Please, retype it to confirm: "); if (!hydro_equal(s.x.key, check, sizeof(check))) @@ -473,7 +473,9 @@ s_pass(int argc, char **argv, void *data) printf("Usage: %s KEY [SUBKEY...]\n", argv[0]); return 0; } - close(s_open_secret(1, O_RDONLY)); + int fd = s_open_secret(1, O_RDONLY); + s_get_secret(fd, NULL, 0); + close(fd); uint8_t buf[hydro_pwhash_MASTERKEYBYTES]; uint8_t key[hydro_pwhash_MASTERKEYBYTES];