aboutsummaryrefslogtreecommitdiff
path: root/apps/genrsa.c
diff options
context:
space:
mode:
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 fdc0d4a07dfe..5759acbf9bbe 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -106,9 +106,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);
@@ -269,6 +269,10 @@ bad:
BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
num);
+ rsa = RSA_new();
+ if (!rsa)
+ goto err;
+
if (use_x931)
{
BIGNUM *pubexp;