diff --git a/cmdgen.c b/cmdgen.c index d8d5a946..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);