Update from stable branch.
[openssl.git] / apps / ts.c
index edeab8231801ab2a53ed6a53be0a65ae7bd83edd..d73b4eb5addf81fce577b739b2f93058aaf7ce85 100644 (file)
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -165,6 +165,9 @@ int MAIN(int argc, char **argv)
                BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
                }
 
+       if (!load_config(bio_err, NULL))
+               goto cleanup;
+
        for (argc--, argv++; argc > 0; argc--, argv++)
                {
                if (strcmp(*argv, "-config") == 0)
@@ -598,6 +601,8 @@ static int create_digest(BIO *input, char *digest, const EVP_MD *md,
        int md_value_len;
 
        md_value_len = EVP_MD_size(md);
+       if (md_value_len < 0)
+           goto err;
        if (input)
                {
                /* Digest must be computed from an input file. */
@@ -813,9 +818,10 @@ static TS_RESP *create_response(CONF *conf, const char *section, char *engine,
 
        /* Setting serial number provider callback. */
        if (!TS_CONF_set_serial(conf, section, serial_cb, resp_ctx)) goto end;
-
+#ifndef OPENSSL_NO_ENGINE
        /* Setting default OpenSSL engine. */
        if (!TS_CONF_set_crypto_device(conf, section, engine)) goto end;
+#endif
 
        /* Setting TSA signer certificate. */
        if (!TS_CONF_set_signer_cert(conf, section, signer, resp_ctx)) goto end;