File u_OpenSSL3.0-support.patch of Package python-uamqp.32795
From d9fca37b925e8087e26e4fd15924b02445df3df3 Mon Sep 17 00:00:00 2001
From: Kashif Khan <kashifkhan@microsoft.com>
Date: Fri, 27 Jan 2023 14:32:34 -0600
Subject: [PATCH] update c module for openssl 3
---
.../deps/azure-c-shared-utility/CMakeLists.txt | 12 ++++++++++++
.../azure-c-shared-utility/adapters/tlsio_openssl.c | 4 ++--
.../azure-c-shared-utility/adapters/x509_openssl.c | 2 +-
3 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/CMakeLists.txt b/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/CMakeLists.txt
index 5101951..87bff19 100644
--- a/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/CMakeLists.txt
+++ b/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/CMakeLists.txt
@@ -448,6 +448,18 @@ endif()
FILE(GLOB aziotsharedutil_md_files "devdoc/*.md")
SOURCE_GROUP(devdoc FILES ${aziotsharedutil_md_files})
+# Add ignore deprecated functions so we may use 1.1.1 APIs
+# in OpenSSL 3
+if(LINUX)
+ set_property(
+ SOURCE
+ ${CMAKE_CURRENT_LIST_DIR}/adapters/tlsio_openssl.c
+ ${CMAKE_CURRENT_LIST_DIR}/adapters/x509_openssl.c
+ PROPERTY COMPILE_OPTIONS
+ -Wno-deprecated-declarations
+ )
+endif()
+
#this is the product (a library)
add_library(aziotsharedutil ${source_c_files} ${source_h_files} ${aziotsharedutil_md_files})
setTargetBuildProperties(aziotsharedutil)
diff --git a/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/tlsio_openssl.c b/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/tlsio_openssl.c
index 4a3df84..1832994 100644
--- a/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/tlsio_openssl.c
+++ b/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/tlsio_openssl.c
@@ -953,7 +953,7 @@ static int add_certificate_to_store(TLS_IO_INSTANCE* tls_io_instance, const char
}
else
{
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && (OPENSSL_VERSION_NUMBER < 0x20000000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
const BIO_METHOD* bio_method;
#else
BIO_METHOD* bio_method;
@@ -1238,7 +1238,7 @@ void tlsio_openssl_deinit(void)
{
openssl_dynamic_locks_uninstall();
openssl_static_locks_uninstall();
-#if (OPENSSL_VERSION_NUMBER >= 0x00907000L) && (OPENSSL_VERSION_NUMBER < 0x20000000L) && (FIPS_mode_set)
+#if (OPENSSL_VERSION_NUMBER >= 0x00907000L) && (FIPS_mode_set)
FIPS_mode_set(0);
#endif
CRYPTO_set_locking_callback(NULL);
diff --git a/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/x509_openssl.c b/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/x509_openssl.c
index 5a9e5ac..12107ff 100644
--- a/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/x509_openssl.c
+++ b/src/vendor/azure-uamqp-c/deps/azure-c-shared-utility/adapters/x509_openssl.c
@@ -75,7 +75,7 @@ static int load_certificate_chain(SSL_CTX* ssl_ctx, const char* certificate)
// certificates.
/* Codes_SRS_X509_OPENSSL_07_006: [ If successful x509_openssl_add_ecc_credentials shall to import each certificate in the cert chain. ] */
-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && (OPENSSL_VERSION_NUMBER < 0x20000000L)
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
SSL_CTX_clear_extra_chain_certs(ssl_ctx);
#else
if (ssl_ctx->extra_certs != NULL)
--
2.43.2