Remove OpenSSL warnings ignore
If we include OpenSSL in extern "C" blocks consistently, c++ warnings no
longer appear. This means we can remove the special case from meson.
Tested: Code compiles when built locally on an ubuntu 22.04 system.
Change-Id: I5add4113b32cd88b7fdd874174c845425a7c287a
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/http/mutual_tls.hpp b/http/mutual_tls.hpp
index 1620054..9f9f82b 100644
--- a/http/mutual_tls.hpp
+++ b/http/mutual_tls.hpp
@@ -4,8 +4,11 @@
#include "mutual_tls_meta.hpp"
#include "persistent_data.hpp"
+extern "C"
+{
#include <openssl/crypto.h>
#include <openssl/ssl.h>
+}
#include <boost/asio/ip/address.hpp>
#include <boost/asio/ssl/verify_context.hpp>
diff --git a/http/utility.hpp b/http/utility.hpp
index 5a2dc67..1d67500 100644
--- a/http/utility.hpp
+++ b/http/utility.hpp
@@ -2,7 +2,10 @@
#include "bmcweb_config.h"
+extern "C"
+{
#include <openssl/crypto.h>
+}
#include <boost/callable_traits.hpp>
#include <boost/url/parse.hpp>
diff --git a/include/ossl_random.hpp b/include/ossl_random.hpp
index b392410..0e28944 100644
--- a/include/ossl_random.hpp
+++ b/include/ossl_random.hpp
@@ -2,7 +2,10 @@
#include "logging.hpp"
+extern "C"
+{
#include <openssl/rand.h>
+}
#include <iostream>
#include <limits>
diff --git a/include/ssl_key_handler.hpp b/include/ssl_key_handler.hpp
index d12fcab..d7255dd 100644
--- a/include/ssl_key_handler.hpp
+++ b/include/ssl_key_handler.hpp
@@ -8,7 +8,6 @@
extern "C"
{
#include <nghttp2/nghttp2.h>
-}
#include <openssl/bio.h>
#include <openssl/dh.h>
#include <openssl/dsa.h>
@@ -18,6 +17,7 @@
#include <openssl/rand.h>
#include <openssl/rsa.h>
#include <openssl/ssl.h>
+}
#include <boost/asio/ssl/context.hpp>
diff --git a/meson.build b/meson.build
index 1665946..5ffc18c 100644
--- a/meson.build
+++ b/meson.build
@@ -265,11 +265,6 @@
)
openssl = openssl_proj.get_variable('openssl_dep')
openssl = openssl.as_system('system')
-else
- # When we build openssl as a subproject, the warnings analyzer starts
- # flagging all the C macros as old style casts, so only enable the
- # warning for non subprojects.
- add_project_arguments('-Wold-style-cast', language: 'cpp')
endif
bmcweb_dependencies += [openssl]
diff --git a/test/http/mutual_tls.cpp b/test/http/mutual_tls.cpp
index be8b651..9d964bf 100644
--- a/test/http/mutual_tls.cpp
+++ b/test/http/mutual_tls.cpp
@@ -2,6 +2,8 @@
#include "sessions.hpp"
+extern "C"
+{
#include <openssl/asn1.h>
#include <openssl/ec.h>
#include <openssl/evp.h>
@@ -10,6 +12,7 @@
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include <openssl/x509v3.h>
+}
#include <boost/asio/ip/address.hpp>
#include <boost/asio/ssl/verify_context.hpp>