summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--authfile.c6
-rw-r--r--ssh-add.c13
-rw-r--r--ssherr.c4
-rw-r--r--sshkey.c20
-rw-r--r--sshkey.h5
5 files changed, 20 insertions, 28 deletions
diff --git a/authfile.c b/authfile.c
index 58f589a47..1907cb1cc 100644
--- a/authfile.c
+++ b/authfile.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: authfile.c,v 1.116 2015/07/09 09:49:46 markus Exp $ */ 1/* $OpenBSD: authfile.c,v 1.117 2015/09/13 14:39:16 tim Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2013 Markus Friedl. All rights reserved.
4 * 4 *
@@ -272,8 +272,8 @@ sshkey_load_private(const char *filename, const char *passphrase,
272 goto out; 272 goto out;
273 } 273 }
274 if ((r = sshkey_load_file(fd, buffer)) != 0 || 274 if ((r = sshkey_load_file(fd, buffer)) != 0 ||
275 (r = sshkey_parse_private_fileblob(buffer, passphrase, filename, 275 (r = sshkey_parse_private_fileblob(buffer, passphrase, keyp,
276 keyp, commentp)) != 0) 276 commentp)) != 0)
277 goto out; 277 goto out;
278 r = 0; 278 r = 0;
279 out: 279 out:
diff --git a/ssh-add.c b/ssh-add.c
index c2be36d93..d8d6481f2 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-add.c,v 1.124 2015/09/13 13:48:19 tim Exp $ */ 1/* $OpenBSD: ssh-add.c,v 1.125 2015/09/13 14:39:16 tim Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -218,17 +218,16 @@ add_file(int agent_fd, const char *filename, int key_only)
218 close(fd); 218 close(fd);
219 219
220 /* At first, try empty passphrase */ 220 /* At first, try empty passphrase */
221 if ((r = sshkey_parse_private_fileblob(keyblob, "", filename, 221 if ((r = sshkey_parse_private_fileblob(keyblob, "", &private,
222 &private, &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) { 222 &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
223 fprintf(stderr, "Error loading key \"%s\": %s\n", 223 fprintf(stderr, "Error loading key \"%s\": %s\n",
224 filename, ssh_err(r)); 224 filename, ssh_err(r));
225 goto fail_load; 225 goto fail_load;
226 } 226 }
227 /* try last */ 227 /* try last */
228 if (private == NULL && pass != NULL) { 228 if (private == NULL && pass != NULL) {
229 if ((r = sshkey_parse_private_fileblob(keyblob, pass, filename, 229 if ((r = sshkey_parse_private_fileblob(keyblob, pass, &private,
230 &private, &comment)) != 0 && 230 &comment)) != 0 && r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
231 r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
232 fprintf(stderr, "Error loading key \"%s\": %s\n", 231 fprintf(stderr, "Error loading key \"%s\": %s\n",
233 filename, ssh_err(r)); 232 filename, ssh_err(r));
234 goto fail_load; 233 goto fail_load;
@@ -244,7 +243,7 @@ add_file(int agent_fd, const char *filename, int key_only)
244 if (strcmp(pass, "") == 0) 243 if (strcmp(pass, "") == 0)
245 goto fail_load; 244 goto fail_load;
246 if ((r = sshkey_parse_private_fileblob(keyblob, pass, 245 if ((r = sshkey_parse_private_fileblob(keyblob, pass,
247 filename, &private, &comment)) == 0) 246 &private, &comment)) == 0)
248 break; 247 break;
249 else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) { 248 else if (r != SSH_ERR_KEY_WRONG_PASSPHRASE) {
250 fprintf(stderr, 249 fprintf(stderr,
diff --git a/ssherr.c b/ssherr.c
index 4ca793992..680207063 100644
--- a/ssherr.c
+++ b/ssherr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssherr.c,v 1.4 2015/02/16 22:13:32 djm Exp $ */ 1/* $OpenBSD: ssherr.c,v 1.5 2015/09/13 14:39:16 tim Exp $ */
2/* 2/*
3 * Copyright (c) 2011 Damien Miller 3 * Copyright (c) 2011 Damien Miller
4 * 4 *
@@ -104,7 +104,7 @@ ssh_err(int n)
104 case SSH_ERR_NEED_REKEY: 104 case SSH_ERR_NEED_REKEY:
105 return "rekeying not supported by peer"; 105 return "rekeying not supported by peer";
106 case SSH_ERR_PASSPHRASE_TOO_SHORT: 106 case SSH_ERR_PASSPHRASE_TOO_SHORT:
107 return "passphrase is too short (minimum four characters)"; 107 return "passphrase is too short (minimum five characters)";
108 case SSH_ERR_FILE_CHANGED: 108 case SSH_ERR_FILE_CHANGED:
109 return "file changed while reading"; 109 return "file changed while reading";
110 case SSH_ERR_KEY_UNKNOWN_CIPHER: 110 case SSH_ERR_KEY_UNKNOWN_CIPHER:
diff --git a/sshkey.c b/sshkey.c
index 1f714c37f..3dd8907b0 100644
--- a/sshkey.c
+++ b/sshkey.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.c,v 1.22 2015/09/02 07:51:12 jsg Exp $ */ 1/* $OpenBSD: sshkey.c,v 1.23 2015/09/13 14:39:16 tim Exp $ */
2/* 2/*
3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 3 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved. 4 * Copyright (c) 2008 Alexander von Gernler. All rights reserved.
@@ -3833,8 +3833,6 @@ int
3833sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type, 3833sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
3834 const char *passphrase, struct sshkey **keyp, char **commentp) 3834 const char *passphrase, struct sshkey **keyp, char **commentp)
3835{ 3835{
3836 int r;
3837
3838 *keyp = NULL; 3836 *keyp = NULL;
3839 if (commentp != NULL) 3837 if (commentp != NULL)
3840 *commentp = NULL; 3838 *commentp = NULL;
@@ -3856,8 +3854,8 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
3856 return sshkey_parse_private2(blob, type, passphrase, 3854 return sshkey_parse_private2(blob, type, passphrase,
3857 keyp, commentp); 3855 keyp, commentp);
3858 case KEY_UNSPEC: 3856 case KEY_UNSPEC:
3859 if ((r = sshkey_parse_private2(blob, type, passphrase, keyp, 3857 if (sshkey_parse_private2(blob, type, passphrase, keyp,
3860 commentp)) == 0) 3858 commentp) == 0)
3861 return 0; 3859 return 0;
3862#ifdef WITH_OPENSSL 3860#ifdef WITH_OPENSSL
3863 return sshkey_parse_private_pem_fileblob(blob, type, 3861 return sshkey_parse_private_pem_fileblob(blob, type,
@@ -3872,10 +3870,8 @@ sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
3872 3870
3873int 3871int
3874sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase, 3872sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase,
3875 const char *filename, struct sshkey **keyp, char **commentp) 3873 struct sshkey **keyp, char **commentp)
3876{ 3874{
3877 int r;
3878
3879 if (keyp != NULL) 3875 if (keyp != NULL)
3880 *keyp = NULL; 3876 *keyp = NULL;
3881 if (commentp != NULL) 3877 if (commentp != NULL)
@@ -3883,13 +3879,11 @@ sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase,
3883 3879
3884#ifdef WITH_SSH1 3880#ifdef WITH_SSH1
3885 /* it's a SSH v1 key if the public key part is readable */ 3881 /* it's a SSH v1 key if the public key part is readable */
3886 if ((r = sshkey_parse_public_rsa1_fileblob(buffer, NULL, NULL)) == 0) { 3882 if (sshkey_parse_public_rsa1_fileblob(buffer, NULL, NULL) == 0) {
3887 return sshkey_parse_private_fileblob_type(buffer, KEY_RSA1, 3883 return sshkey_parse_private_fileblob_type(buffer, KEY_RSA1,
3888 passphrase, keyp, commentp); 3884 passphrase, keyp, commentp);
3889 } 3885 }
3890#endif /* WITH_SSH1 */ 3886#endif /* WITH_SSH1 */
3891 if ((r = sshkey_parse_private_fileblob_type(buffer, KEY_UNSPEC, 3887 return sshkey_parse_private_fileblob_type(buffer, KEY_UNSPEC,
3892 passphrase, keyp, commentp)) == 0) 3888 passphrase, keyp, commentp);
3893 return 0;
3894 return r;
3895} 3889}
diff --git a/sshkey.h b/sshkey.h
index c8d3cddca..99f1b25d5 100644
--- a/sshkey.h
+++ b/sshkey.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: sshkey.h,v 1.9 2015/08/04 05:23:06 djm Exp $ */ 1/* $OpenBSD: sshkey.h,v 1.10 2015/09/13 14:39:16 tim Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. 4 * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -186,8 +186,7 @@ int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob,
186int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob, 186int sshkey_parse_public_rsa1_fileblob(struct sshbuf *blob,
187 struct sshkey **keyp, char **commentp); 187 struct sshkey **keyp, char **commentp);
188int sshkey_parse_private_fileblob(struct sshbuf *buffer, 188int sshkey_parse_private_fileblob(struct sshbuf *buffer,
189 const char *passphrase, const char *filename, struct sshkey **keyp, 189 const char *passphrase, struct sshkey **keyp, char **commentp);
190 char **commentp);
191int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type, 190int sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type,
192 const char *passphrase, struct sshkey **keyp, char **commentp); 191 const char *passphrase, struct sshkey **keyp, char **commentp);
193 192