X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=2f7fe6b06fdd7a7f1a37037ef7272fbed89dbd66;hb=35437a50e2a46861742b6fb8e49d065aa52a04dc;hp=4864fab3da5550ae35cd66d17998a248d57886c4;hpb=66f325f4674e70d83744626f3b8dda6760f8d613;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 4864fab3..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))) {