-/* $OpenBSD: ameth_lib.c,v 1.33 2023/11/19 15:46:09 tb Exp $ */
+/* $OpenBSD: ameth_lib.c,v 1.34 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
{
const EVP_PKEY_ASN1_METHOD *mp;
+ if (pe != NULL)
+ *pe = NULL;
+
for (;;) {
if ((mp = pkey_asn1_find(type)) == NULL)
break;
break;
type = mp->pkey_base_id;
}
- if (pe) {
- *pe = NULL;
- }
+
return mp;
}
if (len == -1)
len = strlen(str);
- if (pe) {
+ if (pe != NULL)
*pe = NULL;
- }
for (i = EVP_PKEY_asn1_get_count() - 1; i >= 0; i--) {
ameth = EVP_PKEY_asn1_get0(i);
if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
-/* $OpenBSD: cm_pmeth.c,v 1.10 2022/11/26 16:08:51 tb Exp $ */
+/* $OpenBSD: cm_pmeth.c,v 1.11 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2010.
*/
break;
case EVP_PKEY_CTRL_CIPHER:
- if (!CMAC_Init(cmctx, NULL, 0, p2, ctx->engine))
+ if (!CMAC_Init(cmctx, NULL, 0, p2, NULL))
return 0;
break;
-/* $OpenBSD: cmac.c,v 1.15 2023/11/29 18:11:10 tb Exp $ */
+/* $OpenBSD: cmac.c,v 1.16 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project.
*/
int bl;
/* All zeros means restart */
- if (key == NULL && cipher == NULL && impl == NULL && keylen == 0) {
+ if (key == NULL && cipher == NULL && keylen == 0) {
/* Not initialised */
if (ctx->nlast_block == -1)
return 0;
/* Initialise context. */
if (cipher != NULL) {
- if (!EVP_EncryptInit_ex(&ctx->cctx, cipher, impl, NULL, NULL))
+ if (!EVP_EncryptInit_ex(&ctx->cctx, cipher, NULL, NULL, NULL))
return 0;
}
-/* $OpenBSD: dh_lib.c,v 1.42 2023/11/19 15:46:09 tb Exp $ */
+/* $OpenBSD: dh_lib.c,v 1.43 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ENGINE *
DH_get0_engine(DH *dh)
{
- return dh->engine;
+ return NULL;
}
LCRYPTO_ALIAS(DH_get0_engine);
-/* $OpenBSD: dh_local.h,v 1.3 2022/01/14 08:25:44 tb Exp $ */
+/* $OpenBSD: dh_local.h,v 1.4 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int references;
CRYPTO_EX_DATA ex_data;
const DH_METHOD *meth;
- ENGINE *engine;
};
/*
-/* $OpenBSD: dsa_lib.c,v 1.45 2023/11/19 15:46:09 tb Exp $ */
+/* $OpenBSD: dsa_lib.c,v 1.46 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ENGINE *
DSA_get0_engine(DSA *d)
{
- return d->engine;
+ return NULL;
}
LCRYPTO_ALIAS(DSA_get0_engine);
-/* $OpenBSD: dsa_local.h,v 1.2 2023/03/04 20:54:52 tb Exp $ */
+/* $OpenBSD: dsa_local.h,v 1.3 2023/11/29 21:35:57 tb Exp $ */
/* ====================================================================
* Copyright (c) 2007 The OpenSSL Project. All rights reserved.
*
int references;
CRYPTO_EX_DATA ex_data;
const DSA_METHOD *meth;
- /* functional reference if 'meth' is ENGINE-provided */
- ENGINE *engine;
} /* DSA */;
int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
-/* $OpenBSD: ec_key.c,v 1.38 2023/11/19 15:46:09 tb Exp $ */
+/* $OpenBSD: ec_key.c,v 1.39 2023/11/29 21:35:57 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
{
EC_KEY *ret;
- if ((ret = EC_KEY_new_method(ec_key->engine)) == NULL)
+ if ((ret = EC_KEY_new_method(NULL)) == NULL)
return NULL;
if (EC_KEY_copy(ret, ec_key) == NULL) {
EC_KEY_free(ret);
-/* $OpenBSD: ec_local.h,v 1.26 2023/07/28 15:50:33 tb Exp $ */
+/* $OpenBSD: ec_local.h,v 1.27 2023/11/29 21:35:57 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
struct ec_key_st {
const EC_KEY_METHOD *meth;
- ENGINE *engine;
int version;
-/* $OpenBSD: digest.c,v 1.39 2023/11/19 15:46:09 tb Exp $ */
+/* $OpenBSD: digest.c,v 1.40 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
EVP_MD_CTX_init(&ctx);
EVP_MD_CTX_set_flags(&ctx, EVP_MD_CTX_FLAG_ONESHOT);
- ret = EVP_DigestInit_ex(&ctx, type, impl) &&
+ ret = EVP_DigestInit_ex(&ctx, type, NULL) &&
EVP_DigestUpdate(&ctx, data, count) &&
EVP_DigestFinal_ex(&ctx, md, size);
EVP_MD_CTX_cleanup(&ctx);
-/* $OpenBSD: evp_enc.c,v 1.55 2023/11/19 15:46:09 tb Exp $ */
+/* $OpenBSD: evp_enc.c,v 1.56 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
if (cipher) {
/* Ensure a context left lying around from last time is cleared
* (the previous check attempted to avoid this if the same
- * ENGINE and EVP_CIPHER could be used). */
+ * EVP_CIPHER could be used). */
if (ctx->cipher) {
unsigned long flags = ctx->flags;
EVP_CIPHER_CTX_cleanup(ctx);
EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
const unsigned char *key, const unsigned char *iv)
{
- return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 1);
+ return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 1);
}
int
EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *impl,
const unsigned char *key, const unsigned char *iv)
{
- return EVP_CipherInit_ex(ctx, cipher, impl, key, iv, 0);
+ return EVP_CipherInit_ex(ctx, cipher, NULL, key, iv, 0);
}
int
-/* $OpenBSD: evp_local.h,v 1.5 2023/09/28 11:29:10 tb Exp $ */
+/* $OpenBSD: evp_local.h,v 1.6 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
int save_type;
int references;
const EVP_PKEY_ASN1_METHOD *ameth;
- ENGINE *engine;
union {
void *ptr;
#ifndef OPENSSL_NO_RSA
struct evp_md_ctx_st {
const EVP_MD *digest;
- ENGINE *engine; /* functional reference if 'digest' is ENGINE-provided */
unsigned long flags;
void *md_data;
/* Public key context for sign/verify */
struct evp_cipher_ctx_st {
const EVP_CIPHER *cipher;
- ENGINE *engine; /* functional reference if 'cipher' is ENGINE-provided */
int encrypt; /* encrypt or decrypt */
int buf_len; /* number we have left */
struct evp_pkey_ctx_st {
/* Method associated with this operation */
const EVP_PKEY_METHOD *pmeth;
- /* Engine that implements this method or NULL if builtin */
- ENGINE *engine;
/* Key: may be NULL */
EVP_PKEY *pkey;
/* Peer key for key agreement, may be NULL */
-/* $OpenBSD: m_sigver.c,v 1.13 2023/07/07 19:37:53 beck Exp $ */
+/* $OpenBSD: m_sigver.c,v 1.14 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
static int
do_sigver_init(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type,
- ENGINE *e, EVP_PKEY *pkey, int ver)
+ EVP_PKEY *pkey, int ver)
{
if (ctx->pctx == NULL)
- ctx->pctx = EVP_PKEY_CTX_new(pkey, e);
+ ctx->pctx = EVP_PKEY_CTX_new(pkey, NULL);
if (ctx->pctx == NULL)
return 0;
*pctx = ctx->pctx;
if (ctx->pctx->pmeth->flags & EVP_PKEY_FLAG_SIGCTX_CUSTOM)
return 1;
- if (!EVP_DigestInit_ex(ctx, type, e))
+ if (!EVP_DigestInit_ex(ctx, type, NULL))
return 0;
return 1;
}
EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type,
ENGINE *e, EVP_PKEY *pkey)
{
- return do_sigver_init(ctx, pctx, type, e, pkey, 0);
+ return do_sigver_init(ctx, pctx, type, pkey, 0);
}
int
EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx, const EVP_MD *type,
ENGINE *e, EVP_PKEY *pkey)
{
- return do_sigver_init(ctx, pctx, type, e, pkey, 1);
+ return do_sigver_init(ctx, pctx, type, pkey, 1);
}
int
-/* $OpenBSD: p_lib.c,v 1.38 2023/11/19 15:46:10 tb Exp $ */
+/* $OpenBSD: p_lib.c,v 1.39 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
ret->save_type = EVP_PKEY_NONE;
ret->references = 1;
ret->ameth = NULL;
- ret->engine = NULL;
ret->pkey.ptr = NULL;
ret->attributes = NULL;
ret->save_parameters = 1;
return ((refs > 1) ? 1 : 0);
}
-/* Setup a public key ASN1 method and ENGINE from a NID or a string.
+/* Setup a public key ASN1 method from a NID or a string.
* If pkey is NULL just return 1 or 0 if the algorithm exists.
*/
static int
-pkey_set_type(EVP_PKEY *pkey, ENGINE *e, int type, const char *str, int len)
+pkey_set_type(EVP_PKEY *pkey, int type, const char *str, int len)
{
const EVP_PKEY_ASN1_METHOD *ameth;
- ENGINE **eptr = NULL;
-
- if (e == NULL)
- eptr = &e;
if (pkey) {
if (pkey->pkey.ptr)
if ((type == pkey->save_type) && pkey->ameth)
return 1;
}
- if (str)
- ameth = EVP_PKEY_asn1_find_str(eptr, str, len);
+ if (str != NULL)
+ ameth = EVP_PKEY_asn1_find_str(NULL, str, len);
else
- ameth = EVP_PKEY_asn1_find(eptr, type);
+ ameth = EVP_PKEY_asn1_find(NULL, type);
if (!ameth) {
EVPerror(EVP_R_UNSUPPORTED_ALGORITHM);
return 0;
}
if (pkey) {
pkey->ameth = ameth;
- pkey->engine = e;
pkey->type = pkey->ameth->pkey_id;
pkey->save_type = type;
int
EVP_PKEY_set_type(EVP_PKEY *pkey, int type)
{
- return pkey_set_type(pkey, NULL, type, NULL, -1);
+ return pkey_set_type(pkey, type, NULL, -1);
}
EVP_PKEY *
if ((ret = EVP_PKEY_new()) == NULL)
goto err;
- if (!pkey_set_type(ret, engine, type, NULL, -1))
+ if (!pkey_set_type(ret, type, NULL, -1))
goto err;
if (ret->ameth->set_priv_key == NULL) {
if ((ret = EVP_PKEY_new()) == NULL)
goto err;
- if (!pkey_set_type(ret, engine, type, NULL, -1))
+ if (!pkey_set_type(ret, type, NULL, -1))
goto err;
if (ret->ameth->set_pub_key == NULL) {
if ((cmctx = CMAC_CTX_new()) == NULL)
goto err;
- if (!pkey_set_type(ret, e, EVP_PKEY_CMAC, NULL, -1))
+ if (!pkey_set_type(ret, EVP_PKEY_CMAC, NULL, -1))
goto err;
- if (!CMAC_Init(cmctx, priv, len, cipher, e)) {
+ if (!CMAC_Init(cmctx, priv, len, cipher, NULL)) {
EVPerror(EVP_R_KEY_SETUP_FAILED);
goto err;
}
int
EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len)
{
- return pkey_set_type(pkey, NULL, EVP_PKEY_NONE, str, len);
+ return pkey_set_type(pkey, EVP_PKEY_NONE, str, len);
}
int
int
EVP_PKEY_type(int type)
{
- int ret;
const EVP_PKEY_ASN1_METHOD *ameth;
- ENGINE *e;
- ameth = EVP_PKEY_asn1_find(&e, type);
- if (ameth)
- ret = ameth->pkey_id;
- else
- ret = NID_undef;
- return ret;
+
+ if ((ameth = EVP_PKEY_asn1_find(NULL, type)) != NULL)
+ return ameth->pkey_id;
+
+ return NID_undef;
}
int
-/* $OpenBSD: pmeth_gn.c,v 1.13 2023/07/07 19:37:54 beck Exp $ */
+/* $OpenBSD: pmeth_gn.c,v 1.14 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
EVP_PKEY_CTX *mac_ctx = NULL;
EVP_PKEY *mac_key = NULL;
- mac_ctx = EVP_PKEY_CTX_new_id(type, e);
+ mac_ctx = EVP_PKEY_CTX_new_id(type, NULL);
if (!mac_ctx)
return NULL;
if (EVP_PKEY_keygen_init(mac_ctx) <= 0)
-/* $OpenBSD: pmeth_lib.c,v 1.34 2023/11/19 15:43:52 tb Exp $ */
+/* $OpenBSD: pmeth_lib.c,v 1.35 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
}
static EVP_PKEY_CTX *
-evp_pkey_ctx_new(EVP_PKEY *pkey, ENGINE *engine, int id)
+evp_pkey_ctx_new(EVP_PKEY *pkey, int id)
{
EVP_PKEY_CTX *pkey_ctx = NULL;
const EVP_PKEY_METHOD *pmeth;
EVPerror(ERR_R_MALLOC_FAILURE);
goto err;
}
- pkey_ctx->engine = engine;
- engine = NULL;
pkey_ctx->pmeth = pmeth;
pkey_ctx->operation = EVP_PKEY_OP_UNDEFINED;
if ((pkey_ctx->pkey = pkey) != NULL)
EVP_PKEY_CTX *
EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *engine)
{
- return evp_pkey_ctx_new(pkey, engine, -1);
+ return evp_pkey_ctx_new(pkey, -1);
}
EVP_PKEY_CTX *
EVP_PKEY_CTX_new_id(int id, ENGINE *engine)
{
- return evp_pkey_ctx_new(NULL, engine, id);
+ return evp_pkey_ctx_new(NULL, id);
}
EVP_PKEY_CTX *
-/* $OpenBSD: hm_pmeth.c,v 1.15 2022/11/26 16:08:53 tb Exp $ */
+/* $OpenBSD: hm_pmeth.c,v 1.16 2023/11/29 21:35:57 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2007.
*/
case EVP_PKEY_CTRL_DIGESTINIT:
key = ctx->pkey->pkey.ptr;
if (!HMAC_Init_ex(&hctx->ctx, key->data, key->length, hctx->md,
- ctx->engine))
+ NULL))
return 0;
break;
-/* $OpenBSD: pem_lib.c,v 1.54 2023/11/19 15:46:10 tb Exp $ */
+/* $OpenBSD: pem_lib.c,v 1.55 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
const EVP_PKEY_ASN1_METHOD *ameth;
slen = pem_check_suffix(nm, "PARAMETERS");
if (slen > 0) {
- ENGINE *e;
- ameth = EVP_PKEY_asn1_find_str(&e, nm, slen);
+ ameth = EVP_PKEY_asn1_find_str(NULL, nm, slen);
if (ameth) {
int r;
if (ameth->param_decode)
-/* $OpenBSD: rsa_local.h,v 1.6 2023/08/09 12:09:06 tb Exp $ */
+/* $OpenBSD: rsa_local.h,v 1.7 2023/11/29 21:35:57 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
long version;
const RSA_METHOD *meth;
- /* functional reference if 'meth' is ENGINE-provided */
- ENGINE *engine;
BIGNUM *n;
BIGNUM *e;
BIGNUM *d;