mirror of https://github.com/skeeto/enchive.git
In prompts be explicit about which passphrase it is (#5)
parent
836b8cd29f
commit
3b1127a644
|
@ -930,15 +930,15 @@ write_seckey(char *file, const u8 *seckey, int iexp)
|
||||||
/* Prompt for a passphrase. */
|
/* Prompt for a passphrase. */
|
||||||
char pass[2][ENCHIVE_PASSPHRASE_MAX];
|
char pass[2][ENCHIVE_PASSPHRASE_MAX];
|
||||||
get_passphrase(pass[0], sizeof(pass[0]),
|
get_passphrase(pass[0], sizeof(pass[0]),
|
||||||
"passphrase (empty for none): ");
|
"protection passphrase (empty for none): ");
|
||||||
if (!pass[0][0]) {
|
if (!pass[0][0]) {
|
||||||
/* Nevermind. */
|
/* Nevermind. */
|
||||||
iexp = 0;
|
iexp = 0;
|
||||||
} else {
|
} else {
|
||||||
get_passphrase(pass[1], sizeof(pass[0]),
|
get_passphrase(pass[1], sizeof(pass[0]),
|
||||||
"passphrase (repeat): ");
|
"protection passphrase (repeat): ");
|
||||||
if (strcmp(pass[0], pass[1]) != 0)
|
if (strcmp(pass[0], pass[1]) != 0)
|
||||||
fatal("passphrases don't match");
|
fatal("protection passphrases don't match");
|
||||||
|
|
||||||
/* Generate an IV to double as salt. */
|
/* Generate an IV to double as salt. */
|
||||||
secure_entropy(buf_iv, 8);
|
secure_entropy(buf_iv, 8);
|
||||||
|
@ -1244,7 +1244,7 @@ command_keygen(struct optparse *options)
|
||||||
get_passphrase(pass[1], sizeof(pass[0]),
|
get_passphrase(pass[1], sizeof(pass[0]),
|
||||||
"secret key passphrase (repeat): ");
|
"secret key passphrase (repeat): ");
|
||||||
if (strcmp(pass[0], pass[1]) != 0)
|
if (strcmp(pass[0], pass[1]) != 0)
|
||||||
fatal("passphrases don't match");
|
fatal("secret key passphrases don't match");
|
||||||
key_derive(pass[0], secret, seckey_derive_iterations, 0);
|
key_derive(pass[0], secret, seckey_derive_iterations, 0);
|
||||||
secret[0] &= 248;
|
secret[0] &= 248;
|
||||||
secret[31] &= 127;
|
secret[31] &= 127;
|
||||||
|
|
Loading…
Reference in New Issue