[Openvpn-devel,S] Change in openvpn[master]: crypto_openssl: Suppress deprecation warnings with OpenSSL 3 for GCC ...

Message ID 9c69a319f625bc0da974cfa599bef4076499f47c-HTML@gerrit.openvpn.net
State Changes Requested
Headers show
Series [Openvpn-devel,S] Change in openvpn[master]: crypto_openssl: Suppress deprecation warnings with OpenSSL 3 for GCC ... | expand

Commit Message

cron2 (Code Review) Sept. 6, 2024, 11:55 a.m. UTC
Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/735?usp=email

to review the following change.


Change subject: crypto_openssl: Suppress deprecation warnings with OpenSSL 3 for GCC as well
......................................................................

crypto_openssl: Suppress deprecation warnings with OpenSSL 3 for GCC as well

When a user explicitly wants to use OpenSSL engine support with
OpenSSL 3 (we will disable it by default), then allow them to use
-Werror.

We already had code for MSVC, add GCC as well.

Change-Id: I37a3a316027197ab336f05a0ee674310fc3df57d
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
---
M src/openvpn/crypto_openssl.c
1 file changed, 14 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/35/735/1

Patch

diff --git a/src/openvpn/crypto_openssl.c b/src/openvpn/crypto_openssl.c
index fbd38f3..295fd47 100644
--- a/src/openvpn/crypto_openssl.c
+++ b/src/openvpn/crypto_openssl.c
@@ -61,9 +61,14 @@ 
 #error Windows build with OPENSSL_NO_EC: disabling EC key is not supported.
 #endif
 
+#if HAVE_OPENSSL_ENGINE && OPENSSL_VERSION_NUMBER >= 0x30000000L
+/* mute ossl3 deprecation warnings */
 #ifdef _MSC_VER
-/* mute ossl3 deprecation warnings treated as errors in msvc */
 #pragma warning(disable: 4996)
+#else
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
 #endif
 
 /*
@@ -1454,4 +1459,12 @@ 
     return false;
 }
 #endif /* if LIBRESSL_VERSION_NUMBER */
+
+#if HAVE_OPENSSL_ENGINE && OPENSSL_VERSION_NUMBER >= 0x30000000L
+/* mute ossl3 deprecation warnings */
+#ifndef _MSC_VER
+#pragma GCC diagnostic pop
+#endif
+#endif
+
 #endif /* ENABLE_CRYPTO_OPENSSL */