141 lines
6.8 KiB
Diff
141 lines
6.8 KiB
Diff
From 05fb8ceb229d76ae32bd18e707b3682c8302490c Mon Sep 17 00:00:00 2001
|
|
From: Jeremy Barton <jbarton@microsoft.com>
|
|
Date: Tue, 13 Jul 2021 01:38:33 -0700
|
|
Subject: [PATCH 11/11] Adjust crypto shim for functions renamed for OSSL3
|
|
beta1
|
|
|
|
---
|
|
.../opensslshim.h | 15 +++++++++------
|
|
.../osslcompat_30.h | 3 +++
|
|
.../System.Security.Cryptography.Native/pal_evp.c | 2 +-
|
|
.../pal_evp_pkey.c | 2 +-
|
|
4 files changed, 14 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h b/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h
|
|
index c11285e7dd..b3386d381f 100644
|
|
--- a/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h
|
|
+++ b/src/Native/Unix/System.Security.Cryptography.Native/opensslshim.h
|
|
@@ -292,7 +292,7 @@ void SSL_get0_alpn_selected(const SSL* ssl, const unsigned char** protocol, unsi
|
|
REQUIRED_FUNCTION(EVP_md5) \
|
|
RENAMED_FUNCTION(EVP_MD_CTX_free, EVP_MD_CTX_destroy) \
|
|
RENAMED_FUNCTION(EVP_MD_CTX_new, EVP_MD_CTX_create) \
|
|
- REQUIRED_FUNCTION(EVP_MD_size) \
|
|
+ RENAMED_FUNCTION(EVP_MD_get_size, EVP_MD_size) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_CTX_ctrl) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_CTX_free) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_CTX_get0_pkey) \
|
|
@@ -303,13 +303,14 @@ void SSL_get0_alpn_selected(const SSL* ssl, const unsigned char** protocol, unsi
|
|
FALLBACK_FUNCTION(EVP_PKEY_CTX_set_rsa_padding) \
|
|
FALLBACK_FUNCTION(EVP_PKEY_CTX_set_rsa_pss_saltlen) \
|
|
FALLBACK_FUNCTION(EVP_PKEY_CTX_set_signature_md) \
|
|
- REQUIRED_FUNCTION(EVP_PKEY_base_id) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_decrypt) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_decrypt_init) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_derive_set_peer) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_derive_init) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_derive) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_free) \
|
|
+ RENAMED_FUNCTION(EVP_PKEY_get_base_id, EVP_PKEY_base_id) \
|
|
+ RENAMED_FUNCTION(EVP_PKEY_get_size, EVP_PKEY_size) \
|
|
FALLBACK_FUNCTION(EVP_PKEY_get0_RSA) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_get1_DSA) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_get1_EC_KEY) \
|
|
@@ -322,7 +323,6 @@ void SSL_get0_alpn_selected(const SSL* ssl, const unsigned char** protocol, unsi
|
|
REQUIRED_FUNCTION(EVP_PKEY_set1_RSA) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_sign) \
|
|
REQUIRED_FUNCTION(EVP_PKEY_sign_init) \
|
|
- REQUIRED_FUNCTION(EVP_PKEY_size) \
|
|
FALLBACK_FUNCTION(EVP_PKEY_up_ref) \
|
|
REQUIRED_FUNCTION(EVP_rc2_cbc) \
|
|
REQUIRED_FUNCTION(EVP_rc2_ecb) \
|
|
@@ -699,7 +699,7 @@ FOR_ALL_OPENSSL_FUNCTIONS
|
|
#define EVP_md5 EVP_md5_ptr
|
|
#define EVP_MD_CTX_free EVP_MD_CTX_free_ptr
|
|
#define EVP_MD_CTX_new EVP_MD_CTX_new_ptr
|
|
-#define EVP_MD_size EVP_MD_size_ptr
|
|
+#define EVP_MD_get_size EVP_MD_get_size_ptr
|
|
#define EVP_PKEY_CTX_ctrl EVP_PKEY_CTX_ctrl_ptr
|
|
#define EVP_PKEY_CTX_free EVP_PKEY_CTX_free_ptr
|
|
#define EVP_PKEY_CTX_get0_pkey EVP_PKEY_CTX_get0_pkey_ptr
|
|
@@ -710,13 +710,14 @@ FOR_ALL_OPENSSL_FUNCTIONS
|
|
#define EVP_PKEY_CTX_set_rsa_padding EVP_PKEY_CTX_set_rsa_padding_ptr
|
|
#define EVP_PKEY_CTX_set_rsa_pss_saltlen EVP_PKEY_CTX_set_rsa_pss_saltlen_ptr
|
|
#define EVP_PKEY_CTX_set_signature_md EVP_PKEY_CTX_set_signature_md_ptr
|
|
-#define EVP_PKEY_base_id EVP_PKEY_base_id_ptr
|
|
#define EVP_PKEY_decrypt_init EVP_PKEY_decrypt_init_ptr
|
|
#define EVP_PKEY_decrypt EVP_PKEY_decrypt_ptr
|
|
#define EVP_PKEY_derive_set_peer EVP_PKEY_derive_set_peer_ptr
|
|
#define EVP_PKEY_derive_init EVP_PKEY_derive_init_ptr
|
|
#define EVP_PKEY_derive EVP_PKEY_derive_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_size EVP_PKEY_get_size_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
|
|
@@ -729,7 +730,6 @@ FOR_ALL_OPENSSL_FUNCTIONS
|
|
#define EVP_PKEY_set1_RSA EVP_PKEY_set1_RSA_ptr
|
|
#define EVP_PKEY_sign_init EVP_PKEY_sign_init_ptr
|
|
#define EVP_PKEY_sign EVP_PKEY_sign_ptr
|
|
-#define EVP_PKEY_size EVP_PKEY_size_ptr
|
|
#define EVP_PKEY_up_ref EVP_PKEY_up_ref_ptr
|
|
#define EVP_rc2_cbc EVP_rc2_cbc_ptr
|
|
#define EVP_rc2_ecb EVP_rc2_ecb_ptr
|
|
@@ -1006,6 +1006,9 @@ FOR_ALL_OPENSSL_FUNCTIONS
|
|
#if OPENSSL_VERSION_NUMBER < OPENSSL_VERSION_3_0_RTM
|
|
|
|
// 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_size EVP_PKEY_size
|
|
#define SSL_get1_peer_certificate SSL_get_peer_certificate
|
|
|
|
#endif
|
|
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h b/src/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h
|
|
index bb529df51e..dba69f1382 100644
|
|
--- a/src/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h
|
|
+++ b/src/Native/Unix/System.Security.Cryptography.Native/osslcompat_30.h
|
|
@@ -19,10 +19,13 @@ void ERR_new(void);
|
|
void ERR_set_debug(const char *file, int line, const char *func);
|
|
void ERR_set_error(int lib, int reason, const char *fmt, ...);
|
|
int EVP_CIPHER_CTX_get_original_iv(EVP_CIPHER_CTX *ctx, void *buf, size_t len);
|
|
+int EVP_MD_get_size(const EVP_MD* md);
|
|
int EVP_PKEY_CTX_set_rsa_keygen_bits(EVP_PKEY_CTX* ctx, int bits);
|
|
int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX* ctx, const EVP_MD* md);
|
|
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_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);
|
|
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/pal_evp.c b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp.c
|
|
index 9665ffe3fa..5ec3c63122 100644
|
|
--- a/src/Native/Unix/System.Security.Cryptography.Native/pal_evp.c
|
|
+++ b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp.c
|
|
@@ -59,7 +59,7 @@ int32_t CryptoNative_EvpDigestFinalEx(EVP_MD_CTX* ctx, uint8_t* md, uint32_t* s)
|
|
|
|
int32_t CryptoNative_EvpMdSize(const EVP_MD* md)
|
|
{
|
|
- return EVP_MD_size(md);
|
|
+ return EVP_MD_get_size(md);
|
|
}
|
|
|
|
const EVP_MD* CryptoNative_EvpMd5()
|
|
diff --git a/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c
|
|
index f232b382ea..67410bc4e8 100644
|
|
--- a/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c
|
|
+++ b/src/Native/Unix/System.Security.Cryptography.Native/pal_evp_pkey.c
|
|
@@ -21,7 +21,7 @@ void CryptoNative_EvpPkeyDestroy(EVP_PKEY* pkey)
|
|
int32_t CryptoNative_EvpPKeySize(EVP_PKEY* pkey)
|
|
{
|
|
assert(pkey != NULL);
|
|
- return EVP_PKEY_size(pkey);
|
|
+ return EVP_PKEY_get_size(pkey);
|
|
}
|
|
|
|
int32_t CryptoNative_UpRefEvpPkey(EVP_PKEY* pkey)
|
|
--
|
|
2.31.1
|
|
|