Because DEC C - sorry, HP C - is picky about features, we need to
[openssl.git] / apps / req.c
index 745ba7035f430d5ca688b98869bb07aaffe2bc67..e728d5bf9511d6c501506393c2453fb42de1f210 100644 (file)
@@ -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)
@@ -617,8 +617,7 @@ bad:
                           message */
                        goto end;
                        }
-               if (EVP_PKEY_type(pkey->type) == EVP_PKEY_DSA || 
-                       EVP_PKEY_type(pkey->type) == EVP_PKEY_EC)
+               else
                        {
                        char *randfile = NCONF_get_string(req_conf,SECTION,"RANDFILE");
                        if (randfile == NULL)
@@ -668,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,
@@ -839,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;
@@ -1084,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);
@@ -1648,7 +1647,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(BIO *err, const char *gstr, int *pkey_type,
                if (!param)
                        {
                        X509 *x;
-                       BIO_reset(pbio);
+                       (void)BIO_reset(pbio);
                        x = PEM_read_bio_X509(pbio, NULL, NULL, NULL);
                        if (x)
                                {