X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=apps%2Freq.c;h=f43c477f75b746b6b63cd28581c831ef86cd5fcc;hp=5df8f89fcd03f7223e56f2b4b9184400eece5991;hb=12bdb643756d829569bb903e5b806613ff975ccb;hpb=6c43032121b3403061119def69c5684ab955e7e2 diff --git a/apps/req.c b/apps/req.c index 5df8f89fcd..f43c477f75 100644 --- a/apps/req.c +++ b/apps/req.c @@ -187,7 +187,7 @@ int MAIN(int argc, char **argv) char *p; char *subj = NULL; int multirdn = 0; - const EVP_MD *md_alg=NULL,*digest=EVP_md5(); + const EVP_MD *md_alg=NULL,*digest=EVP_sha1(); unsigned long chtype = MBSTRING_ASC; #ifndef MONOLITH char *to_free; @@ -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;