diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2006-04-07 17:28:56 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2006-04-07 17:28:56 +0000 |
commit | cd7638980a2c2b16bb121bcb2ea8cc3cb03afcc1 (patch) | |
tree | abb202eb379913728f323d7f60614103bd41333e /crypto/evp/pmeth_lib.c | |
parent | f733a5ef0ede95494996ebef63e2a04bdc963230 (diff) |
Include EVP_PKEY argument in EVP_PKEY_CTX_new(). This avoids the
need for a separate EVP_PKEY parameter in the other operation
initialization routines.
Diffstat (limited to 'crypto/evp/pmeth_lib.c')
-rw-r--r-- | crypto/evp/pmeth_lib.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index d229b0996d..0c0aa9ba53 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -61,6 +61,7 @@ #include <openssl/objects.h> #include "cryptlib.h" #include <openssl/evp.h> +#include "asn1_locl.h" #include "evp_locl.h" STACK *app_pkey_methods = NULL; @@ -100,17 +101,20 @@ const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type, ENGINE *e) return *ret; } -EVP_PKEY_CTX *EVP_PKEY_CTX_new(int ktype, ENGINE *e) +EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey) { EVP_PKEY_CTX *ret; const EVP_PKEY_METHOD *pmeth; - pmeth = EVP_PKEY_meth_find(ktype, e); + if (!pkey || !pkey->ameth) + return NULL; + pmeth = EVP_PKEY_meth_find(pkey->ameth->pkey_id, NULL); if (pmeth == NULL) return NULL; ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX)); ret->pmeth = pmeth; ret->operation = EVP_PKEY_OP_UNDEFINED; - ret->pkey = NULL; + CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY); + ret->pkey = pkey; ret->data = NULL; if (pmeth->init) |