From 65d1a36e6dcddf8ab2bf24ad072bbd26753c4a4e Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 26 Jun 2023 20:00:35 -0500 Subject: [PATCH] Merge libtps.so into tpsclient The libtps.so is used exclusively by tpsclient so it's no longer necessary to keep it as a shared library. --- .../src/main/native/tpsclient/CMakeLists.txt | 115 ++++++++++++++++- .../main/native/tpsclient/src/CMakeLists.txt | 119 ------------------ .../native/tpsclient/tools/CMakeLists.txt | 1 - .../tpsclient/tools/raclient/CMakeLists.txt | 38 ------ build.sh | 3 +- pki.spec | 1 - 6 files changed, 114 insertions(+), 163 deletions(-) delete mode 100644 base/tools/src/main/native/tpsclient/src/CMakeLists.txt delete mode 100644 base/tools/src/main/native/tpsclient/tools/CMakeLists.txt delete mode 100644 base/tools/src/main/native/tpsclient/tools/raclient/CMakeLists.txt diff --git a/base/tools/src/main/native/tpsclient/CMakeLists.txt b/base/tools/src/main/native/tpsclient/CMakeLists.txt index 0c10188d312..5fdcc25f86e 100644 --- a/base/tools/src/main/native/tpsclient/CMakeLists.txt +++ b/base/tools/src/main/native/tpsclient/CMakeLists.txt @@ -36,8 +36,111 @@ SET(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}/tps") # which point to directories outside the build tree to the install RPATH SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) -add_subdirectory(src) -add_subdirectory(tools) +find_library(ZLIB_LIBRARY + NAMES + z + PATHS + /usr/lib + /usr/lib64 + /usr/local/lib + /opt/local/lib + /sw/lib +) + +set(TPS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/include) + +set(TPS_PUBLIC_INCLUDE_DIRS + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + ${TPS_INCLUDE_DIR} + CACHE INTERNAL "TPS public include directories" +) + +set(TPS_PRIVATE_INCLUDE_DIRS + ${TPS_PUBLIC_INCLUDE_DIRS} + ${CMAKE_BINARY_DIR} + ${NSPR_INCLUDE_DIRS} + ${NSS_INCLUDE_DIRS} + ${APR_INCLUDE_DIRS} + ${LDAP_INCLUDE_DIRS} +) + +set(tpsclient_SRCS + src/main/Buffer.cpp + src/main/NameValueSet.cpp + src/main/Util.cpp + src/main/RA_Msg.cpp + src/main/Memory.cpp + src/main/AuthParams.cpp + src/apdu/APDU.cpp + src/apdu/Unblock_Pin_APDU.cpp + src/apdu/Create_Object_APDU.cpp + src/apdu/Set_Pin_APDU.cpp + src/apdu/Set_IssuerInfo_APDU.cpp + src/apdu/Get_IssuerInfo_APDU.cpp + src/apdu/Create_Pin_APDU.cpp + src/apdu/List_Pins_APDU.cpp + src/apdu/Initialize_Update_APDU.cpp + src/apdu/Get_Version_APDU.cpp + src/apdu/Get_Status_APDU.cpp + src/apdu/Get_Data_APDU.cpp + src/apdu/External_Authenticate_APDU.cpp + src/apdu/Generate_Key_APDU.cpp + src/apdu/Generate_Key_ECC_APDU.cpp + src/apdu/Read_Buffer_APDU.cpp + src/apdu/Read_Object_APDU.cpp + src/apdu/Write_Object_APDU.cpp + src/apdu/Put_Key_APDU.cpp + src/apdu/Select_APDU.cpp + src/apdu/Delete_File_APDU.cpp + src/apdu/Install_Applet_APDU.cpp + src/apdu/Format_Muscle_Applet_APDU.cpp + src/apdu/Load_File_APDU.cpp + src/apdu/Install_Load_APDU.cpp + src/apdu/Lifecycle_APDU.cpp + src/apdu/List_Objects_APDU.cpp + src/apdu/Import_Key_APDU.cpp + src/apdu/Import_Key_Enc_APDU.cpp + src/apdu/APDU_Response.cpp + src/apdu/Get_Lifecycle_APDU.cpp + src/msg/RA_Begin_Op_Msg.cpp + src/msg/RA_End_Op_Msg.cpp + src/msg/RA_Login_Request_Msg.cpp + src/msg/RA_Login_Response_Msg.cpp + src/msg/RA_SecureId_Request_Msg.cpp + src/msg/RA_SecureId_Response_Msg.cpp + src/msg/RA_ASQ_Request_Msg.cpp + src/msg/RA_ASQ_Response_Msg.cpp + src/msg/RA_New_Pin_Request_Msg.cpp + src/msg/RA_New_Pin_Response_Msg.cpp + src/msg/RA_Token_PDU_Request_Msg.cpp + src/msg/RA_Token_PDU_Response_Msg.cpp + src/msg/RA_Status_Update_Request_Msg.cpp + src/msg/RA_Status_Update_Response_Msg.cpp + src/msg/RA_Extended_Login_Request_Msg.cpp + src/msg/RA_Extended_Login_Response_Msg.cpp + tools/raclient/RA_Client.cpp + tools/raclient/RA_Conn.cpp + tools/raclient/RA_Token.cpp +) + +set(TPS_EXECUTABLE + tpsclient + CACHE INTERNAL "tpsclient executable" +) + +set(TPS_LINK_LIBRARIES + ${NSPR_LIBRARIES} + ${NSS_LIBRARIES} + ${APR_LIBRARIES} + ${LDAP_LIBRARIES} + ${ZLIB_LIBRARY} +) + +include_directories(${TPS_PRIVATE_INCLUDE_DIRS}) + +add_executable(${TPS_EXECUTABLE} ${tpsclient_SRCS}) +target_link_libraries(${TPS_EXECUTABLE} ${TPS_LINK_LIBRARIES}) add_custom_target(tpsclient-man ALL COMMENT "Creating PKI server manuals") @@ -48,6 +151,14 @@ add_custom_command( COMMAND go-md2man -in ${CMAKE_SOURCE_DIR}/docs/manuals/man1/tpsclient.1.md -out man/man1/tpsclient.1 ) +install( + TARGETS + ${TPS_EXECUTABLE} + RUNTIME DESTINATION ${BIN_INSTALL_DIR} + LIBRARY DESTINATION ${LIB_INSTALL_DIR}/tps + ARCHIVE DESTINATION ${LIB_INSTALL_DIR}/tps +) + install( DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/man/ diff --git a/base/tools/src/main/native/tpsclient/src/CMakeLists.txt b/base/tools/src/main/native/tpsclient/src/CMakeLists.txt deleted file mode 100644 index 55d2734b02d..00000000000 --- a/base/tools/src/main/native/tpsclient/src/CMakeLists.txt +++ /dev/null @@ -1,119 +0,0 @@ -project(tps_library CXX) - -set(TPS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) - -set(TPS_PUBLIC_INCLUDE_DIRS - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR} - ${TPS_INCLUDE_DIR} - CACHE INTERNAL "tps public include directories" -) - -set(TPS_PRIVATE_INCLUDE_DIRS - ${TPS_PUBLIC_INCLUDE_DIRS} - ${CMAKE_BINARY_DIR} - ${NSS_INCLUDE_DIRS} - ${NSPR_INCLUDE_DIRS} - ${APR_INCLUDE_DIRS} - ${LDAP_INCLUDE_DIRS} -) - -set(TPS_SHARED_LIBRARY - tps_library - CACHE INTERNAL "tps shared library" -) - -find_library(ZLIB_LIBRARY - NAMES - z - PATHS - /usr/lib - /usr/lib64 - /usr/local/lib - /opt/local/lib - /sw/lib -) - -set(TPS_LINK_LIBRARIES - ${NSPR_LIBRARIES} - ${NSS_LIBRARIES} - ${APR_LIBRARIES} - ${LDAP_LIBRARIES} - ${TOKENDB_SHARED_LIBRARY} - ${ZLIB_LIBRARY} -) - -set(tps_library_SRCS - main/Buffer.cpp - main/NameValueSet.cpp - main/Util.cpp - main/RA_Msg.cpp - main/Memory.cpp - main/AuthParams.cpp - apdu/APDU.cpp - apdu/Unblock_Pin_APDU.cpp - apdu/Create_Object_APDU.cpp - apdu/Set_Pin_APDU.cpp - apdu/Set_IssuerInfo_APDU.cpp - apdu/Get_IssuerInfo_APDU.cpp - apdu/Create_Pin_APDU.cpp - apdu/List_Pins_APDU.cpp - apdu/Initialize_Update_APDU.cpp - apdu/Get_Version_APDU.cpp - apdu/Get_Status_APDU.cpp - apdu/Get_Data_APDU.cpp - apdu/External_Authenticate_APDU.cpp - apdu/Generate_Key_APDU.cpp - apdu/Generate_Key_ECC_APDU.cpp - apdu/Read_Buffer_APDU.cpp - apdu/Read_Object_APDU.cpp - apdu/Write_Object_APDU.cpp - apdu/Put_Key_APDU.cpp - apdu/Select_APDU.cpp - apdu/Delete_File_APDU.cpp - apdu/Install_Applet_APDU.cpp - apdu/Format_Muscle_Applet_APDU.cpp - apdu/Load_File_APDU.cpp - apdu/Install_Load_APDU.cpp - apdu/Lifecycle_APDU.cpp - apdu/List_Objects_APDU.cpp - apdu/Import_Key_APDU.cpp - apdu/Import_Key_Enc_APDU.cpp - apdu/APDU_Response.cpp - apdu/Get_Lifecycle_APDU.cpp - msg/RA_Begin_Op_Msg.cpp - msg/RA_End_Op_Msg.cpp - msg/RA_Login_Request_Msg.cpp - msg/RA_Login_Response_Msg.cpp - msg/RA_SecureId_Request_Msg.cpp - msg/RA_SecureId_Response_Msg.cpp - msg/RA_ASQ_Request_Msg.cpp - msg/RA_ASQ_Response_Msg.cpp - msg/RA_New_Pin_Request_Msg.cpp - msg/RA_New_Pin_Response_Msg.cpp - msg/RA_Token_PDU_Request_Msg.cpp - msg/RA_Token_PDU_Response_Msg.cpp - msg/RA_Status_Update_Request_Msg.cpp - msg/RA_Status_Update_Response_Msg.cpp - msg/RA_Extended_Login_Request_Msg.cpp - msg/RA_Extended_Login_Response_Msg.cpp -) - -include_directories(${TPS_PRIVATE_INCLUDE_DIRS}) - -add_library(${TPS_SHARED_LIBRARY} SHARED ${tps_library_SRCS}) -target_link_libraries(${TPS_SHARED_LIBRARY} ${TPS_LINK_LIBRARIES}) - -set_target_properties( - ${TPS_SHARED_LIBRARY} - PROPERTIES - OUTPUT_NAME - tps -) - -install( - TARGETS - ${TPS_SHARED_LIBRARY} - LIBRARY DESTINATION ${LIB_INSTALL_DIR}/tps -) - diff --git a/base/tools/src/main/native/tpsclient/tools/CMakeLists.txt b/base/tools/src/main/native/tpsclient/tools/CMakeLists.txt deleted file mode 100644 index 6ed05c43d88..00000000000 --- a/base/tools/src/main/native/tpsclient/tools/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(raclient) diff --git a/base/tools/src/main/native/tpsclient/tools/raclient/CMakeLists.txt b/base/tools/src/main/native/tpsclient/tools/raclient/CMakeLists.txt deleted file mode 100644 index 33dfe6a1679..00000000000 --- a/base/tools/src/main/native/tpsclient/tools/raclient/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -project(tpsclient CXX) - -set(TPS_PRIVATE_INCLUDE_DIRS - ${TPS_PUBLIC_INCLUDE_DIRS} - ${CMAKE_BINARY_DIR} - ${NSPR_INCLUDE_DIRS} - ${NSS_INCLUDE_DIRS} -) - -set(TPS_EXECUTABLE - tpsclient - CACHE INTERNAL "tpsclient executable" -) - -set(TPS_LINK_LIBRARIES - ${TPS_SHARED_LIBRARY} - ${NSPR_LIBRARIES} - ${NSS_LIBRARIES} -) - -set(tpsclient_SRCS - RA_Client.cpp - RA_Conn.cpp - RA_Token.cpp -) - -include_directories(${TPS_PRIVATE_INCLUDE_DIRS}) - -add_executable(${TPS_EXECUTABLE} ${tpsclient_SRCS}) -target_link_libraries(${TPS_EXECUTABLE} ${TPS_LINK_LIBRARIES}) - -install( - TARGETS - ${TPS_EXECUTABLE} - RUNTIME DESTINATION ${BIN_INSTALL_DIR} - LIBRARY DESTINATION ${LIB_INSTALL_DIR}/tps - ARCHIVE DESTINATION ${LIB_INSTALL_DIR}/tps -) diff --git a/build.sh b/build.sh index 0f9aa0da848..482363762d6 100755 --- a/build.sh +++ b/build.sh @@ -748,8 +748,7 @@ if [ "$BUILD_TARGET" = "dist" ] ; then echo " $WORK_DIR/base/tools/src/main/native/setpin/setpin" echo " $WORK_DIR/base/tools/src/main/native/sslget/sslget" echo " $WORK_DIR/base/tools/src/main/native/tkstool/tkstool" - echo " $WORK_DIR/base/tools/src/main/native/tpsclient/src/libtps.so" - echo " $WORK_DIR/base/tools/src/main/native/tpsclient/tools/raclient/tpsclient" + echo " $WORK_DIR/base/tools/src/main/native/tpsclient/tpsclient" echo "- documentation:" echo " $WORK_DIR/base/common/python/man" diff --git a/pki.spec b/pki.spec index 1ecac1b9859..4966d6a3d70 100644 --- a/pki.spec +++ b/pki.spec @@ -1042,7 +1042,6 @@ fi %{_javadir}/pki/pki-tools.jar %{_datadir}/pki/tools/ %{_datadir}/pki/lib/p11-kit-trust.so -%{_libdir}/tps/libtps.so %{_mandir}/man1/AtoB.1.gz %{_mandir}/man1/AuditVerify.1.gz %{_mandir}/man1/BtoA.1.gz