Skip to content

Commit

Permalink
[CMake] Remove option BUILD_CRYPTO/ENABLE_CRYPTO
Browse files Browse the repository at this point in the history
The option ENABLE_CRYPTO cannot be disabled (XRootD fails to build).
Therefore, we remove it and make OpenSSL a required dependency.

Fixes #1827.
  • Loading branch information
amadio committed Feb 22, 2023
1 parent fb01136 commit 439af4a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 95 deletions.
2 changes: 0 additions & 2 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ is neither recommended nor supported.
* ENABLE_PERL - enable the perl bindings if possible (default: TRUE)
* ENABLE_FUSE - enable the fuse filesystem driver if possible
(default: TRUE)
* ENABLE_CRYPTO - enable the OpenSSL cryprography support (including
the X509 authentication) if possible (default: TRUE)
* ENABLE_KRB5 - enable the Kerberos 5 authentication if possible
(default: TRUE)
* ENABLE_READLINE - enable the lib readline support in the commandline
Expand Down
1 change: 0 additions & 1 deletion cmake/XRootDDefaults.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ include( CMakeDependentOption )

define_default( PLUGIN_VERSION 5 )
option( ENABLE_FUSE "Enable the fuse filesystem driver if possible." TRUE )
option( ENABLE_CRYPTO "Enable the OpenSSL cryprography support." TRUE )
option( ENABLE_KRB5 "Enable the Kerberos 5 authentication if possible." TRUE )
option( ENABLE_READLINE "Enable the lib readline support in the commandline utilities." TRUE )
option( ENABLE_XRDCL "Enable XRootD client." TRUE )
Expand Down
35 changes: 8 additions & 27 deletions cmake/XRootDFindLibs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,10 @@ endif()

find_package( CURL )

if( ENABLE_CRYPTO )
if( FORCE_ENABLED )
find_package( OpenSSL 1.0.2 REQUIRED )
else()
find_package( OpenSSL 1.0.2 )
endif()
if( OPENSSL_FOUND )
add_definitions( -DHAVE_DH_PADDED )
add_definitions( -DHAVE_XRDCRYPTO )
add_definitions( -DHAVE_SSL )
set( BUILD_CRYPTO TRUE )
else()
set( BUILD_CRYPTO FALSE )
endif()
endif()
find_package( OpenSSL 1.0.2 REQUIRED )
add_definitions( -DHAVE_DH_PADDED )
add_definitions( -DHAVE_XRDCRYPTO )
add_definitions( -DHAVE_SSL )

if( ENABLE_KRB5 )
if( FORCE_ENABLED )
Expand Down Expand Up @@ -95,21 +84,13 @@ if( ENABLE_TESTS )
endif()

if( ENABLE_HTTP )
if( OPENSSL_FOUND AND BUILD_CRYPTO )
set( BUILD_HTTP TRUE )
if( CURL_FOUND )
set( BUILD_TPC TRUE )
else()
if( FORCE_ENABLED )
message( FATAL_ERROR "Cannot build HttpTpc: missing CURL." )
endif()
set( BUILD_TPC FALSE )
endif()
set( BUILD_HTTP TRUE )
if( CURL_FOUND )
set( BUILD_TPC TRUE )
else()
if( FORCE_ENABLED )
message( FATAL_ERROR "Cannot build XrdHttp: missing OpenSSL." )
message( FATAL_ERROR "Cannot build HttpTpc: missing CURL." )
endif()
set( BUILD_HTTP FALSE )
set( BUILD_TPC FALSE )
endif()
endif()
Expand Down
1 change: 0 additions & 1 deletion cmake/XRootDSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
set( TRUE_VAR TRUE )
component_status( READLINE ENABLE_READLINE READLINE_FOUND )
component_status( FUSE BUILD_FUSE FUSE_FOUND )
component_status( CRYPTO BUILD_CRYPTO OPENSSL_FOUND )
component_status( KRB5 BUILD_KRB5 KERBEROS5_FOUND )
component_status( XRDCL ENABLE_XRDCL TRUE_VAR )
component_status( XRDCLHTTP ENABLE_XRDCLHTTP DAVIX_FOUND )
Expand Down
5 changes: 1 addition & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ include( XrdPosix )
include( XrdSec )
include( XrdXml )
include( XrdHeaders )

if( BUILD_CRYPTO )
include( XrdSecgsi )
endif()
include( XrdSecgsi )

if( BUILD_KRB5 )
include( XrdSeckrb5 )
Expand Down
86 changes: 38 additions & 48 deletions src/XrdCrypto.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,10 @@ add_library(
SHARED
${XrdCryptoLiteSources} )

if( BUILD_CRYPTO )
target_link_libraries(
XrdCryptoLite
XrdUtils
${OPENSSL_CRYPTO_LIBRARY} )
else()
target_link_libraries(
XrdCryptoLite
XrdUtils )
endif()
target_link_libraries(
XrdCryptoLite
XrdUtils
${OPENSSL_CRYPTO_LIBRARY} )

