comparison dropbearkey.c @ 457:e430a26064ee DROPBEAR_0.50

Make dropbearkey only generate 1024 bit keys
author Matt Johnston <matt@ucc.asn.au>
date Wed, 08 Aug 2007 15:57:50 +0000
parents 454a34b2dfd1
children 3aa74a4d83ae 76097ec1a29a
comparison
equal deleted inserted replaced
456:f6c999ba31da 457:e430a26064ee
73 #ifdef DROPBEAR_DSS 73 #ifdef DROPBEAR_DSS
74 " dss\n" 74 " dss\n"
75 #endif 75 #endif
76 "-f filename Use filename for the secret key\n" 76 "-f filename Use filename for the secret key\n"
77 "-s bits Key size in bits, should be a multiple of 8 (optional)\n" 77 "-s bits Key size in bits, should be a multiple of 8 (optional)\n"
78 " (DSS has a fixed size of 1024 bits)\n"
78 "-y Just print the publickey and fingerprint for the\n private key in <filename>.\n" 79 "-y Just print the publickey and fingerprint for the\n private key in <filename>.\n"
79 #ifdef DEBUG_TRACE 80 #ifdef DEBUG_TRACE
80 "-v verbose\n" 81 "-v verbose\n"
81 #endif 82 #endif
82 ,progname); 83 ,progname);
185 if (sizetext) { 186 if (sizetext) {
186 if (sscanf(sizetext, "%u", &bits) != 1) { 187 if (sscanf(sizetext, "%u", &bits) != 1) {
187 fprintf(stderr, "Bits must be an integer\n"); 188 fprintf(stderr, "Bits must be an integer\n");
188 exit(EXIT_FAILURE); 189 exit(EXIT_FAILURE);
189 } 190 }
190 191
191 if (bits < 512 || bits > 4096 || (bits % 8 != 0)) { 192 if (keytype == DROPBEAR_SIGNKEY_DSS && bits != 1024) {
193 fprintf(stderr, "DSS keys have a fixed size of 1024 bits\n");
194 exit(EXIT_FAILURE);
195 } else if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
192 fprintf(stderr, "Bits must satisfy 512 <= bits <= 4096, and be a" 196 fprintf(stderr, "Bits must satisfy 512 <= bits <= 4096, and be a"
193 " multiple of 8\n"); 197 " multiple of 8\n");
194 exit(EXIT_FAILURE); 198 exit(EXIT_FAILURE);
195 } 199 }
196 200