summaryrefslogtreecommitdiffstats
path: root/apps/genrsa.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2009-04-06 21:42:37 +0000
committerDr. Stephen Henson <steve@openssl.org>2009-04-06 21:42:37 +0000
commit645532b999032e146e6995a6c8121927a37c9e6a (patch)
tree4b336e7c13cc1f2289b140ac1d091776bd64c117 /apps/genrsa.c
parent220bd84911bd25518259f68568fd724309d71e62 (diff)
Update from 1.0.0-stable
Diffstat (limited to 'apps/genrsa.c')
-rw-r--r--apps/genrsa.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/apps/genrsa.c b/apps/genrsa.c
index 1599bb7a69..a9f40e8adf 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -105,9 +105,9 @@ int MAIN(int argc, char **argv)
char *inrand=NULL;
BIO *out=NULL;
BIGNUM *bn = BN_new();
- RSA *rsa = RSA_new();
+ RSA *rsa = NULL;
- if(!bn || !rsa) goto err;
+ if(!bn) goto err;
apps_startup();
BN_GENCB_set(&cb, genrsa_cb, bio_err);
@@ -266,6 +266,10 @@ bad:
BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
num);
+ rsa = RSA_new();
+ if (!rsa)
+ goto err;
+
if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
goto err;