summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2005-01-04 13:07:27 +0000
committerColin Watson <cjwatson@debian.org>2005-01-04 13:07:27 +0000
commitfd0f611b70a83d80fe8793af785542ee5541b7cd (patch)
treebededd22bb7eeec52e20083237ab7e4113445a16 /ssh-keygen.c
parentc44fe9a5b9d3db96a7249b04d915f17e4a3a3b04 (diff)
parentebd2ce335af5861020c79fddb1ae35c03bf036cf (diff)
Merge 3.9p1 to the trunk.
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 1156a010a..d39e7d881 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: ssh-keygen.c,v 1.113 2003/12/22 09:16:58 djm Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.117 2004/07/11 17:48:47 deraadt Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -26,8 +26,7 @@ RCSID("$OpenBSD: ssh-keygen.c,v 1.113 2003/12/22 09:16:58 djm Exp $");
26#include "bufaux.h" 26#include "bufaux.h"
27#include "pathnames.h" 27#include "pathnames.h"
28#include "log.h" 28#include "log.h"
29#include "readpass.h" 29#include "misc.h"
30#include "moduli.h"
31 30
32#ifdef SMARTCARD 31#ifdef SMARTCARD
33#include "scard.h" 32#include "scard.h"
@@ -77,14 +76,14 @@ int print_generic = 0;
77char *key_type_name = NULL; 76char *key_type_name = NULL;
78 77
79/* argv0 */ 78/* argv0 */
80#ifdef HAVE___PROGNAME
81extern char *__progname; 79extern char *__progname;
82#else
83char *__progname;
84#endif
85 80
86char hostname[MAXHOSTNAMELEN]; 81char hostname[MAXHOSTNAMELEN];
87 82
83/* moduli.c */
84int gen_candidates(FILE *, int, int, BIGNUM *);
85int prime_test(FILE *, FILE *, u_int32_t, u_int32_t);
86
88static void 87static void
89ask_filename(struct passwd *pw, const char *prompt) 88ask_filename(struct passwd *pw, const char *prompt)
90{ 89{
@@ -189,8 +188,8 @@ do_convert_to_ssh2(struct passwd *pw)
189static void 188static void
190buffer_get_bignum_bits(Buffer *b, BIGNUM *value) 189buffer_get_bignum_bits(Buffer *b, BIGNUM *value)
191{ 190{
192 u_int bits = buffer_get_int(b); 191 u_int bignum_bits = buffer_get_int(b);
193 u_int bytes = (bits + 7) / 8; 192 u_int bytes = (bignum_bits + 7) / 8;
194 193
195 if (buffer_len(b) < bytes) 194 if (buffer_len(b) < bytes)
196 fatal("buffer_get_bignum_bits: input buffer too small: " 195 fatal("buffer_get_bignum_bits: input buffer too small: "
@@ -627,7 +626,7 @@ do_change_passphrase(struct passwd *pw)
627 * Print the SSHFP RR. 626 * Print the SSHFP RR.
628 */ 627 */
629static void 628static void
630do_print_resource_record(struct passwd *pw, char *hostname) 629do_print_resource_record(struct passwd *pw, char *hname)
631{ 630{
632 Key *public; 631 Key *public;
633 char *comment = NULL; 632 char *comment = NULL;
@@ -641,7 +640,7 @@ do_print_resource_record(struct passwd *pw, char *hostname)
641 } 640 }
642 public = key_load_public(identity_file, &comment); 641 public = key_load_public(identity_file, &comment);
643 if (public != NULL) { 642 if (public != NULL) {
644 export_dns_rr(hostname, public, stdout, print_generic); 643 export_dns_rr(hname, public, stdout, print_generic);
645 key_free(public); 644 key_free(public);
646 xfree(comment); 645 xfree(comment);
647 exit(0); 646 exit(0);
@@ -896,7 +895,7 @@ main(int ac, char **av)
896 if (log_level == SYSLOG_LEVEL_INFO) 895 if (log_level == SYSLOG_LEVEL_INFO)
897 log_level = SYSLOG_LEVEL_DEBUG1; 896 log_level = SYSLOG_LEVEL_DEBUG1;
898 else { 897 else {
899 if (log_level >= SYSLOG_LEVEL_DEBUG1 && 898 if (log_level >= SYSLOG_LEVEL_DEBUG1 &&
900 log_level < SYSLOG_LEVEL_DEBUG3) 899 log_level < SYSLOG_LEVEL_DEBUG3)
901 log_level++; 900 log_level++;
902 } 901 }
@@ -911,18 +910,9 @@ main(int ac, char **av)
911 break; 910 break;
912 case 'a': 911 case 'a':
913 trials = atoi(optarg); 912 trials = atoi(optarg);
914 if (trials < TRIAL_MINIMUM) {
915 fatal("Minimum primality trials is %d",
916 TRIAL_MINIMUM);
917 }
918 break; 913 break;
919 case 'M': 914 case 'M':
920 memory = atoi(optarg); 915 memory = atoi(optarg);
921 if (memory != 0 &&
922 (memory < LARGE_MINIMUM || memory > LARGE_MAXIMUM)) {
923 fatal("Invalid memory amount (min %ld, max %ld)",
924 LARGE_MINIMUM, LARGE_MAXIMUM);
925 }
926 break; 916 break;
927 case 'G': 917 case 'G':
928 do_gen_candidates = 1; 918 do_gen_candidates = 1;