Provide an application-common setup function for engines and use it
everywhere.
This commit is contained in:
parent
853b1eb424
commit
531d630b5c
29
apps/apps.c
29
apps/apps.c
@ -1037,3 +1037,32 @@ X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath)
|
|||||||
X509_STORE_free(store);
|
X509_STORE_free(store);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ENGINE *setup_engine(BIO *err, const char *engine, int debug)
|
||||||
|
{
|
||||||
|
ENGINE *e = NULL;
|
||||||
|
|
||||||
|
if (engine)
|
||||||
|
{
|
||||||
|
if((e = ENGINE_by_id(engine)) == NULL)
|
||||||
|
{
|
||||||
|
BIO_printf(err,"invalid engine \"%s\"\n", engine);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
|
||||||
|
0, err, 0);
|
||||||
|
}
|
||||||
|
ENGINE_ctrl_cmd(e, "SET_USER_INTERFACE", 0, UI_OpenSSL(), 0, 1);
|
||||||
|
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
||||||
|
{
|
||||||
|
BIO_printf(err,"can't use that engine\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
BIO_printf(err,"engine \"%s\" set.\n", engine);
|
||||||
|
/* Free our "structural" reference. */
|
||||||
|
ENGINE_free(e);
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
@ -176,6 +176,7 @@ EVP_PKEY *load_pubkey(BIO *err, const char *file, int format,
|
|||||||
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
|
STACK_OF(X509) *load_certs(BIO *err, const char *file, int format,
|
||||||
const char *pass, ENGINE *e, const char *cert_descrip);
|
const char *pass, ENGINE *e, const char *cert_descrip);
|
||||||
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
|
X509_STORE *setup_verify(BIO *bp, char *CAfile, char *CApath);
|
||||||
|
ENGINE *setup_engine(BIO *err, const char *engine, int debug);
|
||||||
|
|
||||||
#define FORMAT_UNDEF 0
|
#define FORMAT_UNDEF 0
|
||||||
#define FORMAT_ASN1 1
|
#define FORMAT_ASN1 1
|
||||||
|
18
apps/ca.c
18
apps/ca.c
@ -549,23 +549,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if ((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if (!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************/
|
/*****************************************************************/
|
||||||
if (configfile == NULL) configfile = getenv("OPENSSL_CONF");
|
if (configfile == NULL) configfile = getenv("OPENSSL_CONF");
|
||||||
|
18
apps/dgst.c
18
apps/dgst.c
@ -225,23 +225,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
in=BIO_new(BIO_s_file());
|
||||||
bmd=BIO_new(BIO_f_md());
|
bmd=BIO_new(BIO_f_md());
|
||||||
|
18
apps/dh.c
18
apps/dh.c
@ -174,23 +174,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
in=BIO_new(BIO_s_file());
|
||||||
out=BIO_new(BIO_s_file());
|
out=BIO_new(BIO_s_file());
|
||||||
|
@ -257,23 +257,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (g && !num)
|
if (g && !num)
|
||||||
num = DEFBITS;
|
num = DEFBITS;
|
||||||
|
18
apps/dsa.c
18
apps/dsa.c
@ -198,23 +198,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = ENGINE_setup(engine, bio_err);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting passwords\n");
|
BIO_printf(bio_err, "Error getting passwords\n");
|
||||||
|
@ -232,23 +232,7 @@ bad:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = ENGINE_setup(engine, bio_err);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_rand)
|
if (need_rand)
|
||||||
{
|
{
|
||||||
|
18
apps/enc.c
18
apps/enc.c
@ -285,23 +285,7 @@ bad:
|
|||||||
argv++;
|
argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (bufsize != NULL)
|
if (bufsize != NULL)
|
||||||
{
|
{
|
||||||
|
18
apps/gendh.c
18
apps/gendh.c
@ -143,23 +143,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
out=BIO_new(BIO_s_file());
|
out=BIO_new(BIO_s_file());
|
||||||
if (out == NULL)
|
if (out == NULL)
|
||||||
|
@ -162,23 +162,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = ENGINE_setup(engine, bio_err);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
|
if(!app_passwd(bio_err, NULL, passargout, NULL, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting password\n");
|
BIO_printf(bio_err, "Error getting password\n");
|
||||||
|
@ -176,23 +176,7 @@ bad:
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (outfile == NULL)
|
if (outfile == NULL)
|
||||||
{
|
{
|
||||||
|
@ -300,19 +300,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL) {
|
e = setup_engine(bio_err, engine, 0);
|
||||||
if((e = ENGINE_by_id(engine)) == NULL) {
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n", engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL)) {
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(passarg) {
|
if(passarg) {
|
||||||
if(export_cert) passargout = passarg;
|
if(export_cert) passargout = passarg;
|
||||||
|
18
apps/pkcs7.c
18
apps/pkcs7.c
@ -168,23 +168,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
in=BIO_new(BIO_s_file());
|
in=BIO_new(BIO_s_file());
|
||||||
out=BIO_new(BIO_s_file());
|
out=BIO_new(BIO_s_file());
|
||||||
|
18
apps/pkcs8.c
18
apps/pkcs8.c
@ -185,23 +185,7 @@ int MAIN(int argc, char **argv)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting passwords\n");
|
BIO_printf(bio_err, "Error getting passwords\n");
|
||||||
|
18
apps/rand.c
18
apps/rand.c
@ -101,23 +101,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
|
app_RAND_load_file(NULL, bio_err, (inrand != NULL));
|
||||||
if (inrand != NULL)
|
if (inrand != NULL)
|
||||||
|
18
apps/req.c
18
apps/req.c
@ -586,23 +586,7 @@ bad:
|
|||||||
if ((in == NULL) || (out == NULL))
|
if ((in == NULL) || (out == NULL))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyfile != NULL)
|
if (keyfile != NULL)
|
||||||
{
|
{
|
||||||
|
18
apps/rsa.c
18
apps/rsa.c
@ -209,23 +209,7 @@ bad:
|
|||||||
|
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
if(!app_passwd(bio_err, passargin, passargout, &passin, &passout)) {
|
||||||
BIO_printf(bio_err, "Error getting passwords\n");
|
BIO_printf(bio_err, "Error getting passwords\n");
|
||||||
|
@ -157,23 +157,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: seed PRNG only if needed */
|
/* FIXME: seed PRNG only if needed */
|
||||||
app_RAND_load_file(NULL, bio_err, 0);
|
app_RAND_load_file(NULL, bio_err, 0);
|
||||||
|
@ -382,28 +382,7 @@ bad:
|
|||||||
OpenSSL_add_ssl_algorithms();
|
OpenSSL_add_ssl_algorithms();
|
||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
|
|
||||||
if (engine_id != NULL)
|
e = setup_engine(bio_err, engine_id, 1);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine_id)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (c_debug)
|
|
||||||
{
|
|
||||||
ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
|
|
||||||
0, bio_err, 0);
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine_id);
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx=SSL_CTX_new(meth);
|
ctx=SSL_CTX_new(meth);
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
|
@ -657,28 +657,7 @@ bad:
|
|||||||
SSL_load_error_strings();
|
SSL_load_error_strings();
|
||||||
OpenSSL_add_ssl_algorithms();
|
OpenSSL_add_ssl_algorithms();
|
||||||
|
|
||||||
if (engine_id != NULL)
|
e = setup_engine(bio_err, engine_id, 1);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine_id)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if (s_debug)
|
|
||||||
{
|
|
||||||
ENGINE_ctrl(e, ENGINE_CTRL_SET_LOGSTREAM,
|
|
||||||
0, bio_err, 0);
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
ERR_print_errors(bio_err);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine_id);
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx=SSL_CTX_new(meth);
|
ctx=SSL_CTX_new(meth);
|
||||||
if (ctx == NULL)
|
if (ctx == NULL)
|
||||||
|
18
apps/smime.c
18
apps/smime.c
@ -319,23 +319,7 @@ int MAIN(int argc, char **argv)
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
|
if(!app_passwd(bio_err, passargin, NULL, &passin, NULL)) {
|
||||||
BIO_printf(bio_err, "Error getting password\n");
|
BIO_printf(bio_err, "Error getting password\n");
|
||||||
|
17
apps/speed.c
17
apps/speed.c
@ -505,21 +505,8 @@ int MAIN(int argc, char **argv)
|
|||||||
BIO_printf(bio_err,"no engine given\n");
|
BIO_printf(bio_err,"no engine given\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
if((e = ENGINE_by_id(*argv)) == NULL)
|
e = setup_engine(bio_err, *argv, 0);
|
||||||
{
|
/* j will be increased again further down. We just
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
*argv);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", *argv);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
/* It will be increased again further down. We just
|
|
||||||
don't want speed to confuse an engine with an
|
don't want speed to confuse an engine with an
|
||||||
algorithm, especially when none is given (which
|
algorithm, especially when none is given (which
|
||||||
means all of them should be run) */
|
means all of them should be run) */
|
||||||
|
18
apps/spkac.c
18
apps/spkac.c
@ -179,23 +179,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keyfile) {
|
if(keyfile) {
|
||||||
if(strcmp(keyfile, "-")) key = BIO_new_file(keyfile, "r");
|
if(strcmp(keyfile, "-")) key = BIO_new_file(keyfile, "r");
|
||||||
|
@ -166,23 +166,7 @@ int MAIN(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
|
lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
|
||||||
if (lookup == NULL) abort();
|
if (lookup == NULL) abort();
|
||||||
|
18
apps/x509.c
18
apps/x509.c
@ -448,23 +448,7 @@ bad:
|
|||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != NULL)
|
e = setup_engine(bio_err, engine, 0);
|
||||||
{
|
|
||||||
if((e = ENGINE_by_id(engine)) == NULL)
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"invalid engine \"%s\"\n",
|
|
||||||
engine);
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
if(!ENGINE_set_default(e, ENGINE_METHOD_ALL))
|
|
||||||
{
|
|
||||||
BIO_printf(bio_err,"can't use that engine\n");
|
|
||||||
goto end;
|
|
||||||
}
|
|
||||||
BIO_printf(bio_err,"engine \"%s\" set.\n", engine);
|
|
||||||
/* Free our "structural" reference. */
|
|
||||||
ENGINE_free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (need_rand)
|
if (need_rand)
|
||||||
app_RAND_load_file(NULL, bio_err, 0);
|
app_RAND_load_file(NULL, bio_err, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user