libres-MacBook:~ libre$ ssh-keygen -b 99999 Bits has bad value 99999 (too large) libres-MacBook:~ libre$ ssh-keygen -b 32768 key bits exceeds maximum 16384 Why are these two error messages in different formats?
(In reply to zaomir from comment #0) > Why are these two error messages in different formats? They're different because they're getting caught be different checks. > libres-MacBook:~ libre$ ssh-keygen -b 99999 > Bits has bad value 99999 (too large) This is the general sanity check in the getopt parsing: bits = (u_int32_t)strtonum(optarg, 10, 32768, &errstr); if (errstr) fatal("Bits has bad value %s (%s)", optarg, errstr); > libres-MacBook:~ libre$ ssh-keygen -b 32768 > key bits exceeds maximum 16384 This one is in the key-specific checks (type_bits_valid()), and these limits are imposed by the build of OpenSSL: maxbits = (type == KEY_DSA) ? OPENSSL_DSA_MAX_MODULUS_BITS : OPENSSL_RSA_MAX_MODULUS_BITS; if (*bitsp > maxbits) fatal("key bits exceeds maximum %d", maxbits);
Created attachment 3308 [details] Defer bit size tests to key-specific check Without change: $ ssh-keygen -b 99999 -t rsa -f /tmp/t Bits has bad value 99999 (too large) With change: $ ssh-keygen/obj/ssh-keygen -b 99999 -t rsa -f /tmp/t Invalid RSA key length: maximum is 16384 bits
This has been fixed (up to the size allowed by the underlying type, anyway): $ ./ssh-keygen -b 99999999 Invalid RSA key length: maximum is 16384 bits If you want RSA keys larger than 16k you'll need to compile OpenSSL with the larger limit then compile OpenSSH against that. It'll probably be an interop hassle, though.
closing resolved bugs as of 8.6p1 release