set_target_properties(
XrdCryptoLite
Expand All @@ -85,39 +79,37 @@ set_target_properties(
#-------------------------------------------------------------------------------
# The XrdCryptossl module
#-------------------------------------------------------------------------------
if( BUILD_CRYPTO )
include_directories( ${OPENSSL_INCLUDE_DIR} )

set( XrdCryptosslSources
XrdCrypto/XrdCryptosslAux.cc XrdCrypto/XrdCryptosslAux.hh
XrdCrypto/XrdCryptosslgsiAux.cc
XrdCrypto/XrdCryptosslCipher.cc XrdCrypto/XrdCryptosslCipher.hh
XrdCrypto/XrdCryptosslMsgDigest.cc XrdCrypto/XrdCryptosslMsgDigest.hh
XrdCrypto/XrdCryptosslRSA.cc XrdCrypto/XrdCryptosslRSA.hh
XrdCrypto/XrdCryptosslX509.cc XrdCrypto/XrdCryptosslX509.hh
XrdCrypto/XrdCryptosslX509Crl.cc XrdCrypto/XrdCryptosslX509Crl.hh
XrdCrypto/XrdCryptosslX509Req.cc XrdCrypto/XrdCryptosslX509Req.hh
XrdCrypto/XrdCryptosslTrace.hh
XrdCrypto/XrdCryptosslFactory.cc XrdCrypto/XrdCryptosslFactory.hh )

add_library(
${LIB_XRD_CRYPTOSSL}
MODULE
${XrdCryptosslSources} )

target_link_libraries(
${LIB_XRD_CRYPTOSSL}
XrdCrypto
XrdUtils
${CMAKE_THREAD_LIBS_INIT}
${OPENSSL_LIBRARIES} )

set_target_properties(
${LIB_XRD_CRYPTOSSL}
PROPERTIES
INTERFACE_LINK_LIBRARIES ""
LINK_INTERFACE_LIBRARIES "" )
endif()
include_directories( ${OPENSSL_INCLUDE_DIR} )

set( XrdCryptosslSources
XrdCrypto/XrdCryptosslAux.cc XrdCrypto/XrdCryptosslAux.hh
XrdCrypto/XrdCryptosslgsiAux.cc
XrdCrypto/XrdCryptosslCipher.cc XrdCrypto/XrdCryptosslCipher.hh
XrdCrypto/XrdCryptosslMsgDigest.cc XrdCrypto/XrdCryptosslMsgDigest.hh
XrdCrypto/XrdCryptosslRSA.cc XrdCrypto/XrdCryptosslRSA.hh
XrdCrypto/XrdCryptosslX509.cc XrdCrypto/XrdCryptosslX509.hh
XrdCrypto/XrdCryptosslX509Crl.cc XrdCrypto/XrdCryptosslX509Crl.hh
XrdCrypto/XrdCryptosslX509Req.cc XrdCrypto/XrdCryptosslX509Req.hh
XrdCrypto/XrdCryptosslTrace.hh
XrdCrypto/XrdCryptosslFactory.cc XrdCrypto/XrdCryptosslFactory.hh )

add_library(
${LIB_XRD_CRYPTOSSL}
MODULE
${XrdCryptosslSources} )

target_link_libraries(
${LIB_XRD_CRYPTOSSL}
XrdCrypto
XrdUtils
${CMAKE_THREAD_LIBS_INIT}
${OPENSSL_LIBRARIES} )

set_target_properties(
${LIB_XRD_CRYPTOSSL}
PROPERTIES
INTERFACE_LINK_LIBRARIES ""
LINK_INTERFACE_LIBRARIES "" )

#-------------------------------------------------------------------------------
# Install
Expand All @@ -126,11 +118,9 @@ install(
TARGETS XrdCrypto XrdCryptoLite
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )

if( BUILD_CRYPTO )
install(
TARGETS ${LIB_XRD_CRYPTOSSL}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
endif()
install(
TARGETS ${LIB_XRD_CRYPTOSSL}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
# FIXME: Unused files
#-rw-r--r-- 1 ljanyst ljanyst 16721 2011-03-21 16:13 XrdCryptotest.cc

Expand Down
17 changes: 5 additions & 12 deletions src/XrdSec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,11 @@ add_library(
MODULE
${XrdSecProtectSources} )

if( BUILD_CRYPTO )
target_link_libraries(
${LIB_XRD_SEC_PROT}
XrdUtils
${CMAKE_THREAD_LIBS_INIT}
${OPENSSL_CRYPTO_LIBRARY} )
else()
target_link_libraries(
${LIB_XRD_SEC_PROT}
XrdUtils
${CMAKE_THREAD_LIBS_INIT} )
endif()
target_link_libraries(
${LIB_XRD_SEC_PROT}
XrdUtils
${CMAKE_THREAD_LIBS_INIT}
${OPENSSL_CRYPTO_LIBRARY} )

set_target_properties(
${LIB_XRD_SEC_PROT}
Expand Down

0 comments on commit 439af4a

Please sign in to comment.