diff options
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r-- | ssh-keygen.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c index ac20723b8..b8489dc8b 100644 --- a/ssh-keygen.c +++ b/ssh-keygen.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keygen.c,v 1.258 2015/01/19 00:32:54 deraadt Exp $ */ | 1 | /* $OpenBSD: ssh-keygen.c,v 1.259 2015/01/28 22:36:00 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 |
@@ -800,6 +800,8 @@ do_download(struct passwd *pw) | |||
800 | fp = sshkey_fingerprint(keys[i], fptype, rep); | 800 | fp = sshkey_fingerprint(keys[i], fptype, rep); |
801 | ra = sshkey_fingerprint(keys[i], fingerprint_hash, | 801 | ra = sshkey_fingerprint(keys[i], fingerprint_hash, |
802 | SSH_FP_RANDOMART); | 802 | SSH_FP_RANDOMART); |
803 | if (fp == NULL || ra == NULL) | ||
804 | fatal("%s: sshkey_fingerprint fail", __func__); | ||
803 | printf("%u %s %s (PKCS11 key)\n", sshkey_size(keys[i]), | 805 | printf("%u %s %s (PKCS11 key)\n", sshkey_size(keys[i]), |
804 | fp, sshkey_type(keys[i])); | 806 | fp, sshkey_type(keys[i])); |
805 | if (log_level >= SYSLOG_LEVEL_VERBOSE) | 807 | if (log_level >= SYSLOG_LEVEL_VERBOSE) |
@@ -846,6 +848,8 @@ do_fingerprint(struct passwd *pw) | |||
846 | fp = sshkey_fingerprint(public, fptype, rep); | 848 | fp = sshkey_fingerprint(public, fptype, rep); |
847 | ra = sshkey_fingerprint(public, fingerprint_hash, | 849 | ra = sshkey_fingerprint(public, fingerprint_hash, |
848 | SSH_FP_RANDOMART); | 850 | SSH_FP_RANDOMART); |
851 | if (fp == NULL || ra == NULL) | ||
852 | fatal("%s: sshkey_fingerprint fail", __func__); | ||
849 | printf("%u %s %s (%s)\n", sshkey_size(public), fp, comment, | 853 | printf("%u %s %s (%s)\n", sshkey_size(public), fp, comment, |
850 | sshkey_type(public)); | 854 | sshkey_type(public)); |
851 | if (log_level >= SYSLOG_LEVEL_VERBOSE) | 855 | if (log_level >= SYSLOG_LEVEL_VERBOSE) |
@@ -915,6 +919,8 @@ do_fingerprint(struct passwd *pw) | |||
915 | fp = sshkey_fingerprint(public, fptype, rep); | 919 | fp = sshkey_fingerprint(public, fptype, rep); |
916 | ra = sshkey_fingerprint(public, fingerprint_hash, | 920 | ra = sshkey_fingerprint(public, fingerprint_hash, |
917 | SSH_FP_RANDOMART); | 921 | SSH_FP_RANDOMART); |
922 | if (fp == NULL || ra == NULL) | ||
923 | fatal("%s: sshkey_fingerprint fail", __func__); | ||
918 | printf("%u %s %s (%s)\n", sshkey_size(public), fp, | 924 | printf("%u %s %s (%s)\n", sshkey_size(public), fp, |
919 | comment ? comment : "no comment", sshkey_type(public)); | 925 | comment ? comment : "no comment", sshkey_type(public)); |
920 | if (log_level >= SYSLOG_LEVEL_VERBOSE) | 926 | if (log_level >= SYSLOG_LEVEL_VERBOSE) |
@@ -1902,6 +1908,8 @@ do_show_cert(struct passwd *pw) | |||
1902 | key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT); | 1908 | key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT); |
1903 | ca_fp = sshkey_fingerprint(key->cert->signature_key, | 1909 | ca_fp = sshkey_fingerprint(key->cert->signature_key, |
1904 | fingerprint_hash, SSH_FP_DEFAULT); | 1910 | fingerprint_hash, SSH_FP_DEFAULT); |
1911 | if (key_fp == NULL || ca_fp == NULL) | ||
1912 | fatal("%s: sshkey_fingerprint fail", __func__); | ||
1905 | 1913 | ||
1906 | printf("%s:\n", identity_file); | 1914 | printf("%s:\n", identity_file); |
1907 | printf(" Type: %s %s certificate\n", sshkey_ssh_name(key), | 1915 | printf(" Type: %s %s certificate\n", sshkey_ssh_name(key), |
@@ -2216,7 +2224,7 @@ main(int argc, char **argv) | |||
2216 | { | 2224 | { |
2217 | char dotsshdir[PATH_MAX], comment[1024], *passphrase1, *passphrase2; | 2225 | char dotsshdir[PATH_MAX], comment[1024], *passphrase1, *passphrase2; |
2218 | char *checkpoint = NULL; | 2226 | char *checkpoint = NULL; |
2219 | char out_file[PATH_MAX], *rr_hostname = NULL, *ep; | 2227 | char out_file[PATH_MAX], *rr_hostname = NULL, *ep, *fp, *ra; |
2220 | struct sshkey *private, *public; | 2228 | struct sshkey *private, *public; |
2221 | struct passwd *pw; | 2229 | struct passwd *pw; |
2222 | struct stat st; | 2230 | struct stat st; |
@@ -2709,10 +2717,12 @@ passphrase_again: | |||
2709 | fclose(f); | 2717 | fclose(f); |
2710 | 2718 | ||
2711 | if (!quiet) { | 2719 | if (!quiet) { |
2712 | char *fp = sshkey_fingerprint(public, fingerprint_hash, | 2720 | fp = sshkey_fingerprint(public, fingerprint_hash, |
2713 | SSH_FP_DEFAULT); | 2721 | SSH_FP_DEFAULT); |
2714 | char *ra = sshkey_fingerprint(public, fingerprint_hash, | 2722 | ra = sshkey_fingerprint(public, fingerprint_hash, |
2715 | SSH_FP_RANDOMART); | 2723 | SSH_FP_RANDOMART); |
2724 | if (fp == NULL || ra == NULL) | ||
2725 | fatal("sshkey_fingerprint failed"); | ||
2716 | printf("Your public key has been saved in %s.\n", | 2726 | printf("Your public key has been saved in %s.\n", |
2717 | identity_file); | 2727 | identity_file); |
2718 | printf("The key fingerprint is:\n"); | 2728 | printf("The key fingerprint is:\n"); |