diff options
author | djm@openbsd.org <djm@openbsd.org> | 2015-01-08 10:14:08 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-01-09 00:17:12 +1100 |
commit | 1195f4cb07ef4b0405c839293c38600b3e9bdb46 (patch) | |
tree | bee2cbc3442638bf18a2905608787a0c62b8994b /key.c | |
parent | febbe09e4e9aff579b0c5cc1623f756862e4757d (diff) |
upstream commit
deprecate key_load_private_pem() and
sshkey_load_private_pem() interfaces. Refactor the generic key loading API to
not require pathnames to be specified (they weren't really used).
Fixes a few other things en passant:
Makes ed25519 keys work for hostbased authentication (ssh-keysign
previously used the PEM-only routines).
Fixes key comment regression bz#2306: key pathnames were being lost as
comment fields.
ok markus@
Diffstat (limited to 'key.c')
-rw-r--r-- | key.c | 25 |
1 files changed, 2 insertions, 23 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: key.c,v 1.124 2014/12/21 22:27:56 djm Exp $ */ | 1 | /* $OpenBSD: key.c,v 1.125 2015/01/08 10:14:08 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * placed in the public domain | 3 | * placed in the public domain |
4 | */ | 4 | */ |
@@ -328,7 +328,7 @@ key_load_file(int fd, const char *filename, struct sshbuf *blob) | |||
328 | { | 328 | { |
329 | int r; | 329 | int r; |
330 | 330 | ||
331 | if ((r = sshkey_load_file(fd, filename, blob)) != 0) { | 331 | if ((r = sshkey_load_file(fd, blob)) != 0) { |
332 | fatal_on_fatal_errors(r, __func__, SSH_ERR_LIBCRYPTO_ERROR); | 332 | fatal_on_fatal_errors(r, __func__, SSH_ERR_LIBCRYPTO_ERROR); |
333 | error("%s: %s", __func__, ssh_err(r)); | 333 | error("%s: %s", __func__, ssh_err(r)); |
334 | return 0; | 334 | return 0; |
@@ -435,27 +435,6 @@ key_load_private_type(int type, const char *filename, const char *passphrase, | |||
435 | return ret; | 435 | return ret; |
436 | } | 436 | } |
437 | 437 | ||
438 | #ifdef WITH_OPENSSL | ||
439 | Key * | ||
440 | key_load_private_pem(int fd, int type, const char *passphrase, | ||
441 | char **commentp) | ||
442 | { | ||
443 | int r; | ||
444 | Key *ret = NULL; | ||
445 | |||
446 | if ((r = sshkey_load_private_pem(fd, type, passphrase, | ||
447 | &ret, commentp)) != 0) { | ||
448 | fatal_on_fatal_errors(r, __func__, SSH_ERR_LIBCRYPTO_ERROR); | ||
449 | if (r == SSH_ERR_KEY_WRONG_PASSPHRASE) | ||
450 | debug("%s: %s", __func__, ssh_err(r)); | ||
451 | else | ||
452 | error("%s: %s", __func__, ssh_err(r)); | ||
453 | return NULL; | ||
454 | } | ||
455 | return ret; | ||
456 | } | ||
457 | #endif /* WITH_OPENSSL */ | ||
458 | |||
459 | int | 438 | int |
460 | key_perm_ok(int fd, const char *filename) | 439 | key_perm_ok(int fd, const char *filename) |
461 | { | 440 | { |