Updates to s_client and s_server to remove the constant 28 (for IPv4 header
[openssl.git] / apps / genrsa.c
index 1599bb7a69d6472bad3bf80cd7ccc78fbbf58dcf..7a8c6c58ad62ba5419ee7b686455a8aead21088c 100644 (file)
@@ -78,7 +78,7 @@
 #include <openssl/pem.h>
 #include <openssl/rand.h>
 
-#define DEFBITS        512
+#define DEFBITS        2048
 #undef PROG
 #define PROG genrsa_main
 
@@ -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);
@@ -265,6 +265,13 @@ bad:
 
        BIO_printf(bio_err,"Generating RSA private key, %d bit long modulus\n",
                num);
+#ifdef OPENSSL_NO_ENGINE
+       rsa = RSA_new();
+#else
+       rsa = RSA_new_method(e);
+#endif
+       if (!rsa)
+               goto err;
 
        if(!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
                goto err;