X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/8a9977e54db756281cf0d9f4a8322ce24b001a61..9916cc1e8d26f1caef36fc1ee525819e6ca62f42:/cmdgen.c diff --git a/cmdgen.c b/cmdgen.c index dfca9dce..9aa585f3 100644 --- a/cmdgen.c +++ b/cmdgen.c @@ -640,6 +640,11 @@ int main(int argc, char **argv) random_ref(); entropy = get_random_data(bits / 8); + if (!entropy) { + fprintf(stderr, "puttygen: failed to collect entropy, " + "could not generate key\n"); + return 1; + } random_add_heavynoise(entropy, bits / 8); memset(entropy, 0, bits/8); sfree(entropy); @@ -893,7 +898,7 @@ int main(int argc, char **argv) assert(ssh1key); if (outfile) - fp = f_open(outfilename, "w"); + fp = f_open(outfilename, "w", FALSE); else fp = stdout; dec1 = bignum_decimal(ssh1key->exponent); @@ -951,7 +956,7 @@ int main(int argc, char **argv) *p++ = '\0'; if (outfile) - fp = f_open(outfilename, "w"); + fp = f_open(outfilename, "w", FALSE); else fp = stdout; fprintf(fp, "%s\n", buffer); @@ -981,7 +986,7 @@ int main(int argc, char **argv) } if (outfile) - fp = f_open(outfilename, "w"); + fp = f_open(outfilename, "w", FALSE); else fp = stdout; fprintf(fp, "%s\n", fingerprint);