From: Dr. Stephen Henson Date: Wed, 24 Nov 2010 16:08:20 +0000 (+0000) Subject: add "missing" functions to copy EVP_PKEY_METHOD and examine info X-Git-Tag: OpenSSL-fips-2_0-rc1~917 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f830c68f4d205b37ae5e1a0ca732c33b7e8661c6;p=oweals%2Fopenssl.git add "missing" functions to copy EVP_PKEY_METHOD and examine info --- diff --git a/CHANGES b/CHANGES index f5351f857f..b8e18dc1e2 100644 --- a/CHANGES +++ b/CHANGES @@ -125,6 +125,9 @@ Changes between 1.0.0b and 1.0.1 [xx XXX xxxx] + *) Add functions to copy EVP_PKEY_METHOD and retrieve flags and id. + [Steve Henson] + *) Add EC_GFp_nistp224_method(), a 64-bit optimized implementation for elliptic curve NIST-P224 with constant-time single point multiplication on typical inputs. EC_GROUP_new_by_curve_name() will automatically use this diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index 30f3c752f5..4548e6ddda 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -1056,6 +1056,9 @@ void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type); EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags); +void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, + const EVP_PKEY_METHOD *meth); +void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src); void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth); int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth); diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index bc7c8305a0..9820f69b04 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -236,6 +236,56 @@ EVP_PKEY_METHOD* EVP_PKEY_meth_new(int id, int flags) return pmeth; } +void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags, + const EVP_PKEY_METHOD *meth) + { + if (ppkey_id) + *ppkey_id = meth->pkey_id; + if (pflags) + *pflags = meth->flags; + } + +void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src) + { + + dst->init = src->init; + dst->copy = src->copy; + dst->cleanup = src->cleanup; + + dst->paramgen_init = src->paramgen_init; + dst->paramgen = src->paramgen; + + dst->keygen_init = src->keygen_init; + dst->keygen = src->keygen; + + dst->sign_init = src->sign_init; + dst->sign = src->sign; + + dst->verify_init = src->verify_init; + dst->verify = src->verify; + + dst->verify_recover_init = src->verify_recover_init; + dst->verify_recover = src->verify_recover; + + dst->signctx_init = src->signctx_init; + dst->signctx = src->signctx; + + dst->verifyctx_init = src->verifyctx_init; + dst->verifyctx = src->verifyctx; + + dst->encrypt_init = src->encrypt_init; + dst->encrypt = src->encrypt; + + dst->decrypt_init = src->decrypt_init; + dst->decrypt = src->decrypt; + + dst->derive_init = src->derive_init; + dst->derive = src->derive; + + dst->ctrl = src->ctrl; + dst->ctrl_str = src->ctrl_str; + } + void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth) { if (pmeth && (pmeth->flags & EVP_PKEY_FLAG_DYNAMIC))