X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=2f7fe6b06fdd7a7f1a37037ef7272fbed89dbd66;hb=35437a50e2a46861742b6fb8e49d065aa52a04dc;hp=81e7a7a2cbdbcbd4f94835769379b22a37556413;hpb=f134bd0c9c2213fbbb3967f3d784759cb65e2c76;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 81e7a7a2..2f7fe6b0 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -417,6 +417,15 @@ static bool rsa_keygen(int bits, bool ask) { FILE *f; char *pubname, *privname; + // Make sure the key size is a multiple of 8 bits. + bits &= ~0x7; + + // Force them to be between 1024 and 8192 bits long. + if(bits < 1024) + bits = 1024; + if(bits > 8192) + bits = 8192; + fprintf(stderr, "Generating %d bits keys:\n", bits); if(!(key = rsa_generate(bits, 0x10001))) { @@ -2138,6 +2147,8 @@ static int cmd_network(int argc, char *argv[]) { free(fname); } + closedir(dir); + return 0; }