You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by al...@apache.org on 2020/11/04 05:36:22 UTC

[kudu] 03/03: [server] fix compilation under RHEL/CentOS 6

This is an automated email from the ASF dual-hosted git repository.

alexey pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit dbbc48893a743bb5d96a7b17007450f1a94463cb
Author: Alexey Serbin <al...@apache.org>
AuthorDate: Tue Nov 3 18:39:18 2020 -0800

    [server] fix compilation under RHEL/CentOS 6
    
    It seems the version of the OpenSSL library used to work around
    versioned symbols in RHEL/CentOS 6.5+ doesn't contain declaration
    of FIPS_mode() function in openssl/crypto.h file.  That breaks the
    compilation after the introduction of the two changelist mentioned
    below.  This patch fixes the compilation breakage, adding
    openssl/fips.h header file when necessary.
    
    This is a follow-up to changelists 46231c52f and 6d2c79a4f.
    
    Change-Id: I3714365801f7de4e4768f4c4e2cf063ff5a65c57
    Reviewed-on: http://gerrit.cloudera.org:8080/16696
    Reviewed-by: Andrew Wong <aw...@cloudera.com>
    Tested-by: Kudu Jenkins
---
 CMakeLists.txt                    | 1 +
 src/kudu/security/openssl_util.cc | 3 +++
 src/kudu/server/webserver-test.cc | 4 ++++
 src/kudu/server/webserver.cc      | 4 ++++
 4 files changed, 12 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b5dcbd..5a3b607 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1067,6 +1067,7 @@ ADD_THIRDPARTY_LIB(mustache
 set(CENTOS_6_4_OPENSSL_DIR "${THIRDPARTY_INSTALL_DIR}/openssl-el6-workaround/usr/")
 if (NOT OPENSSL_ROOT_DIR AND EXISTS "${CENTOS_6_4_OPENSSL_DIR}")
   set(OPENSSL_ROOT_DIR "${CENTOS_6_4_OPENSSL_DIR}")
+  add_definitions("-DKUDU_OPENSSL_REQUIRE_FIPS_HEADER")
 endif()
 find_package(OpenSSL 1.0.0 REQUIRED)
 include_directories(SYSTEM ${OPENSSL_INCLUDE_DIR})
diff --git a/src/kudu/security/openssl_util.cc b/src/kudu/security/openssl_util.cc
index 7198db3..3604964 100644
--- a/src/kudu/security/openssl_util.cc
+++ b/src/kudu/security/openssl_util.cc
@@ -18,6 +18,9 @@
 #include "kudu/security/openssl_util.h"
 
 #include <openssl/crypto.h>
+#if defined(KUDU_OPENSSL_REQUIRE_FIPS_HEADER)
+#include <openssl/fips.h>
+#endif
 #include <openssl/err.h>
 #include <openssl/rand.h> // IWYU pragma: keep
 
diff --git a/src/kudu/server/webserver-test.cc b/src/kudu/server/webserver-test.cc
index 652b9a6..942bad8 100644
--- a/src/kudu/server/webserver-test.cc
+++ b/src/kudu/server/webserver-test.cc
@@ -17,7 +17,11 @@
 
 #include "kudu/server/webserver.h"
 
+#if defined(KUDU_OPENSSL_REQUIRE_FIPS_HEADER)
+#include <openssl/fips.h>
+#else
 #include <openssl/crypto.h>
+#endif
 
 #include <cstdlib>
 #include <functional>
diff --git a/src/kudu/server/webserver.cc b/src/kudu/server/webserver.cc
index 420984f..9e7202d 100644
--- a/src/kudu/server/webserver.cc
+++ b/src/kudu/server/webserver.cc
@@ -18,7 +18,11 @@
 #include "kudu/server/webserver.h"
 
 #include <netinet/in.h>
+#if defined(KUDU_OPENSSL_REQUIRE_FIPS_HEADER)
+#include <openssl/fips.h>
+#else
 #include <openssl/crypto.h>
+#endif
 #include <sys/socket.h>
 
 #include <algorithm>