X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;ds=sidebyside;f=cmdgen.c;h=265e5adc1ac9e450927100a6da5a7a2bce7333d5;hb=145ecf611238c4f1e39d89d3eee40319a2c54fe8;hp=ac56ab3e58c48f922adc5290b4a8a2a9b9c057b0;hpb=3e40566bb053f8f438e220ede4a1da34cf386592;p=PuTTY.git diff --git a/cmdgen.c b/cmdgen.c index ac56ab3e..265e5adc 100644 --- a/cmdgen.c +++ b/cmdgen.c @@ -223,6 +223,8 @@ static char *readpassphrase(const char *filename) return line; } +#define DEFAULT_RSADSA_BITS 2048 + int main(int argc, char **argv) { char *infile = NULL; @@ -500,7 +502,7 @@ int main(int argc, char **argv) bits = 256; break; default: - bits = 2048; + bits = DEFAULT_RSADSA_BITS; break; } } @@ -515,6 +517,19 @@ int main(int argc, char **argv) errs = TRUE; } + if (keytype == RSA2 || keytype == RSA1 || keytype == DSA) { + if (bits < 256) { + fprintf(stderr, "puttygen: cannot generate %s keys shorter than" + " 256 bits\n", (keytype == DSA ? "DSA" : "RSA")); + errs = TRUE; + } else if (bits < DEFAULT_RSADSA_BITS) { + fprintf(stderr, "puttygen: warning: %s keys shorter than" + " %d bits are probably not secure\n", + (keytype == DSA ? "DSA" : "RSA"), DEFAULT_RSADSA_BITS); + /* but this is just a warning, so proceed anyway */ + } + } + if (errs) return 1;