X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=apps%2Freq.c;h=e9b764b90cdb71ef83c554ea11ec56fcfb76add2;hb=3e70c81ed9f54353d2fec4e5ef163c3810d58acf;hp=7953f9ddc177439cfd727fd247fbc90229602f4f;hpb=718f8f7a9e981cf9a7f3aaa4ba9e013151384d06;p=openssl.git diff --git a/apps/req.c b/apps/req.c index 7953f9ddc1..e9b764b90c 100644 --- a/apps/req.c +++ b/apps/req.c @@ -165,7 +165,7 @@ int MAIN(int argc, char **argv) EVP_PKEY_CTX *genctx = NULL; const char *keyalg = NULL; char *keyalgstr = NULL; - STACK *pkeyopts = NULL; + STACK_OF(STRING) *pkeyopts = NULL; EVP_PKEY *pkey=NULL; int i=0,badops=0,newreq=0,verbose=0,pkey_type=-1; long newkey = -1; @@ -306,8 +306,8 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; if (!pkeyopts) - pkeyopts = sk_new_null(); - if (!pkeyopts || !sk_push(pkeyopts, *(++argv))) + pkeyopts = sk_STRING_new_null(); + if (!pkeyopts || !sk_STRING_push(pkeyopts, *(++argv))) goto bad; } else if (strcmp(*argv,"-batch") == 0) @@ -365,11 +365,6 @@ int MAIN(int argc, char **argv) serial = s2i_ASN1_INTEGER(NULL, *(++argv)); if (!serial) goto bad; } - else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL) - { - /* ok */ - digest=md_alg; - } else if (strcmp(*argv,"-extensions") == 0) { if (--argc < 1) goto bad; @@ -380,6 +375,11 @@ int MAIN(int argc, char **argv) if (--argc < 1) goto bad; req_exts = *(++argv); } + else if ((md_alg=EVP_get_digestbyname(&((*argv)[1]))) != NULL) + { + /* ok */ + digest=md_alg; + } else { BIO_printf(bio_err,"unknown option %s\n",*argv); @@ -667,9 +667,9 @@ bad: if (pkeyopts) { char *genopt; - for (i = 0; i < sk_num(pkeyopts); i++) + for (i = 0; i < sk_STRING_num(pkeyopts); i++) { - genopt = sk_value(pkeyopts, i); + genopt = sk_STRING_value(pkeyopts, i); if (pkey_ctrl_string(genctx, genopt) <= 0) { BIO_printf(bio_err, @@ -838,7 +838,7 @@ loop: if (!X509_set_issuer_name(x509ss, X509_REQ_get_subject_name(req))) goto end; if (!X509_gmtime_adj(X509_get_notBefore(x509ss),0)) goto end; - if (!X509_gmtime_adj(X509_get_notAfter(x509ss), (long)60*60*24*days)) goto end; + if (!X509_time_adj_ex(X509_get_notAfter(x509ss), days, 0, NULL)) goto end; if (!X509_set_subject_name(x509ss, X509_REQ_get_subject_name(req))) goto end; tmppkey = X509_REQ_get_pubkey(req); if (!tmppkey || !X509_set_pubkey(x509ss,tmppkey)) goto end; @@ -1083,7 +1083,7 @@ end: if (genctx) EVP_PKEY_CTX_free(genctx); if (pkeyopts) - sk_free(pkeyopts); + sk_STRING_free(pkeyopts); #ifndef OPENSSL_NO_ENGINE if (gen_eng) ENGINE_free(gen_eng); @@ -1715,7 +1715,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type, ERR_print_errors(err); return NULL; } - +#ifndef OPENSSL_NO_RSA if ((*pkey_type == EVP_PKEY_RSA) && (keylen != -1)) { if (EVP_PKEY_CTX_set_rsa_keygen_bits(gctx, keylen) <= 0) @@ -1726,6 +1726,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type, return NULL; } } +#endif return gctx; }