Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Native support to move DSA to EVP_PKEY* only in PALEXPORTs
  • Loading branch information
bartonjs committed Jul 16, 2021
commit 7f54dd99be2ce3a9c87e5e9b80c1b6e2ddf645c7
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ set(NATIVECRYPTO_SOURCES
pal_asn1.c
pal_bignum.c
pal_bio.c
pal_dsa.c
pal_ecdsa.c
pal_ecc_import_export.c
pal_eckey.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,23 @@ int32_t local_DSA_set0_key(DSA* dsa, BIGNUM* bnY, BIGNUM* bnX)
return 1;
}

DSA* local_EVP_PKEY_get0_DSA(EVP_PKEY* pkey)
{
if (pkey == NULL)
{
return NULL;
}

DSA* dsa = EVP_PKEY_get1_DSA(pkey);

if (dsa != NULL)
{
DSA_free(dsa);
}

return dsa;
}

RSA* local_EVP_PKEY_get0_RSA(EVP_PKEY* pkey)
{
if (pkey == NULL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void local_EVP_CIPHER_CTX_free(EVP_CIPHER_CTX* ctx);
EVP_CIPHER_CTX* local_EVP_CIPHER_CTX_new(void);
int32_t local_EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX* ctx);
int local_EVP_PKEY_check(EVP_PKEY_CTX* ctx);
DSA* local_EVP_PKEY_get0_DSA(EVP_PKEY* pkey);
RSA* local_EVP_PKEY_get0_RSA(EVP_PKEY* pkey);
int local_EVP_PKEY_public_check(EVP_PKEY_CTX* ctx);
int32_t local_EVP_PKEY_up_ref(EVP_PKEY* pkey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "pal_asn1.h"
#include "pal_bignum.h"
#include "pal_bio.h"
#include "pal_dsa.h"
#include "pal_ecc_import_export.h"
#include "pal_ecdsa.h"
#include "pal_eckey.h"
Expand Down Expand Up @@ -61,15 +60,9 @@ static const Entry s_cryptoNative[] =
DllImportEntry(CryptoNative_DecodeX509)
DllImportEntry(CryptoNative_DecodeX509BasicConstraints2Extension)
DllImportEntry(CryptoNative_DecodeX509Crl)
DllImportEntry(CryptoNative_DsaDestroy)
DllImportEntry(CryptoNative_DsaGenerateKey)
DllImportEntry(CryptoNative_DsaKeyCreateByExplicitParameters)
DllImportEntry(CryptoNative_DsaSign)
DllImportEntry(CryptoNative_DsaSizeP)
DllImportEntry(CryptoNative_DsaSignHash)
DllImportEntry(CryptoNative_DsaSizeQ)
DllImportEntry(CryptoNative_DsaSizeSignature)
DllImportEntry(CryptoNative_DsaUpRef)
DllImportEntry(CryptoNative_DsaVerify)
DllImportEntry(CryptoNative_EcDsaSign)
DllImportEntry(CryptoNative_EcDsaSize)
DllImportEntry(CryptoNative_EcDsaVerify)
Expand Down Expand Up @@ -145,16 +138,16 @@ static const Entry s_cryptoNative[] =
DllImportEntry(CryptoNative_EvpMdCtxCreate)
DllImportEntry(CryptoNative_EvpMdCtxDestroy)
DllImportEntry(CryptoNative_EvpMdSize)
DllImportEntry(CryptoNative_EvpPKeyBits)
DllImportEntry(CryptoNative_EvpPkeyCreate)
DllImportEntry(CryptoNative_EvpPKeyCreateDsa)
DllImportEntry(CryptoNative_EvpPKeyCreateRsa)
DllImportEntry(CryptoNative_EvpPKeyCtxCreate)
DllImportEntry(CryptoNative_EvpPKeyCtxDestroy)
DllImportEntry(CryptoNative_EvpPKeyDeriveSecretAgreement)
DllImportEntry(CryptoNative_EvpPkeyDestroy)
DllImportEntry(CryptoNative_EvpPKeyDuplicate)
DllImportEntry(CryptoNative_EvpPkeyGetDsa)
DllImportEntry(CryptoNative_EvpPkeyGetEcKey)
DllImportEntry(CryptoNative_EvpPkeySetDsa)
DllImportEntry(CryptoNative_EvpPkeySetEcKey)
DllImportEntry(CryptoNative_EvpPKeySize)
DllImportEntry(CryptoNative_EvpRC2Cbc)
Expand All @@ -167,7 +160,6 @@ static const Entry s_cryptoNative[] =
DllImportEntry(CryptoNative_GetAsn1IntegerDerSize)
DllImportEntry(CryptoNative_GetAsn1StringBytes)
DllImportEntry(CryptoNative_GetBigNumBytes)
DllImportEntry(CryptoNative_GetDsaParameters)
DllImportEntry(CryptoNative_GetECCurveParameters)
DllImportEntry(CryptoNative_GetECKeyParameters)
DllImportEntry(CryptoNative_GetMaxMdSize)
Expand Down Expand Up @@ -235,6 +227,7 @@ static const Entry s_cryptoNative[] =
DllImportEntry(CryptoNative_RsaGenerateKey)
DllImportEntry(CryptoNative_RsaSignHash)
DllImportEntry(CryptoNative_RsaVerifyHash)
DllImportEntry(CryptoNative_SimpleVerifyHash)
DllImportEntry(CryptoNative_UpRefEvpPkey)
DllImportEntry(CryptoNative_X509ChainBuildOcspRequest)
DllImportEntry(CryptoNative_X509ChainGetCachedOcspStatus)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,18 @@ const EVP_CIPHER* EVP_chacha20_poly1305(void);
REQUIRED_FUNCTION(EVP_PKEY_encrypt_init) \
REQUIRED_FUNCTION(EVP_PKEY_free) \
RENAMED_FUNCTION(EVP_PKEY_get_base_id, EVP_PKEY_base_id) \
RENAMED_FUNCTION(EVP_PKEY_get_bits, EVP_PKEY_bits) \
RENAMED_FUNCTION(EVP_PKEY_get_size, EVP_PKEY_size) \
FALLBACK_FUNCTION(EVP_PKEY_get0_DSA) \
FALLBACK_FUNCTION(EVP_PKEY_get0_RSA) \
REQUIRED_FUNCTION(EVP_PKEY_get1_DSA) \
REQUIRED_FUNCTION(EVP_PKEY_get1_EC_KEY) \
REQUIRED_FUNCTION(EVP_PKEY_get1_RSA) \
REQUIRED_FUNCTION(EVP_PKEY_keygen) \
REQUIRED_FUNCTION(EVP_PKEY_keygen_init) \
REQUIRED_FUNCTION(EVP_PKEY_new) \
REQUIRED_FUNCTION(EVP_PKEY_paramgen) \
REQUIRED_FUNCTION(EVP_PKEY_paramgen_init) \
FALLBACK_FUNCTION(EVP_PKEY_public_check) \
REQUIRED_FUNCTION(EVP_PKEY_set1_DSA) \
REQUIRED_FUNCTION(EVP_PKEY_set1_EC_KEY) \
Expand Down Expand Up @@ -791,14 +795,18 @@ FOR_ALL_OPENSSL_FUNCTIONS
#define EVP_PKEY_encrypt EVP_PKEY_encrypt_ptr
#define EVP_PKEY_free EVP_PKEY_free_ptr
#define EVP_PKEY_get_base_id EVP_PKEY_get_base_id_ptr
#define EVP_PKEY_get_bits EVP_PKEY_get_bits_ptr
#define EVP_PKEY_get_size EVP_PKEY_get_size_ptr
#define EVP_PKEY_get0_DSA EVP_PKEY_get0_DSA_ptr
#define EVP_PKEY_get0_RSA EVP_PKEY_get0_RSA_ptr
#define EVP_PKEY_get1_DSA EVP_PKEY_get1_DSA_ptr
#define EVP_PKEY_get1_EC_KEY EVP_PKEY_get1_EC_KEY_ptr
#define EVP_PKEY_get1_RSA EVP_PKEY_get1_RSA_ptr
#define EVP_PKEY_keygen EVP_PKEY_keygen_ptr
#define EVP_PKEY_keygen_init EVP_PKEY_keygen_init_ptr
#define EVP_PKEY_new EVP_PKEY_new_ptr
#define EVP_PKEY_paramgen EVP_PKEY_paramgen_ptr
#define EVP_PKEY_paramgen_init EVP_PKEY_paramgen_init_ptr
#define EVP_PKEY_public_check EVP_PKEY_public_check_ptr
#define EVP_PKEY_set1_DSA EVP_PKEY_set1_DSA_ptr
#define EVP_PKEY_set1_EC_KEY EVP_PKEY_set1_EC_KEY_ptr
Expand Down Expand Up @@ -1106,6 +1114,7 @@ FOR_ALL_OPENSSL_FUNCTIONS
// Undo renames for renamed-in-3.0
#define EVP_MD_get_size EVP_MD_size
#define EVP_PKEY_get_base_id EVP_PKEY_base_id
#define EVP_PKEY_get_bits EVP_PKEY_bits
#define EVP_PKEY_get_size EVP_PKEY_size
#define SSL_get1_peer_certificate SSL_get_peer_certificate

Expand All @@ -1128,6 +1137,7 @@ FOR_ALL_OPENSSL_FUNCTIONS
#define EVP_CIPHER_CTX_new local_EVP_CIPHER_CTX_new
#define EVP_CIPHER_CTX_reset local_EVP_CIPHER_CTX_reset
#define EVP_PKEY_check local_EVP_PKEY_check
#define EVP_PKEY_get0_DSA local_EVP_PKEY_get0_DSA
#define EVP_PKEY_get0_RSA local_EVP_PKEY_get0_RSA
#define EVP_PKEY_public_check local_EVP_PKEY_public_check
#define EVP_PKEY_up_ref local_EVP_PKEY_up_ref
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ EVP_CIPHER_CTX* EVP_CIPHER_CTX_new(void);
int32_t EVP_CIPHER_CTX_reset(EVP_CIPHER_CTX* ctx);
void EVP_MD_CTX_free(EVP_MD_CTX* ctx);
EVP_MD_CTX* EVP_MD_CTX_new(void);
DSA* EVP_PKEY_get0_DSA(EVP_PKEY* pkey);
RSA* EVP_PKEY_get0_RSA(EVP_PKEY* pkey);
int EVP_PKEY_check(EVP_PKEY_CTX* ctx);
int EVP_PKEY_public_check(EVP_PKEY_CTX* ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX* ctx, int pad_mode);
int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX* ctx, int saltlen);
int EVP_PKEY_CTX_set_signature_md(EVP_PKEY_CTX* ctx, const EVP_MD* md);
int EVP_PKEY_get_base_id(const EVP_PKEY* pkey);
int EVP_PKEY_get_bits(const EVP_PKEY* pkey);
int EVP_PKEY_get_size(const EVP_PKEY* pkey);
OSSL_PROVIDER* OSSL_PROVIDER_try_load(OSSL_LIB_CTX* , const char* name, int retain_fallbacks);
X509* SSL_get1_peer_certificate(const SSL* ssl);
Loading