summaryrefslogtreecommitdiffstats
path: root/usr.bin/ssh/ssh-keygen.c
diff options
context:
space:
mode:
authormarkus <markus@openbsd.org>2001-06-24 05:35:33 +0000
committermarkus <markus@openbsd.org>2001-06-24 05:35:33 +0000
commit22548184de4fe7218da9dbb22f9dd176affdf96b (patch)
treeebbc18e3f9d00258ea05641435c5536e5a827b42 /usr.bin/ssh/ssh-keygen.c
parentmove ip+hostname check to match.c (diff)
downloadwireguard-openbsd-22548184de4fe7218da9dbb22f9dd176affdf96b.tar.xz
wireguard-openbsd-22548184de4fe7218da9dbb22f9dd176affdf96b.zip
switch to readpassphrase(3)
2.7/8-stable needs readpassphrase.[ch] from libc
Diffstat (limited to 'usr.bin/ssh/ssh-keygen.c')
-rw-r--r--usr.bin/ssh/ssh-keygen.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/usr.bin/ssh/ssh-keygen.c b/usr.bin/ssh/ssh-keygen.c
index b407dbe12e4..710b6775cde 100644
--- a/usr.bin/ssh/ssh-keygen.c
+++ b/usr.bin/ssh/ssh-keygen.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.64 2001/06/23 17:05:22 markus Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.65 2001/06/24 05:35:33 markus Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -119,7 +119,8 @@ load_identity(char *filename)
if (identity_passphrase)
pass = xstrdup(identity_passphrase);
else
- pass = read_passphrase("Enter passphrase: ", 1);
+ pass = read_passphrase("Enter passphrase: ",
+ RP_ALLOW_STDIN);
prv = key_load_private(filename, pass, NULL);
memset(pass, 0, strlen(pass));
xfree(pass);
@@ -487,8 +488,11 @@ do_change_passphrase(struct passwd *pw)
if (identity_passphrase)
old_passphrase = xstrdup(identity_passphrase);
else
- old_passphrase = read_passphrase("Enter old passphrase: ", 1);
- private = key_load_private(identity_file, old_passphrase , &comment);
+ old_passphrase =
+ read_passphrase("Enter old passphrase: ",
+ RP_ALLOW_STDIN);
+ private = key_load_private(identity_file, old_passphrase,
+ &comment);
memset(old_passphrase, 0, strlen(old_passphrase));
xfree(old_passphrase);
if (private == NULL) {
@@ -504,8 +508,10 @@ do_change_passphrase(struct passwd *pw)
passphrase2 = NULL;
} else {
passphrase1 =
- read_passphrase("Enter new passphrase (empty for no passphrase): ", 1);
- passphrase2 = read_passphrase("Enter same passphrase again: ", 1);
+ read_passphrase("Enter new passphrase (empty for no "
+ "passphrase): ", RP_ALLOW_STDIN);
+ passphrase2 = read_passphrase("Enter same passphrase again: ",
+ RP_ALLOW_STDIN);
/* Verify that they are the same. */
if (strcmp(passphrase1, passphrase2) != 0) {
@@ -566,7 +572,8 @@ do_change_comment(struct passwd *pw)
else if (identity_new_passphrase)
passphrase = xstrdup(identity_new_passphrase);
else
- passphrase = read_passphrase("Enter passphrase: ", 1);
+ passphrase = read_passphrase("Enter passphrase: ",
+ RP_ALLOW_STDIN);
/* Try to load using the passphrase. */
private = key_load_private(identity_file, passphrase, &comment);
if (private == NULL) {
@@ -822,10 +829,15 @@ main(int ac, char **av)
else {
passphrase_again:
passphrase1 =
- read_passphrase("Enter passphrase (empty for no passphrase): ", 1);
- passphrase2 = read_passphrase("Enter same passphrase again: ", 1);
+ read_passphrase("Enter passphrase (empty for no "
+ "passphrase): ", RP_ALLOW_STDIN);
+ passphrase2 = read_passphrase("Enter same passphrase again: ",
+ RP_ALLOW_STDIN);
if (strcmp(passphrase1, passphrase2) != 0) {
- /* The passphrases do not match. Clear them and retry. */
+ /*
+ * The passphrases do not match. Clear them and
+ * retry.
+ */
memset(passphrase1, 0, strlen(passphrase1));
memset(passphrase2, 0, strlen(passphrase2));
xfree(passphrase1);