The mix of CFLAGS and LDFLAGS is a bit confusing in my opinion, and
[openssl.git] / apps / req.c
index c4594c490c7f07f957588319a48f6536e4779960..d634268653c4c37e969fdad92f7b14eba68bdd08 100644 (file)
@@ -567,13 +567,16 @@ bad:
        else
                {
                req_conf=config;
-               if( verbose )
-                       BIO_printf(bio_err,"Using configuration from %s\n",
-                       default_config_file);
+
                if (req_conf == NULL)
                        {
-                       BIO_printf(bio_err,"Unable to load config info\n");
+                       BIO_printf(bio_err,"Unable to load config info from %s\n", default_config_file);
+                       if (newreq)
+                               goto end;
                        }
+               else if( verbose )
+                       BIO_printf(bio_err,"Using configuration from %s\n",
+                       default_config_file);
                }
 
        if (req_conf != NULL)
@@ -748,12 +751,16 @@ bad:
                if (pkey_type == TYPE_RSA)
                        {
                        RSA *rsa = RSA_new();
-                       if(!rsa || !RSA_generate_key_ex(rsa, newkey, 0x10001, &cb) ||
+                       BIGNUM *bn = BN_new();
+                       if(!bn || !rsa || !BN_set_word(bn, 0x10001) ||
+                                       !RSA_generate_key_ex(rsa, newkey, bn, &cb) ||
                                        !EVP_PKEY_assign_RSA(pkey, rsa))
                                {
+                               if(bn) BN_free(bn);
                                if(rsa) RSA_free(rsa);
                                goto end;
                                }
+                       BN_free(bn);
                        }
                else
 #endif
@@ -919,7 +926,9 @@ loop:
                                }
                        else
                                {
-                               if (!ASN1_INTEGER_set(X509_get_serialNumber(x509ss),0L)) goto end;
+                               if (!rand_serial(NULL,
+                                       X509_get_serialNumber(x509ss)))
+                                               goto end;
                                }
 
                        if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end;
@@ -1322,7 +1331,7 @@ start:            for (;;)
                        /* If OBJ not recognised ignore it */
                        if ((nid=OBJ_txt2nid(type)) == NID_undef) goto start;
                        if (BIO_snprintf(buf,sizeof buf,"%s_default",v->name)
-                               >= sizeof buf)
+                               >= (int)sizeof(buf))
                           {
                           BIO_printf(bio_err,"Name '%s' too long\n",v->name);
                           return 0;
@@ -1387,7 +1396,7 @@ start2:                   for (;;)
                                        goto start2;
 
                                if (BIO_snprintf(buf,sizeof buf,"%s_default",type)
-                                       >= sizeof buf)
+                                       >= (int)sizeof(buf))
                                   {
                                   BIO_printf(bio_err,"Name '%s' too long\n",v->name);
                                   return 0;