-/* $OpenBSD: a_pkey.c,v 1.6 2023/07/07 19:37:52 beck Exp $ */
+/* $OpenBSD: a_pkey.c,v 1.7 2023/11/19 15:46:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/objects.h>
#include <openssl/x509.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
#include "asn1_local.h"
#include "evp_local.h"
}
} else {
ret = *a;
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(ret->engine);
- ret->engine = NULL;
-#endif
}
if (!EVP_PKEY_set_type(ret, type)) {
-/* $OpenBSD: ameth_lib.c,v 1.32 2023/07/07 19:37:52 beck Exp $ */
+/* $OpenBSD: ameth_lib.c,v 1.33 2023/11/19 15:46:09 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
#include <openssl/asn1t.h>
#include <openssl/x509.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
#include "asn1_local.h"
#include "evp_local.h"
type = mp->pkey_base_id;
}
if (pe) {
-#ifndef OPENSSL_NO_ENGINE
- ENGINE *e;
- /* type will contain the final unaliased type */
- e = ENGINE_get_pkey_asn1_meth_engine(type);
- if (e) {
- *pe = e;
- return ENGINE_get_pkey_asn1_meth(e, type);
- }
-#endif
*pe = NULL;
}
return mp;
if (len == -1)
len = strlen(str);
if (pe) {
-#ifndef OPENSSL_NO_ENGINE
- ENGINE *e;
- ameth = ENGINE_pkey_asn1_find_str(&e, str, len);
- if (ameth) {
- /* Convert structural into
- * functional reference
- */
- if (!ENGINE_init(e))
- ameth = NULL;
- ENGINE_free(e);
- *pe = e;
- return ameth;
- }
-#endif
*pe = NULL;
}
for (i = EVP_PKEY_asn1_get_count() - 1; i >= 0; i--) {
-/* $OpenBSD: conf_mall.c,v 1.9 2014/07/11 08:44:48 jsing Exp $ */
+/* $OpenBSD: conf_mall.c,v 1.10 2023/11/19 15:46:09 tb Exp $ */
/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
#include <openssl/crypto.h>
#include <openssl/x509.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
/* Load all OpenSSL builtin modules */
void
{
/* Add builtin modules here */
ASN1_add_oid_module();
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_add_conf_module();
-#endif
}
-/* $OpenBSD: conf_sap.c,v 1.14 2018/03/19 03:56:08 beck Exp $ */
+/* $OpenBSD: conf_sap.c,v 1.15 2023/11/19 15:46:09 tb Exp $ */
/* Written by Stephen Henson (steve@openssl.org) for the OpenSSL
* project 2001.
*/
#include <openssl/err.h>
#include <openssl/x509.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
/* This is the automatic configuration loader: it is called automatically by
* OpenSSL when any of a number of standard initialisation functions are called,
* unless this is overridden by calling OPENSSL_no_config()
OPENSSL_config_internal(void)
{
OPENSSL_load_builtin_modules();
-#ifndef OPENSSL_NO_ENGINE
- /* Need to load ENGINEs */
- ENGINE_load_builtin_engines();
-#endif
/* Add others here? */
ERR_clear_error();
-/* $OpenBSD: crypto_init.c,v 1.11 2023/07/08 08:28:23 beck Exp $ */
+/* $OpenBSD: crypto_init.c,v 1.12 2023/11/19 15:46:09 tb Exp $ */
/*
* Copyright (c) 2018 Bob Beck <beck@openbsd.org>
*
#include <openssl/asn1.h>
#include <openssl/conf.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
#include <openssl/err.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
ERR_free_strings();
CRYPTO_cleanup_all_ex_data();
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_cleanup();
-#endif
EVP_cleanup();
ASN1_STRING_TABLE_cleanup();
-/* $OpenBSD: dh_lib.c,v 1.41 2023/08/13 12:09:14 tb Exp $ */
+/* $OpenBSD: dh_lib.c,v 1.42 2023/11/19 15:46:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/dh.h>
#include <openssl/err.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
#include "dh_local.h"
static const DH_METHOD *default_DH_method = NULL;
mtmp = dh->meth;
if (mtmp->finish)
mtmp->finish(dh);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(dh->engine);
- dh->engine = NULL;
-#endif
dh->meth = meth;
if (meth->init)
meth->init(dh);
dh->flags = dh->meth->flags & ~DH_FLAG_NON_FIPS_ALLOW;
dh->references = 1;
-#ifndef OPENSSL_NO_ENGINE
- if (engine != NULL) {
- if (!ENGINE_init(engine)) {
- DHerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- dh->engine = engine;
- } else
- dh->engine = ENGINE_get_default_DH();
- if (dh->engine != NULL) {
- if ((dh->meth = ENGINE_get_DH(dh->engine)) == NULL) {
- DHerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- dh->flags = dh->meth->flags & ~DH_FLAG_NON_FIPS_ALLOW;
- }
-#endif
-
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DH, dh, &dh->ex_data))
goto err;
if (dh->meth->init != NULL && !dh->meth->init(dh))
if (r->meth != NULL && r->meth->finish != NULL)
r->meth->finish(r);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(r->engine);
-#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DH, r, &r->ex_data);
-/* $OpenBSD: dsa_lib.c,v 1.44 2023/08/12 06:14:36 tb Exp $ */
+/* $OpenBSD: dsa_lib.c,v 1.45 2023/11/19 15:46:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#ifndef OPENSSL_NO_DH
#include <openssl/dh.h>
#endif
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
#include "dh_local.h"
#include "dsa_local.h"
mtmp = dsa->meth;
if (mtmp->finish)
mtmp->finish(dsa);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(dsa->engine);
- dsa->engine = NULL;
-#endif
dsa->meth = meth;
if (meth->init)
meth->init(dsa);
dsa->flags = dsa->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW;
dsa->references = 1;
-#ifndef OPENSSL_NO_ENGINE
- if (engine) {
- if (!ENGINE_init(engine)) {
- DSAerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- dsa->engine = engine;
- } else
- dsa->engine = ENGINE_get_default_DSA();
- if (dsa->engine != NULL) {
- if ((dsa->meth = ENGINE_get_DSA(dsa->engine)) == NULL) {
- DSAerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- dsa->flags = dsa->meth->flags & ~DSA_FLAG_NON_FIPS_ALLOW;
- }
-#endif
-
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_DSA, dsa, &dsa->ex_data))
goto err;
if (dsa->meth->init != NULL && !dsa->meth->init(dsa))
if (r->meth != NULL && r->meth->finish != NULL)
r->meth->finish(r);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(r->engine);
-#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DSA, r, &r->ex_data);
-/* $OpenBSD: ec_key.c,v 1.37 2023/08/03 18:53:56 tb Exp $ */
+/* $OpenBSD: ec_key.c,v 1.38 2023/11/19 15:46:09 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
#include <openssl/err.h>
#include "bn_local.h"
if (r->meth != NULL && r->meth->finish != NULL)
r->meth->finish(r);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(r->engine);
-#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_EC_KEY, r, &r->ex_data);
EC_GROUP_free(r->group);
if (src->meth != dest->meth) {
if (dest->meth != NULL && dest->meth->finish != NULL)
dest->meth->finish(dest);
-#ifndef OPENSSL_NO_ENGINE
- if (ENGINE_finish(dest->engine) == 0)
- return 0;
- dest->engine = NULL;
-#endif
}
/* copy the parameters */
if (src->group) {
return NULL;
if (src->meth != dest->meth) {
-#ifndef OPENSSL_NO_ENGINE
- if (src->engine != NULL && ENGINE_init(src->engine) == 0)
- return 0;
- dest->engine = src->engine;
-#endif
dest->meth = src->meth;
}
-/* $OpenBSD: ec_kmeth.c,v 1.12 2023/07/28 09:28:37 tb Exp $ */
+/* $OpenBSD: ec_kmeth.c,v 1.13 2023/11/19 15:46:09 tb Exp $ */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
#include <openssl/ec.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
#include <openssl/err.h>
#include "bn_local.h"
if (finish != NULL)
finish(key);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(key->engine);
- key->engine = NULL;
-#endif
-
key->meth = meth;
if (meth->init != NULL)
return meth->init(key);
return NULL;
}
ret->meth = EC_KEY_get_default_method();
-#ifndef OPENSSL_NO_ENGINE
- if (engine != NULL) {
- if (!ENGINE_init(engine)) {
- ECerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- ret->engine = engine;
- } else
- ret->engine = ENGINE_get_default_EC();
- if (ret->engine) {
- ret->meth = ENGINE_get_EC(ret->engine);
- if (ret->meth == NULL) {
- ECerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- }
-#endif
ret->version = 1;
ret->flags = 0;
ret->group = NULL;
-/* $OpenBSD: engine_stubs.c,v 1.1 2023/07/21 09:04:23 tb Exp $ */
+/* $OpenBSD: engine_stubs.c,v 1.2 2023/11/19 15:46:09 tb Exp $ */
/*
* Written by Theo Buehler. Public domain.
#include <openssl/engine.h>
-#ifdef OPENSSL_NO_ENGINE
-
void
ENGINE_load_builtin_engines(void)
{
{
return NULL;
}
-
-#endif
-/* $OpenBSD: err_all.c,v 1.32 2023/07/28 09:46:36 tb Exp $ */
+/* $OpenBSD: err_all.c,v 1.33 2023/11/19 15:46:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#ifndef OPENSSL_NO_EC
#include <openssl/ec.h>
#endif
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
#ifndef OPENSSL_NO_RSA
#include <openssl/rsa.h>
#endif
#endif
#ifndef OPENSSL_NO_EC
ERR_load_EC_strings();
-#endif
-#ifndef OPENSSL_NO_ENGINE
- ERR_load_ENGINE_strings();
#endif
ERR_load_EVP_strings();
#ifndef OPENSSL_NO_GOST
-/* $OpenBSD: digest.c,v 1.38 2023/07/07 19:37:53 beck Exp $ */
+/* $OpenBSD: digest.c,v 1.39 2023/11/19 15:46:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/evp.h>
#include <openssl/objects.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
#include "evp_local.h"
int
{
EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);
-#ifndef OPENSSL_NO_ENGINE
- /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
- * so this context may already have an ENGINE! Try to avoid releasing
- * the previous handle, re-querying for an ENGINE, and having a
- * reinitialisation, when it may all be unnecessary. */
- if (ctx->engine && ctx->digest && (!type ||
- (type && (type->type == ctx->digest->type))))
- goto skip_to_init;
- if (type) {
- /* Ensure an ENGINE left lying around from last time is cleared
- * (the previous check attempted to avoid this if the same
- * ENGINE and EVP_MD could be used). */
- ENGINE_finish(ctx->engine);
- if (impl != NULL) {
- if (!ENGINE_init(impl)) {
- EVPerror(EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- } else
- /* Ask if an ENGINE is reserved for this job */
- impl = ENGINE_get_digest_engine(type->type);
- if (impl != NULL) {
- /* There's an ENGINE for this job ... (apparently) */
- const EVP_MD *d = ENGINE_get_digest(impl, type->type);
- if (d == NULL) {
- /* Same comment from evp_enc.c */
- EVPerror(EVP_R_INITIALIZATION_ERROR);
- ENGINE_finish(impl);
- return 0;
- }
- /* We'll use the ENGINE's private digest definition */
- type = d;
- /* Store the ENGINE functional reference so we know
- * 'type' came from an ENGINE and we need to release
- * it when done. */
- ctx->engine = impl;
- } else
- ctx->engine = NULL;
- } else if (!ctx->digest) {
- EVPerror(EVP_R_NO_DIGEST_SET);
- return 0;
- }
-#endif
if (ctx->digest != type) {
if (ctx->digest && ctx->digest->ctx_size && ctx->md_data &&
!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) {
}
}
}
-#ifndef OPENSSL_NO_ENGINE
-skip_to_init:
-#endif
if (ctx->pctx) {
int r;
r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,
EVPerror(EVP_R_INPUT_NOT_INITIALIZED);
return 0;
}
-#ifndef OPENSSL_NO_ENGINE
- /* Make sure it's safe to copy a digest context using an ENGINE */
- if (in->engine && !ENGINE_init(in->engine)) {
- EVPerror(ERR_R_ENGINE_LIB);
- return 0;
- }
-#endif
if (out->digest == in->digest) {
tmp_buf = out->md_data;
*/
if (!EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_KEEP_PKEY_CTX))
EVP_PKEY_CTX_free(ctx->pctx);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(ctx->engine);
-#endif
memset(ctx, 0, sizeof(*ctx));
return 1;
-/* $OpenBSD: evp_enc.c,v 1.54 2023/11/18 09:37:15 tb Exp $ */
+/* $OpenBSD: evp_enc.c,v 1.55 2023/11/19 15:46:09 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/err.h>
#include <openssl/evp.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
#include "evp_local.h"
int
enc = 1;
ctx->encrypt = enc;
}
-#ifndef OPENSSL_NO_ENGINE
- /* Whether it's nice or not, "Inits" can be used on "Final"'d contexts
- * so this context may already have an ENGINE! Try to avoid releasing
- * the previous handle, re-querying for an ENGINE, and having a
- * reinitialisation, when it may all be unnecessary. */
- if (ctx->engine && ctx->cipher &&
- (!cipher || (cipher && (cipher->nid == ctx->cipher->nid))))
- goto skip_to_init;
-#endif
if (cipher) {
/* Ensure a context left lying around from last time is cleared
* (the previous check attempted to avoid this if the same
ctx->encrypt = enc;
ctx->flags = flags;
}
-#ifndef OPENSSL_NO_ENGINE
- if (impl) {
- if (!ENGINE_init(impl)) {
- EVPerror(EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- } else
- /* Ask if an ENGINE is reserved for this job */
- impl = ENGINE_get_cipher_engine(cipher->nid);
- if (impl) {
- /* There's an ENGINE for this job ... (apparently) */
- const EVP_CIPHER *c =
- ENGINE_get_cipher(impl, cipher->nid);
- if (!c) {
- EVPerror(EVP_R_INITIALIZATION_ERROR);
- return 0;
- }
- /* We'll use the ENGINE's private cipher definition */
- cipher = c;
- /* Store the ENGINE functional reference so we know
- * 'cipher' came from an ENGINE and we need to release
- * it when done. */
- ctx->engine = impl;
- } else
- ctx->engine = NULL;
-#endif
ctx->cipher = cipher;
if (ctx->cipher->ctx_size) {
EVPerror(EVP_R_NO_CIPHER_SET);
return 0;
}
-#ifndef OPENSSL_NO_ENGINE
-skip_to_init:
-#endif
/* we assume block size is a power of 2 in *cryptUpdate */
if (ctx->cipher->block_size != 1 &&
ctx->cipher->block_size != 8 &&
/* XXX - store size of cipher_data so we can always freezero(). */
free(c->cipher_data);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(c->engine);
-#endif
-
explicit_bzero(c, sizeof(EVP_CIPHER_CTX));
return 1;
EVPerror(EVP_R_INPUT_NOT_INITIALIZED);
return 0;
}
-#ifndef OPENSSL_NO_ENGINE
- /* Make sure it's safe to copy a cipher context using an ENGINE */
- if (in->engine && !ENGINE_init(in->engine)) {
- EVPerror(ERR_R_ENGINE_LIB);
- return 0;
- }
-#endif
EVP_CIPHER_CTX_cleanup(out);
memcpy(out, in, sizeof *out);
-/* $OpenBSD: p_lib.c,v 1.37 2023/09/10 17:32:17 tb Exp $ */
+/* $OpenBSD: p_lib.c,v 1.38 2023/11/19 15:46:10 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/rsa.h>
#endif
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
#include "asn1_local.h"
#include "evp_local.h"
*/
if ((type == pkey->save_type) && pkey->ameth)
return 1;
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(pkey->engine);
- pkey->engine = NULL;
-#endif
}
if (str)
ameth = EVP_PKEY_asn1_find_str(eptr, str, len);
else
ameth = EVP_PKEY_asn1_find(eptr, type);
-#ifndef OPENSSL_NO_ENGINE
- if (pkey == NULL && eptr != NULL)
- ENGINE_finish(e);
-#endif
if (!ameth) {
EVPerror(EVP_R_UNSUPPORTED_ALGORITHM);
return 0;
ret = ameth->pkey_id;
else
ret = NID_undef;
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(e);
-#endif
return ret;
}
x->ameth->pkey_free(x);
x->pkey.ptr = NULL;
}
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(x->engine);
- x->engine = NULL;
-#endif
}
static int
-/* $OpenBSD: pem_lib.c,v 1.53 2023/07/07 13:40:44 beck Exp $ */
+/* $OpenBSD: pem_lib.c,v 1.54 2023/11/19 15:46:10 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#ifndef OPENSSL_NO_DES
#include <openssl/des.h>
#endif
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
#include "asn1_local.h"
#include "evp_local.h"
r = 1;
else
r = 0;
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(e);
-#endif
return r;
}
}
-/* $OpenBSD: pem_pkey.c,v 1.27 2023/07/07 13:40:44 beck Exp $ */
+/* $OpenBSD: pem_pkey.c,v 1.28 2023/11/19 15:46:10 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include <openssl/pkcs12.h>
#include <openssl/x509.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
#include "asn1_local.h"
#include "evp_local.h"
-/* $OpenBSD: rand.h,v 1.23 2022/07/12 14:42:50 kn Exp $ */
+/* $OpenBSD: rand.h,v 1.24 2023/11/19 15:46:10 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int RAND_set_rand_method(const RAND_METHOD *meth);
const RAND_METHOD *RAND_get_rand_method(void);
-#ifndef OPENSSL_NO_ENGINE
-int RAND_set_rand_engine(ENGINE *engine);
-#endif
RAND_METHOD *RAND_SSLeay(void);
#ifndef LIBRESSL_INTERNAL
-/* $OpenBSD: rand_lib.c,v 1.22 2023/07/07 19:37:54 beck Exp $ */
+/* $OpenBSD: rand_lib.c,v 1.23 2023/11/19 15:46:10 tb Exp $ */
/*
* Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
*
}
LCRYPTO_ALIAS(RAND_SSLeay);
-#ifndef OPENSSL_NO_ENGINE
-int
-RAND_set_rand_engine(ENGINE *engine)
-{
- return 1;
-}
-LCRYPTO_ALIAS(RAND_set_rand_engine);
-#endif
-
void
RAND_cleanup(void)
{
-/* $OpenBSD: rsa_lib.c,v 1.48 2023/07/28 10:05:16 tb Exp $ */
+/* $OpenBSD: rsa_lib.c,v 1.49 2023/11/19 15:46:10 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
#include "evp_local.h"
#include "rsa_local.h"
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
static const RSA_METHOD *default_RSA_meth = NULL;
RSA *
mtmp = rsa->meth;
if (mtmp->finish)
mtmp->finish(rsa);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(rsa->engine);
- rsa->engine = NULL;
-#endif
rsa->meth = meth;
if (meth->init)
meth->init(rsa);
ret->meth = RSA_get_default_method();
-#ifndef OPENSSL_NO_ENGINE
- if (engine != NULL) {
- if (!ENGINE_init(engine)) {
- RSAerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- ret->engine = engine;
- } else {
- ret->engine = ENGINE_get_default_RSA();
- }
-
- if (ret->engine != NULL) {
- if ((ret->meth = ENGINE_get_RSA(ret->engine)) == NULL) {
- RSAerror(ERR_R_ENGINE_LIB);
- goto err;
- }
- }
-#endif
-
ret->references = 1;
ret->flags = ret->meth->flags & ~RSA_FLAG_NON_FIPS_ALLOW;
return ret;
err:
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(ret->engine);
-#endif
free(ret);
return NULL;
if (r->meth->finish)
r->meth->finish(r);
-#ifndef OPENSSL_NO_ENGINE
- ENGINE_finish(r->engine);
-#endif
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_RSA, r, &r->ex_data);
-/* $OpenBSD: ts.h,v 1.22 2023/07/28 09:53:55 tb Exp $ */
+/* $OpenBSD: ts.h,v 1.23 2023/11/19 15:46:10 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@opentsa.org) for the OpenSSL
* project 2002, 2003, 2004.
*/
const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
TS_RESP_CTX *ctx);
-#ifndef OPENSSL_NO_ENGINE
-int TS_CONF_set_crypto_device(CONF *conf, const char *section,
- const char *device);
-int TS_CONF_set_default_engine(const char *name);
-#endif
int TS_CONF_set_signer_cert(CONF *conf, const char *section,
const char *cert, TS_RESP_CTX *ctx);
int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
-/* $OpenBSD: ts_conf.c,v 1.12 2023/07/07 07:25:21 beck Exp $ */
+/* $OpenBSD: ts_conf.c,v 1.13 2023/11/19 15:46:10 tb Exp $ */
/* Written by Zoltan Glozik (zglozik@stones.com) for the OpenSSL
* project 2002.
*/
#include <openssl/pem.h>
#include <openssl/ts.h>
-#ifndef OPENSSL_NO_ENGINE
-#include <openssl/engine.h>
-#endif
-
/* Macro definitions for the configuration file. */
#define BASE_SECTION "tsa"
}
LCRYPTO_ALIAS(TS_CONF_set_serial);
-#ifndef OPENSSL_NO_ENGINE
-
-int
-TS_CONF_set_crypto_device(CONF *conf, const char *section, const char *device)
-{
- int ret = 0;
-
- if (!device)
- device = NCONF_get_string(conf, section, ENV_CRYPTO_DEVICE);
-
- if (device && !TS_CONF_set_default_engine(device)) {
- TS_CONF_invalid(section, ENV_CRYPTO_DEVICE);
- goto err;
- }
- ret = 1;
-
-err:
- return ret;
-}
-LCRYPTO_ALIAS(TS_CONF_set_crypto_device);
-
-int
-TS_CONF_set_default_engine(const char *name)
-{
- ENGINE *e = NULL;
- int ret = 0;
-
- /* Leave the default if builtin specified. */
- if (strcmp(name, "builtin") == 0)
- return 1;
-
- if (!(e = ENGINE_by_id(name)))
- goto err;
- /* All the operations are going to be carried out by the engine. */
- if (!ENGINE_set_default(e, ENGINE_METHOD_ALL))
- goto err;
- ret = 1;
-
-err:
- if (!ret) {
- TSerror(TS_R_COULD_NOT_SET_ENGINE);
- ERR_asprintf_error_data("engine:%s", name);
- }
- ENGINE_free(e);
- return ret;
-}
-LCRYPTO_ALIAS(TS_CONF_set_default_engine);
-
-#endif
-
int
TS_CONF_set_signer_cert(CONF *conf, const char *section, const char *cert,
TS_RESP_CTX *ctx)