projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
If EVP_PKEY structure contains an ENGINE the key is ENGINE specific and
[openssl.git]
/
crypto
/
evp
/
pmeth_lib.c
diff --git
a/crypto/evp/pmeth_lib.c
b/crypto/evp/pmeth_lib.c
index 072736719d4664ff5c7e0d68cf46991e5f51ed41..bc7c8305a0e160133446a44468336288e5e72d6f 100644
(file)
--- a/
crypto/evp/pmeth_lib.c
+++ b/
crypto/evp/pmeth_lib.c
@@
-1,5
+1,5
@@
/* pmeth_lib.c */
/* pmeth_lib.c */
-/* Written by Dr Stephen N Henson (s
henson@bigfoot.com
) for the OpenSSL
+/* Written by Dr Stephen N Henson (s
teve@openssl.org
) for the OpenSSL
* project 2006.
*/
/* ====================================================================
* project 2006.
*/
/* ====================================================================
@@
-73,15
+73,24
@@
DECLARE_STACK_OF(EVP_PKEY_METHOD)
STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL;
extern const EVP_PKEY_METHOD rsa_pkey_meth, dh_pkey_meth, dsa_pkey_meth;
STACK_OF(EVP_PKEY_METHOD) *app_pkey_methods = NULL;
extern const EVP_PKEY_METHOD rsa_pkey_meth, dh_pkey_meth, dsa_pkey_meth;
-extern const EVP_PKEY_METHOD ec_pkey_meth, hmac_pkey_meth;
+extern const EVP_PKEY_METHOD ec_pkey_meth, hmac_pkey_meth
, cmac_pkey_meth
;
static const EVP_PKEY_METHOD *standard_methods[] =
{
static const EVP_PKEY_METHOD *standard_methods[] =
{
+#ifndef OPENSSL_NO_RSA
&rsa_pkey_meth,
&rsa_pkey_meth,
+#endif
+#ifndef OPENSSL_NO_DH
&dh_pkey_meth,
&dh_pkey_meth,
+#endif
+#ifndef OPENSSL_NO_DSA
&dsa_pkey_meth,
&dsa_pkey_meth,
+#endif
+#ifndef OPENSSL_NO_EC
&ec_pkey_meth,
&ec_pkey_meth,
+#endif
&hmac_pkey_meth,
&hmac_pkey_meth,
+ &cmac_pkey_meth
};
DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *,
};
DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *,
@@
-125,6
+134,9
@@
static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
return NULL;
id = pkey->ameth->pkey_id;
}
return NULL;
id = pkey->ameth->pkey_id;
}
+#ifndef OPENSSL_NO_ENGINE
+ if (pkey && pkey->engine)
+ e = pkey->engine;
/* Try to find an ENGINE which implements this method */
if (e)
{
/* Try to find an ENGINE which implements this method */
if (e)
{
@@
-144,6
+156,7
@@
static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
if (e)
pmeth = ENGINE_get_pkey_meth(e, id);
else
if (e)
pmeth = ENGINE_get_pkey_meth(e, id);
else
+#endif
pmeth = EVP_PKEY_meth_find(id);
if (pmeth == NULL)
pmeth = EVP_PKEY_meth_find(id);
if (pmeth == NULL)
@@
-155,8
+168,10
@@
static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
if (!ret)
{
ret = OPENSSL_malloc(sizeof(EVP_PKEY_CTX));
if (!ret)
{
+#ifndef OPENSSL_NO_ENGINE
if (e)
ENGINE_finish(e);
if (e)
ENGINE_finish(e);
+#endif
EVPerr(EVP_F_INT_CTX_NEW,ERR_R_MALLOC_FAILURE);
return NULL;
}
EVPerr(EVP_F_INT_CTX_NEW,ERR_R_MALLOC_FAILURE);
return NULL;
}
@@
-165,6
+180,7
@@
static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id)
ret->operation = EVP_PKEY_OP_UNDEFINED;
ret->pkey = pkey;
ret->peerkey = NULL;
ret->operation = EVP_PKEY_OP_UNDEFINED;
ret->pkey = pkey;
ret->peerkey = NULL;
+ ret->pkey_gencb = 0;
if (pkey)
CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
ret->data = NULL;
if (pkey)
CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
ret->data = NULL;
@@
-492,11
+508,11
@@
void EVP_PKEY_meth_set_verifyctx(EVP_PKEY_METHOD *pmeth,
void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
int (*encrypt_init)(EVP_PKEY_CTX *ctx),
void EVP_PKEY_meth_set_encrypt(EVP_PKEY_METHOD *pmeth,
int (*encrypt_init)(EVP_PKEY_CTX *ctx),
- int (*encrypt)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
+ int (*encrypt
fn
)(EVP_PKEY_CTX *ctx, unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen))
{
pmeth->encrypt_init = encrypt_init;
const unsigned char *in, size_t inlen))
{
pmeth->encrypt_init = encrypt_init;
- pmeth->encrypt = encrypt;
+ pmeth->encrypt = encrypt
fn
;
}
void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,
}
void EVP_PKEY_meth_set_decrypt(EVP_PKEY_METHOD *pmeth,