summaryrefslogtreecommitdiffhomepage
path: root/dropbearkey.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2007-08-08 15:57:50 +0000
committerMatt Johnston <matt@ucc.asn.au>2007-08-08 15:57:50 +0000
commit58296a95f1c8d987a4b6834aa5998a2ba1d3f1c5 (patch)
treef81c77168d6e8e9bddaac2c41fd22692ab3126eb /dropbearkey.c
parentddb61adcc9ab2240362c80832b1fe30dc6a713c0 (diff)
Make dropbearkey only generate 1024 bit keys
--HG-- extra : convert_revision : 8a7db1e2fdc5636abb338adb636babc32f465739
Diffstat (limited to 'dropbearkey.c')
-rw-r--r--dropbearkey.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/dropbearkey.c b/dropbearkey.c
index 2433381..aff809f 100644
--- a/dropbearkey.c
+++ b/dropbearkey.c
@@ -75,6 +75,7 @@ static void printhelp(char * progname) {
#endif
"-f filename Use filename for the secret key\n"
"-s bits Key size in bits, should be a multiple of 8 (optional)\n"
+ " (DSS has a fixed size of 1024 bits)\n"
"-y Just print the publickey and fingerprint for the\n private key in <filename>.\n"
#ifdef DEBUG_TRACE
"-v verbose\n"
@@ -187,8 +188,11 @@ int main(int argc, char ** argv) {
fprintf(stderr, "Bits must be an integer\n");
exit(EXIT_FAILURE);
}
-
- if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
+
+ if (keytype == DROPBEAR_SIGNKEY_DSS && bits != 1024) {
+ fprintf(stderr, "DSS keys have a fixed size of 1024 bits\n");
+ exit(EXIT_FAILURE);
+ } else if (bits < 512 || bits > 4096 || (bits % 8 != 0)) {
fprintf(stderr, "Bits must satisfy 512 <= bits <= 4096, and be a"
" multiple of 8\n");
exit(EXIT_FAILURE);