A call to EVP_PKEY_CTX_new() creates a keymgmt pointer internally,
but EVP_PKEY_CTX_dup() does not copy this field.
Calling EVP_PKEY_derive_set_peer_ex() after EVP_PKEY_CTX_dup() resulted
in a segfault because it tried to access this pointer.
EVP_PKEY_CTX_dup() has been updated to copy the keymanager (and upref it).
Reported by Eamon ODea (Oracle).
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/27304)
(cherry picked from commit 3c22da73465f5dd211299e64f0de8786dcaf86c3)