Blame SOURCES/Fix-FIPS-mode-support-and-build-with-OpenSSL-3.0.patch

831591
From df5d2572497f4cd7ab15144dbab99d0e01495127 Mon Sep 17 00:00:00 2001
831591
From: Ondrej Holy <oholy@redhat.com>
831591
Date: Wed, 12 May 2021 12:48:15 +0200
831591
Subject: [PATCH] Fix FIPS mode support and build with OpenSSL 3.0
831591
831591
FreeRDP fails to build with OpenSSL 3.0 because of usage of the `FIPS_mode`
831591
and `FIPS_mode_set` functions, which were removed there. Just a note that
831591
the FIPS mode is not supported by OpenSSL 1.1.* although the mentioned
831591
functions are still there (see https://wiki.openssl.org/index.php/FIPS_modules).
831591
Let's make FreeRDP build with OpenSSL 3.0 and fix the FIPS mode support.
831591
831591
See: https://bugzilla.redhat.com/show_bug.cgi?id=1952937
831591
---
831591
 winpr/libwinpr/utils/ssl.c | 8 ++++++++
831591
 1 file changed, 8 insertions(+)
831591
831591
diff --git a/winpr/libwinpr/utils/ssl.c b/winpr/libwinpr/utils/ssl.c
831591
index 3a8590390..03b23af43 100644
831591
--- a/winpr/libwinpr/utils/ssl.c
831591
+++ b/winpr/libwinpr/utils/ssl.c
831591
@@ -244,9 +244,17 @@ static BOOL winpr_enable_fips(DWORD flags)
831591
 #else
831591
 		WLog_DBG(TAG, "Ensuring openssl fips mode is ENabled");
831591
 
831591
+#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
831591
+		if (!EVP_default_properties_is_fips_enabled(NULL))
831591
+#else
831591
 		if (FIPS_mode() != 1)
831591
+#endif
831591
 		{
831591
+#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
831591
+			if (EVP_set_default_properties(NULL, "fips=yes"))
831591
+#else
831591
 			if (FIPS_mode_set(1))
831591
+#endif
831591
 				WLog_INFO(TAG, "Openssl fips mode ENabled!");
831591
 			else
831591
 			{
831591
-- 
831591
2.31.1
831591