Fix missed fields in EVP_PKEY_meth_copy.
@@ -385,45 +385,14 @@ void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src)
{
+ int pkey_id = dst->pkey_id;
+ int flags = dst->flags;
- dst->init = src->init;
- dst->copy = src->copy;
- dst->cleanup = src->cleanup;
+ *dst = *src;
- 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;
-
- dst->check = src->check;
+ /* We only copy the function pointers so restore the other values */
+ dst->pkey_id = pkey_id;
+ dst->flags = flags;
}
void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth)
