summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 802fd25c2..c181b58aa 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-keygen.c,v 1.405 2020/04/03 02:26:56 djm Exp $ */ 1/* $OpenBSD: ssh-keygen.c,v 1.406 2020/04/17 07:16:07 djm Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1994 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -910,22 +910,21 @@ fingerprint_private(const char *path)
910{ 910{
911 struct stat st; 911 struct stat st;
912 char *comment = NULL; 912 char *comment = NULL;
913 struct sshkey *public = NULL; 913 struct sshkey *key = NULL;
914 int r; 914 int r;
915 915
916 if (stat(identity_file, &st) == -1) 916 if (stat(identity_file, &st) == -1)
917 fatal("%s: %s", path, strerror(errno)); 917 fatal("%s: %s", path, strerror(errno));
918 if ((r = sshkey_load_public(path, &public, &comment)) != 0) { 918 if ((r = sshkey_load_private(path, NULL, &key, &comment)) != 0) {
919 debug("load public \"%s\": %s", path, ssh_err(r)); 919 debug("load private \"%s\": %s", path, ssh_err(r));
920 if ((r = sshkey_load_private(path, NULL, 920 if ((r = sshkey_load_public(path, &key, &comment)) != 0) {
921 &public, &comment)) != 0) { 921 debug("load public \"%s\": %s", path, ssh_err(r));
922 debug("load private \"%s\": %s", path, ssh_err(r));
923 fatal("%s is not a key file.", path); 922 fatal("%s is not a key file.", path);
924 } 923 }
925 } 924 }
926 925
927 fingerprint_one_key(public, comment); 926 fingerprint_one_key(key, comment);
928 sshkey_free(public); 927 sshkey_free(key);
929 free(comment); 928 free(comment);
930} 929}
931 930