[crypto,key] use EVP_PKEY_up_ref
The function is available since OpenSSL 1.1.0 instead of 3.0 for EVP_PKEY_dup
This commit is contained in:
parent
1397f4c605
commit
1aa8c97a67
@ -42,6 +42,8 @@
|
||||
|
||||
#include <freerdp/crypto/privatekey.h>
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#include "x509_utils.h"
|
||||
#include "crypto.h"
|
||||
#include "opensslcompat.h"
|
||||
@ -233,9 +235,10 @@ rdpPrivateKey* freerdp_key_clone(const rdpPrivateKey* key)
|
||||
_key->isRSA = key->isRSA;
|
||||
if (key->evp)
|
||||
{
|
||||
_key->evp = EVP_PKEY_dup(key->evp);
|
||||
_key->evp = key->evp;
|
||||
if (!_key->evp)
|
||||
goto out_fail;
|
||||
EVP_PKEY_up_ref(_key->evp);
|
||||
}
|
||||
|
||||
if (key->PrivateExponent)
|
||||
@ -303,5 +306,8 @@ RSA* freerdp_key_get_RSA(const rdpPrivateKey* key)
|
||||
EVP_PKEY* freerdp_key_get_evp_pkey(const rdpPrivateKey* key)
|
||||
{
|
||||
WINPR_ASSERT(key);
|
||||
return key->evp;
|
||||
|
||||
EVP_PKEY* evp = key->evp;
|
||||
EVP_PKEY_up_ref(evp);
|
||||
return evp;
|
||||
}
|
||||
|
@ -35,7 +35,14 @@ extern "C"
|
||||
FREERDP_LOCAL const rdpCertInfo* freerdp_key_get_info(const rdpPrivateKey* key);
|
||||
FREERDP_LOCAL const BYTE* freerdp_key_get_exponent(const rdpPrivateKey* key, size_t* plength);
|
||||
|
||||
/** \brief returns a pointer to a RSA structure.
|
||||
* Call RSA_free when done.
|
||||
*/
|
||||
FREERDP_LOCAL RSA* freerdp_key_get_RSA(const rdpPrivateKey* key);
|
||||
|
||||
/** \brief returns a pointer to a EVP_PKEY structure.
|
||||
* Call EVP_PKEY_free when done.
|
||||
*/
|
||||
FREERDP_LOCAL EVP_PKEY* freerdp_key_get_evp_pkey(const rdpPrivateKey* key);
|
||||
|
||||
FREERDP_LOCAL extern const rdpPrivateKey* priv_key_tssk;
|
||||
|
Loading…
Reference in New Issue
Block a user