diff --git a/.gitignore b/.gitignore index 08715cbcde0da374c4848e9cc83fc9ac89a4b1f3..f4b9518e49950b337566c1571f38dd049b925de4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -build/* -!build/build.sh +build/ output coverage_report example/datasystem diff --git a/README.md b/README.md index 97fcfe4972957808f275f8e58e90222c53175330..c0e863eb1d0505273dc67d05e09c8026f52e4c7a 100644 --- a/README.md +++ b/README.md @@ -91,4 +91,4 @@ More details about installation guide, tutorials and APIs, please see the [User ## License -[Apache License 2.0](LICENSE) +[Apache License 2.0](LICENSE) \ No newline at end of file diff --git a/build.sh b/build.sh index 34eee51d625be4336f5d3bd6d9b3f6474b056a58..b58767f7dd16f733331ae28a133d1abd5ba19749 100755 --- a/build.sh +++ b/build.sh @@ -39,7 +39,7 @@ Options: For multiple programming languages: -P Build Python sdk, choose from: on/off, default: on. - -X Compiles the code for heterogeneous objects. The options are on and off. The default value is 'off'. + -X Compiles the code for heterogeneous objects. The options are on and off. The default value is 'on'. For communication layer -M Build with URMA framework in addition to ZMQ, choose from on/off, default: off. @@ -142,7 +142,7 @@ function init_default_opts() { export PYTHON_VERSION="" # Whether to build device object. - export BUILD_HETERO="off" + export BUILD_HETERO="on" # Whether support jemalloc memory profiling export SUPPORT_JEPROF="off" diff --git a/build/build.sh b/build/build.sh deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/cmake/external_libs/scc.cmake b/cmake/external_libs/scc.cmake deleted file mode 100644 index 0a1f8af1d49e5fca1cff2199f43469a0129ee3bd..0000000000000000000000000000000000000000 --- a/cmake/external_libs/scc.cmake +++ /dev/null @@ -1,13 +0,0 @@ -if(DEFINED ENV{SCC_CUSTOM_PATH}) - set(SCC_PATH $ENV{SCC_CUSTOM_PATH}) -else() - set(SCC_PATH /usr/local/seccomponent) -endif() - -file(GLOB SCC_LIBS "${SCC_PATH}/lib/lib*") -set(SCC_INCLUDE_DIRS ${SCC_PATH}/include) - -message(STATUS "SCC_INCLUDE_DIRS=${SCC_INCLUDE_DIRS}") -message(STATUS "SCC_LIBS=${SCC_LIBS}") - -include_directories(SYSTEM ${SCC_INCLUDE_DIRS}) diff --git a/cmake/external_libs/ub.cmake b/cmake/external_libs/ub.cmake index 3dbafb5199700d550060ee3da77aa5491c1ab492..64ce772b46a84361a738b7b72d28a8d2cd45b813 100644 --- a/cmake/external_libs/ub.cmake +++ b/cmake/external_libs/ub.cmake @@ -3,11 +3,13 @@ if (DOWNLOAD_UB) set(UB_ARCHIVE_DATETIME 20240124) # format YYYYMMDDhhmmss if ("${UB_URL}" STREQUAL "" AND "${UB_SHA256}" STREQUAL "") if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64") - set(UB_URL "https://cmc-nkg-artifactory.cmc.tools.huawei.com/artifactory/cmc-software-release/UBUS%20BaseSoftware%20TD/umdk_master/V100R005C00B304/Software/x86_64/EulerOS-V2R10/01.InstallationPackage/UMDK-V100R005C00B304-EulerOS-V2R10-mlx.tar.gz") - set(UB_SHA256 "d78a214da24b709fc21f3c20b73583f24e87a943a92faefd5d90d5edd31d557f") + # wait for modify + set(UB_URL "xxx") + set(UB_SHA256 "xxx") elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") - set(UB_URL "https://cmc-nkg-artifactory.cmc.tools.huawei.com/artifactory/cmc-software-release/UBUS%20BaseSoftware%20TD/umdk_master/V100R005C00B304/Software/aarch64/EulerOS-V2R10/01.InstallationPackage/UMDK-V100R005C00B304-EulerOS-V2R10-mlx.tar.gz") - set(UB_SHA256 "2ae8d1f00ffbd3a7edf68375ee20439de8627597f2efced290ddeed6525caef6") + # wait for modify + set(UB_URL "xxx") + set(UB_SHA256 "xxx") else() message(FATAL_ERROR "Unsupported system processor: ${CMAKE_SYSTEM_PROCESSOR}") endif() diff --git a/dist/.gitkeep b/dist/.gitkeep deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/docs/source_en/appendix/k8s_configuration.md b/docs/source_en/appendix/k8s_configuration.md index 7d2da8fdc214cadfb03b602f4f7dd4fee6d57d93..81571bb5f80f2ac38d84fd2150e415dcf0c216f3 100644 --- a/docs/source_en/appendix/k8s_configuration.md +++ b/docs/source_en/appendix/k8s_configuration.md @@ -39,7 +39,7 @@ This document describes yr-datasystem Kubernetes configuration items. **Example**: ```yaml global: - # image:swr.cn-south-1.myhuaweicloud.com/mindspore/yr-datasystem:v0.1 + # image:swr.cn-south-1.myhuaweicloud.com/openeuler/yr-datasystem:v0.1 imageRegistry: "swr.cn-south-1.myhuaweicloud.com/mindspore" images: @@ -59,7 +59,7 @@ Each yr-datasystem DaemonSet can use a maximum of 2GB shared memory space for da ```yaml global: - # swr.cn-south-1.myhuaweicloud.com/mindspore/yr-datasystem:v0.1 + # swr.cn-south-1.myhuaweicloud.com/openeuler/yr-datasystem:v0.1 imageRegistry: "swr.cn-south-1.myhuaweicloud.com/mindspore" images: @@ -107,7 +107,7 @@ global: **Example**: ```yaml global: - # image:swr.cn-south-1.myhuaweicloud.com/mindspore/yr-datasystem:v0.1 + # image:swr.cn-south-1.myhuaweicloud.com/openeuler/yr-datasystem:v0.1 imageRegistry: "swr.cn-south-1.myhuaweicloud.com/mindspore" images: datasystem: "yr-datasystem:v0.1" diff --git a/docs/source_zh_cn/appendix/k8s_configuration.md b/docs/source_zh_cn/appendix/k8s_configuration.md index d1b4fd350cd52093622ab6885b8867ffd54c0cd9..0f55b2ee834a43341c7ec728bd693235ea770cd1 100644 --- a/docs/source_zh_cn/appendix/k8s_configuration.md +++ b/docs/source_zh_cn/appendix/k8s_configuration.md @@ -42,7 +42,7 @@ **样例**: ```yaml global: - # 镜像:swr.cn-south-1.myhuaweicloud.com/mindspore/yr-datasystem:v0.1 + # 镜像:swr.cn-south-1.myhuaweicloud.com/openeuler/yr-datasystem:v0.1 imageRegistry: "swr.cn-south-1.myhuaweicloud.com/mindspore" images: @@ -62,7 +62,7 @@ global: ```yaml global: - # 镜像:swr.cn-south-1.myhuaweicloud.com/mindspore/yr-datasystem:v0.1 + # 镜像:swr.cn-south-1.myhuaweicloud.com/openeuler/yr-datasystem:v0.1 imageRegistry: "swr.cn-south-1.myhuaweicloud.com/mindspore" images: @@ -110,7 +110,7 @@ global: **样例**: ```yaml global: - # 镜像:swr.cn-south-1.myhuaweicloud.com/mindspore/yr-datasystem:v0.1 + # 镜像:swr.cn-south-1.myhuaweicloud.com/openeuler/yr-datasystem:v0.1 imageRegistry: "swr.cn-south-1.myhuaweicloud.com/mindspore" images: datasystem: "yr-datasystem:v0.1" diff --git a/docs/source_zh_cn/getting-started/deploy.md b/docs/source_zh_cn/getting-started/deploy.md index 82410782c580d458fb054e525f759def06a0271e..f33e83fac4af4648a2f143141212a9f05657cbae 100644 --- a/docs/source_zh_cn/getting-started/deploy.md +++ b/docs/source_zh_cn/getting-started/deploy.md @@ -367,7 +367,7 @@ yr-datasystem Kubernetes部署所需的依赖如下: - 通过镜像仓获取镜像: ```bash - docker pull mindspore/yr-datasystem: + docker pull openeuler/yuanrong-datasystem: ``` - 源码编译构建镜像 @@ -375,7 +375,7 @@ yr-datasystem Kubernetes部署所需的依赖如下: 如果需要从源码构建镜像,需要先完成 [源码编译](install.md)。源码编译完成之后执行如下命令: ```bash - cd yr-datasystem/docker + cd yuanrong-datasystem/docker bash docker_build.sh \ -b : \ -n \ @@ -403,8 +403,8 @@ yr-datasystem Kubernetes部署所需的依赖如下: - 通过源码获取: ```bash - git clone -b ${version} https://gitee.com/mindspore/mindspore.git - cp -r yr-datasystem/docker/chart/datasystem /tmp + git clone -b ${version} https://gitee.com/openeuler/yuanrong-datasystem.git + cp -r yuanrong-datasystem/docker/chart/datasystem /tmp ``` ### 集群部署 @@ -416,7 +416,7 @@ global: # 其他配置项... # 镜像仓地址,不涉及可以留空 - imageRegistry: "swr.cn-south-1.myhuaweicloud.com/mindspore/" + imageRegistry: "swr.cn-south-1.myhuaweicloud.com/openeuler/" # 镜像名字和镜像tag,需要替换为对应的版本号 images: datasystem: "yr-datasystem:" diff --git a/docs/source_zh_cn/getting-started/install.md b/docs/source_zh_cn/getting-started/install.md index 1c717a2c07de8f21d24625d66217ddbb65a6584e..1ce3a5319605d6abb99235f3cb764774bc1af06b 100644 --- a/docs/source_zh_cn/getting-started/install.md +++ b/docs/source_zh_cn/getting-started/install.md @@ -202,7 +202,7 @@ source ~/.bashrc ### 从代码仓下载源码 ```bash -git clone https://gitee.com/mindspore/yr-datasystem.git +git clone https://gitee.com/openeuler/yuanrong-datasystem.git ``` ### 初始化环境变量 diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index f9e5a7c8f079e1e87c995b452858ecd6ecb127a5..7ca9b247f353c922ef9a28efea90788c7f62c8df 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -38,8 +38,6 @@ target_link_libraries(state_example datasystem) add_executable(kv_example src/kv_cache/kv_example.cpp) target_link_libraries(kv_example datasystem) -add_executable(aes_example src/aes/aes_example.cpp) -target_link_libraries(aes_example datasystem) if (ENABLE_PERF) add_executable(perf_example src/perf/perf_demo.cpp) target_link_libraries(perf_example datasystem) diff --git a/example/run-example.sh b/example/run-example.sh index 5ba5c159c52984ba96f5eb20e194f832ea70c5c2..f95ada7ccfd3da8f75a9298b9b90c4af996fd422 100755 --- a/example/run-example.sh +++ b/example/run-example.sh @@ -66,7 +66,6 @@ echo "Set LD_LIBRARY_PATH=${LD_LIBRARY_PATH} before cpp example test." ${example_build_dir}/ds_example "127.0.0.1" "${worker_port}" ${example_build_dir}/object_example "127.0.0.1" "${worker_port}" "1000" "false" ${example_build_dir}/kv_example "127.0.0.1" "${worker_port}" -${example_build_dir}/aes_example if [ "x$run_perf" == "xon" ]; then ${example_build_dir}/perf_example "127.0.0.1" "${worker_port}" diff --git a/example/src/aes/aes_example.cpp b/example/src/aes/aes_example.cpp deleted file mode 100644 index 253876ec6e0f2765798259c896ac1d94c0e5a80d..0000000000000000000000000000000000000000 --- a/example/src/aes/aes_example.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/** - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Description: The state cache example. - */ - -#include - -#include "datasystem/utils/aes.h" -#include "datasystem/utils/status.h" - -using datasystem::Aes; -using datasystem::Status; -static constexpr int SUCCESS = 0; -static constexpr int FAILED = -1; - -int main(int argc, char *argv[]) -{ - std::string keyStr(32, 'a'); - datasystem::SensitiveValue key(keyStr); - Aes aes(key, Aes::Algorithm::AES_256_GCM); - datasystem::SensitiveValue plainText("test encrypt"); - std::string cipherText; - Status rc = aes.Encrypt(plainText, cipherText); - if (rc.IsError()) { - std::cout << "Encrypt failed: " << rc.ToString() << std::endl; - return FAILED; - } - datasystem::SensitiveValue plainText2; - rc = aes.Decrypt(cipherText, plainText2); - if (rc.IsError()) { - std::cout << "Decrypt failed: " << rc.ToString() << std::endl; - return FAILED; - } - if (plainText == plainText2) { - std::cout << "Encrypt and decrypt success. " << rc.ToString() << std::endl; - return SUCCESS; - }; - std::cout << "Decrypt is not getting value encrypt by Encrypt()." << std::endl; - return FAILED; -} diff --git a/include/datasystem/utils/aes.h b/include/datasystem/utils/aes.h deleted file mode 100644 index a5c9f6f15d39302aaa2e3fe894ffcdd7eb0b9f03..0000000000000000000000000000000000000000 --- a/include/datasystem/utils/aes.h +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Description: The cipher of AES define. - */ - -#ifndef DATASYSTEM_UTILS_AES_H -#define DATASYSTEM_UTILS_AES_H - -#include "datasystem/utils/sensitive_value.h" -#include "datasystem/utils/status.h" - -namespace datasystem { -class AesImpl; - -class __attribute((visibility("default"))) Aes { -public: - enum Algorithm { - AES_128_GCM, - AES_192_GCM, - AES_256_GCM, - }; - Aes(SensitiveValue key, Algorithm algorithm); - - /// \brief Encrypt plaintext. - /// - /// \param[in] plainText The plaintext need to encrypt. - /// \param[out] cipherText Ciphertext with aes-gcm. - /// - /// \return K_OK when success; K_RUNTIME_ERROR otherwise. - Status Encrypt(const SensitiveValue &plainText, std::string &cipherText); - - /// \brief Decrypt ciphertext. - /// - /// \param[in] cipherText The ciphertext need to decrypt. - /// \param[out] plainText Plaintext with aes-gcm. - /// - /// \return K_OK when success; K_RUNTIME_ERROR otherwise. - Status Decrypt(const std::string &cipherText, SensitiveValue &plainText); - -private: - std::shared_ptr impl_; -}; -} // namespace datasystem - -#endif \ No newline at end of file diff --git a/k8s/helm_chart/datasystem/templates/worker_daemonset.yaml b/k8s/helm_chart/datasystem/templates/worker_daemonset.yaml index e7ebae7998b69c10b91b0e3b6464945641103519..1e09538cf7fa3802b965615c46ab212b7aaa2e4c 100644 --- a/k8s/helm_chart/datasystem/templates/worker_daemonset.yaml +++ b/k8s/helm_chart/datasystem/templates/worker_daemonset.yaml @@ -124,7 +124,7 @@ spec: - -obs_https_enabled={{ $.Values.global.l2Cache.obs.obsHttpsEnabled }} {{- end }} {{- if eq ($.Values.global.l2Cache.l2CacheType) "sfs" }} - - -sfs_path=/opt/huawei/data/datasystem/sfs-turbo + - -sfs_path=/opt/data/datasystem/sfs-turbo {{- end }} - -enable_cloud_service_token_rotation={{ $.Values.global.l2Cache.obs.cloudServiceTokenRotation.enable }} - -l2_cache_type={{ $.Values.global.l2Cache.l2CacheType }} @@ -341,7 +341,7 @@ spec: {{- if eq ($.Values.global.l2Cache.l2CacheType) "sfs" }} - name: pvc-sfsturbo readOnly: false - mountPath: /opt/huawei/data/datasystem/sfs-turbo + mountPath: /opt/data/datasystem/sfs-turbo subPath: {{ $.Values.global.l2Cache.sfsTurbo.subPath }} {{- end }} restartPolicy: Always diff --git a/setup.py b/setup.py index 7873dffe743a8773430a8d8f84733bf5a848ffdf..d4acd13bf6c7c7932b02a90680cc95fa5f9ccfaf 100644 --- a/setup.py +++ b/setup.py @@ -159,5 +159,5 @@ setup( 'Topic :: Software Development :: Libraries :: Python Modules', ], license="Apache 2.0", - keywords='yr-datasystem datasystem yuanrong-datasystem', + keywords='mindspore yr-datasystem datasystem', ) diff --git a/src/datasystem/client/CMakeLists.txt b/src/datasystem/client/CMakeLists.txt index d8f20d8aa3c3e9f9d0a44f921d68c8090f908a51..6bc0a3c26c7d51029f4901ec1fb0b569e6e1e329 100644 --- a/src/datasystem/client/CMakeLists.txt +++ b/src/datasystem/client/CMakeLists.txt @@ -4,7 +4,6 @@ list(APPEND CLIENT_SRCS listen_worker.cpp mmap_table.cpp mmap_manager.cpp - aes.cpp client_flags_monitor.cpp context/context.cpp object_cache/client_worker_api.cpp @@ -36,7 +35,6 @@ list(APPEND CLIENT_DEPEND_LIBS common_shm_unit_info common_util common_immutable_string - common_aes httpclient nlohmann_json::nlohmann_json posix_protos_client diff --git a/src/datasystem/client/aes.cpp b/src/datasystem/client/aes.cpp deleted file mode 100644 index a99b2194e85f2b141c57243701dfd9dd70a56283..0000000000000000000000000000000000000000 --- a/src/datasystem/client/aes.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Description: The cipher of AES implement. - */ -#include "datasystem/utils/aes.h" -#include "datasystem/common/aes/aes_impl.h" - -namespace datasystem { -Aes::Aes(SensitiveValue key, Aes::Algorithm algorithm) -{ - impl_ = std::make_shared(key, static_cast(algorithm)); -} - -Status Aes::Encrypt(const SensitiveValue &plainText, std::string &cipherText) -{ - return impl_->Encrypt(plainText, cipherText); -} - -Status Aes::Decrypt(const std::string &cipherText, SensitiveValue &plainText) -{ - return impl_->Decrypt(cipherText, plainText); -} -} // namespace datasystem \ No newline at end of file diff --git a/src/datasystem/common/CMakeLists.txt b/src/datasystem/common/CMakeLists.txt index a1122a9036f6558421333cd819ea66d9a44313ca..62b3464c5aacf8c0008ca5395aa2c4bbd2c1b82c 100644 --- a/src/datasystem/common/CMakeLists.txt +++ b/src/datasystem/common/CMakeLists.txt @@ -17,7 +17,6 @@ add_subdirectory(device) add_subdirectory(l2cache) add_subdirectory(flags) add_subdirectory(signal) -add_subdirectory(aes) add_subdirectory(rdma) diff --git a/src/datasystem/common/aes/CMakeLists.txt b/src/datasystem/common/aes/CMakeLists.txt deleted file mode 100644 index 191e4caf98cf16ed6aa6efdd3ac902e249e2b3af..0000000000000000000000000000000000000000 --- a/src/datasystem/common/aes/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(AES_SRC - aes_impl.cpp) - -set(AES_LIBS - common_log - common_util) - -add_library(common_aes STATIC ${AES_SRC}) -target_link_libraries(common_aes PRIVATE ${AES_LIBS}) \ No newline at end of file diff --git a/src/datasystem/common/aes/aes_impl.cpp b/src/datasystem/common/aes/aes_impl.cpp deleted file mode 100644 index 84188601c77cedbd8bb7427aba999b2ad8cd78b3..0000000000000000000000000000000000000000 --- a/src/datasystem/common/aes/aes_impl.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/** - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Description: The cipher of AES implement. - */ -#include "datasystem/common/aes/aes_impl.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "securec.h" - -#include "datasystem/common/log/log.h" -#include "datasystem/common/util/format.h" -#include "datasystem/common/util/raii.h" -#include "datasystem/common/util/status_helper.h" -#include "datasystem/common/util/strings_util.h" -#include "datasystem/utils/sensitive_value.h" -#include "datasystem/utils/status.h" - -namespace datasystem { -const int AES_128_GCM_KEY_LEN = 16; -const int AES_192_GCM_KEY_LEN = 24; -const int AES_256_GCM_KEY_LEN = 32; -namespace { -const EVP_CIPHER *GetCipher(AesImpl::Algorithm &mode) -{ - // Select cipher based on key size - switch (mode) { - case AesImpl::Algorithm::AES_128_GCM: - return EVP_aes_128_gcm(); - case AesImpl::Algorithm::AES_192_GCM: - return EVP_aes_192_gcm(); - case AesImpl::Algorithm::AES_256_GCM: - return EVP_aes_256_gcm(); - default: - LOG(ERROR) << "Unsupported key size"; - return nullptr; - } -} -} // namespace - -Status AesImpl::CheckKey() -{ - switch (algorithm_) { - case AES_128_GCM: - CHECK_FAIL_RETURN_STATUS(key_.GetSize() == AES_128_GCM_KEY_LEN, K_INVALID, "Invalid key for aes 128 gcm!"); - break; - case AES_192_GCM: - CHECK_FAIL_RETURN_STATUS(key_.GetSize() == AES_192_GCM_KEY_LEN, K_INVALID, "Invalid key for aes 192 gcm!"); - break; - case AES_256_GCM: - CHECK_FAIL_RETURN_STATUS(key_.GetSize() == AES_256_GCM_KEY_LEN, K_INVALID, "Invalid key for aes 256 gcm!"); - break; - default: - RETURN_STATUS_LOG_ERROR(K_INVALID, "Unsupported algorithm!"); - } - return Status::OK(); -} - -Status AesImpl::Encrypt(const SensitiveValue &plainText, std::string &cipherText) -{ - LOG(INFO) << "Start encrypt with mode: " << algorithm_; - RETURN_IF_NOT_OK(CheckKey()); - unsigned char IV[AES_IV_LEN] = { 0 }; - unsigned char tag[AES_TAG_LEN] = { 0 }; - - int ret = RAND_priv_bytes(IV, AES_IV_LEN); // generate bytes string. - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, FormatString("Generate iv failed! ret = %d", ret)); - EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); - auto cipher = GetCipher(algorithm_); - RETURN_RUNTIME_ERROR_IF_NULL(cipher); - Raii evpRaii([ctx]() { EVP_CIPHER_CTX_free(ctx); }); - ret = EVP_EncryptInit_ex(ctx, cipher, NULL, (unsigned char *)key_.GetData(), IV); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, FormatString("Encrypt init failed! ret = %d", ret)); - - auto plainTextSize = plainText.GetSize(); - auto ctxSize = EVP_CIPHER_CTX_block_size(ctx); - if (static_cast(ctxSize) > std::numeric_limits::max() - plainTextSize) { - RETURN_STATUS_LOG_ERROR(K_INVALID, "The sum of plainText and ctx exceeds the size_t boundary."); - } - size_t cipherTextLen = plainTextSize + static_cast(ctxSize); - std::unique_ptr encCipher(new unsigned char[cipherTextLen]); - int encCipherSize = 0; - int outSize = 0; - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(plainText.GetSize() <= INT_MAX, K_INVALID, - FormatString("The plainText size %zu exceed INT_MAX", plainText.GetSize())); - int srcSize = static_cast(plainText.GetSize()); - ret = EVP_EncryptUpdate(ctx, encCipher.get(), &outSize, (const unsigned char *)plainText.GetData(), srcSize); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, - FormatString("Encrypt update failed! ret = %d", ret)); - if (outSize > 0) { - encCipherSize = outSize; - } - - ret = EVP_EncryptFinal_ex(ctx, encCipher.get() + outSize, &outSize); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, - FormatString("Encrypt final failed! ret = %d", ret)); - if (outSize > 0) { - encCipherSize += outSize; - } - - ret = EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, AES_TAG_LEN, tag); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, FormatString("Create tag failed! ret = %d", ret)); - std::string ivStr(reinterpret_cast(IV), AES_IV_LEN); - std::string tagStr(reinterpret_cast(tag), AES_TAG_LEN); - // Convert to hex string - cipherText.clear(); - cipherText = EncodeToHexString(ivStr) + ":" + EncodeToHexString(tagStr) + ":"; - cipherText.append((char *)encCipher.get(), encCipherSize); - LOG(INFO) << "Finish encrypt with mode: " << algorithm_; - return Status::OK(); -} - -Status AesImpl::Decrypt(const std::string &cipherText, SensitiveValue &plainText) -{ - LOG(INFO) << "Start decrypt with mode: " << algorithm_; - RETURN_IF_NOT_OK(CheckKey()); - - std::unique_ptr ivBytes; - std::unique_ptr tagBytes; - size_t cipherOffset = 0; - RETURN_IF_NOT_OK_PRINT_ERROR_MSG(SplitCipherStr(cipherText, ivBytes, tagBytes, cipherOffset), - "Split cipher failed!"); - EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new(); - Raii evpRaii([ctx]() { EVP_CIPHER_CTX_free(ctx); }); - auto cipher = GetCipher(algorithm_); - RETURN_RUNTIME_ERROR_IF_NULL(cipher); - int ret = EVP_DecryptInit_ex(ctx, cipher, NULL, (unsigned char *)key_.GetData(), (unsigned char *)ivBytes.get()); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, FormatString("Decrypt init failed! ret = %d", ret)); - - ret = EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, AES_TAG_LEN, tagBytes.get()); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, - FormatString("Tag authentication failed! ret = %d", ret)); - int decCipherSize = 0; - int tempSize = 0; - size_t decryptedTextLen = cipherText.length(); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(cipherText.size() <= INT_MAX, K_INVALID, - FormatString("The cipherText size %zu exceed INT_MAX", plainText.GetSize())); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR( - cipherText.size() > cipherOffset, K_INVALID, - FormatString("Invalid cipherOffset %zu, exceed %zu", cipherOffset, cipherText.size())); - auto copyCipherSize = static_cast(cipherText.size() - cipherOffset); - std::unique_ptr decCipher(new char[decryptedTextLen]); - ret = EVP_DecryptUpdate(ctx, (unsigned char *)(decCipher.get()), &tempSize, - (const unsigned char *)cipherText.data() + cipherOffset, copyCipherSize); - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ret == 1, K_RUNTIME_ERROR, - FormatString("Decrypt update failed! ret = %d", ret)); - if (tempSize > 0) { - decCipherSize = tempSize; - } - ret = EVP_DecryptFinal_ex(ctx, (unsigned char *)decCipher.get() + tempSize, &tempSize); - if (ret != 1) { - unsigned long err = ERR_get_error(); - RETURN_STATUS_LOG_ERROR(K_RUNTIME_ERROR, FormatString("Decrypt final failed! ret: %d, err msg: %s", ret, - ERR_error_string(err, NULL))); - } - if (tempSize > 0) { - decCipherSize += tempSize; - } - - plainText = SensitiveValue(std::move(decCipher), decCipherSize); - LOG(INFO) << "Finish decrypt with mode: " << algorithm_; - return Status::OK(); -} - -std::string AesImpl::EncodeToHexString(const std::string &str) -{ - std::string hexString = "0123456789abcdef"; - std::string result; - int headFourBitMove = 4; - int tailFourBitMove = 0; - for (size_t i = 0; i < str.size(); i++) { - result += hexString.at(((unsigned int)str[i] & 0xf0) >> headFourBitMove); - result += hexString.at(((unsigned int)str[i] & 0x0f) >> tailFourBitMove); - } - return result; -} - -Status AesImpl::DecodeToString(const char *str, size_t strLen, char *result, size_t resultLen, bool isCap) -{ - std::string hexString = "0123456789abcdef"; - if (isCap) { - hexString = "0123456789ABCDEF"; - } - CHECK_FAIL_RETURN_STATUS(str != nullptr, StatusCode::K_INVALID, "Empty encode text!"); - unsigned int nextBitStep = 2; - CHECK_FAIL_RETURN_STATUS((strLen % BYTE_PRE_HEX == 0) && (strLen > 0) - && (std::numeric_limits::max() - strLen >= +nextBitStep), - StatusCode::K_INVALID, - FormatString("The number of text %u for decode must be an even number.", strLen)); - - std::string temp; - int headFourBitMove = 4; - for (size_t i = 0; i < strLen; i += nextBitStep) { - auto headPos = hexString.find(str[i]); - if (headPos == std::string::npos) { - RETURN_STATUS_LOG_ERROR(K_INVALID, "Decode failed: invalid string!"); - } - auto pos = hexString.find(str[i + 1]); - if (pos == std::string::npos) { - RETURN_STATUS_LOG_ERROR(K_INVALID, "Decode failed: invalid string!"); - } - temp += static_cast((headPos << headFourBitMove) | pos); - } - int ret = memcpy_s(result, resultLen, temp.c_str(), temp.length()); - ClearStr(temp); - CHECK_FAIL_RETURN_STATUS(ret == EOK, StatusCode::K_RUNTIME_ERROR, - FormatString("Copy text failed, the memcpy_s return: %d", ret)); - return Status::OK(); -} - -Status AesImpl::SplitCipherStr(const std::string &cipher, std::unique_ptr &ivBytes, - std::unique_ptr &tagBytes, size_t &cipherOffset) -{ - auto pos1 = cipher.find(':', 0); - if (pos1 == std::string::npos) { - RETURN_STATUS_LOG_ERROR(K_RUNTIME_ERROR, "Incorrect cipher text format!"); - } - - auto ivHexStr = cipher.substr(0, pos1); - auto ivHexLen = ivHexStr.length() / BYTE_PRE_HEX; - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(ivHexLen == AES_IV_LEN, K_RUNTIME_ERROR, - "The length of the IV does not match the requirements."); - auto pos2 = cipher.find(':', pos1 + 1); - if (pos2 == std::string::npos) { - RETURN_STATUS_LOG_ERROR(K_RUNTIME_ERROR, "Incorrect cipher text format!"); - } - - auto tagHexStr = cipher.substr(pos1 + 1, pos2 - pos1 - 1); - auto tagBytesLen = tagHexStr.length() / BYTE_PRE_HEX; - CHECK_FAIL_RETURN_STATUS_PRINT_ERROR(tagBytesLen == AES_TAG_LEN, K_RUNTIME_ERROR, - "The length of the tag does not match the requirements."); - cipherOffset = pos2 + 1; - ivBytes = std::make_unique(ivHexLen + 1); - RETURN_IF_NOT_OK(DecodeToString(ivHexStr.c_str(), ivHexStr.length(), ivBytes.get(), ivHexLen)); - tagBytes = std::make_unique(tagBytesLen + 1); - RETURN_IF_NOT_OK(DecodeToString(tagHexStr.c_str(), tagHexStr.length(), tagBytes.get(), tagBytesLen)); - return Status::OK(); -} -} // namespace datasystem diff --git a/src/datasystem/common/aes/aes_impl.h b/src/datasystem/common/aes/aes_impl.h deleted file mode 100644 index fe75810b4bad2d8d756b79eaf6986867cc7d4835..0000000000000000000000000000000000000000 --- a/src/datasystem/common/aes/aes_impl.h +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Description: The cipher of AES define. - */ - -#ifndef DATASYSTEM_UTILS_AES_IMPL_H -#define DATASYSTEM_UTILS_AES_IMPL_H - -#include "datasystem/utils/sensitive_value.h" -#include "datasystem/utils/status.h" - -namespace datasystem { -const size_t AES_IV_LEN = 12; -const size_t AES_TAG_LEN = 16; -const size_t BYTE_PRE_HEX = 2; -class AesImpl { -public: - enum Algorithm { - AES_128_GCM, - AES_192_GCM, - AES_256_GCM, - }; - - AesImpl(SensitiveValue key, Algorithm algorithm) : key_(std::move(key)), algorithm_(algorithm) - { - } - - /** - * @brief Encrypt plaintext. - * @param[in] plainText The plaintext need to encrypt. - * @param[out] cipherText Ciphertext with aes-gcm. - * @return K_OK when success; K_RUNTIME_ERROR otherwise. - */ - Status Encrypt(const SensitiveValue &plainText, std::string &cipherText); - - /** - * @brief Decrypt ciphertext. - * @param[in] cipherText The ciphertext need to decrypt. - * @param[out] plainText Plaintext with aes-gcm. - * @return K_OK when success; K_RUNTIME_ERROR otherwise. - */ - Status Decrypt(const std::string &cipherText, SensitiveValue &plainText); - - /** - * @brief Check whether the algorithm matches the key. - * @return K_OK when success; K_INVALID otherwise. - */ - Status CheckKey(); - - /** - * @brief Convert bytes string to hex string. - * @param[in] str The bytes string. - * @return hex string. - */ - static std::string EncodeToHexString(const std::string &str); - - /** - * @brief Convert hex string to bytes string. - * @param[in] str The hex string. - * @param[in] strLen The hex string length. - * @param[out] result The bytes string. - * @param[out] resultLen Output result max Len. - * @param[in] isCap Hex string is uppercase or not. - * @note If "00" in str, may decode to '\0'. - * @note Must initialize result before decode. - * @return K_OK when decode to bytes string success, K_RUNTIME_ERROR otherwise. - */ - static Status DecodeToString(const char *str, size_t strLen, char *result, size_t resultLen, bool isCap = false); - -private: - /** - * @brief Divide the ciphertext into three parts: IV, cipher, and tag. - * @param[in/out] cipher Origin ciphertext. - * @param[out] ivBytes Hash distribution of keys. - * @param[out] tagBytes Tag for specifying additional authenticated data. - * @param[out] cipherOffset Offset of cipherBytes. - * @return K_OK when success; K_RUNTIME_ERROR otherwise. - */ - static Status SplitCipherStr(const std::string &cipher, std::unique_ptr &ivBytes, - std::unique_ptr &tagBytes, size_t &cipherOffset); - - SensitiveValue key_; - Algorithm algorithm_; -}; -} // namespace datasystem - -#endif \ No newline at end of file diff --git a/src/datasystem/common/ak_sk/CMakeLists.txt b/src/datasystem/common/ak_sk/CMakeLists.txt index a0271a03c011fd5fdce8fc8f9b50d8351ee909b3..4365d5402eccb2e3e2c99c7afc1254b8f8cd4cf6 100644 --- a/src/datasystem/common/ak_sk/CMakeLists.txt +++ b/src/datasystem/common/ak_sk/CMakeLists.txt @@ -21,7 +21,6 @@ set(AK_SK_DEPEND_LIBS common_log common_util common_encrypt - common_aes ) add_library(ak_sk_signature STATIC ${AK_SK_SIGNATURE}) diff --git a/src/datasystem/common/ak_sk/ak_sk_manager.cpp b/src/datasystem/common/ak_sk/ak_sk_manager.cpp index d968436f3ca654fd8a3cc40b3085709eb2815cc6..951b3374bc535e524d2749e1750caa5e591b213f 100644 --- a/src/datasystem/common/ak_sk/ak_sk_manager.cpp +++ b/src/datasystem/common/ak_sk/ak_sk_manager.cpp @@ -19,7 +19,6 @@ */ #include "datasystem/common/ak_sk/ak_sk_manager.h" -#include "datasystem/common/aes/aes_impl.h" #include "datasystem/common/encrypt/secret_manager.h" #include "datasystem/common/util/net_util.h" #include "datasystem/common/util/raii.h" @@ -79,55 +78,8 @@ Status AkSkManager::CopyAkSk(const std::string &accessKey, SensitiveValue secret return Status::OK(); } -Status AkSkManager::DecodeEncryptData(std::string &cipherText) -{ - // iv(12):content+tag(16) -> iv(12):tag(16):content - auto strs = Split(cipherText, ":"); - const auto splitLen = 2; - if (strs.size() != splitLen) { - LOG(ERROR) << "Failed to decode cipherText, invalid strs size:" << strs.size(); - RETURN_STATUS(K_INVALID, "Invalid cipherText format"); - } - const auto hexTagLen = AES_TAG_LEN * BYTE_PRE_HEX; - if (strs[1].size() < hexTagLen + 1) { - LOG(ERROR) << "Failed to decode cipherText, invalid size: " << strs[1].size(); - RETURN_STATUS(K_INVALID, "Invalid cipherText size"); - } - auto hexContent = strs[1].substr(0, strs[1].size() - hexTagLen); - auto contentSize = hexContent.size() / BYTE_PRE_HEX; - auto byteContent = std::make_unique(contentSize + 1); - RETURN_IF_NOT_OK( - AesImpl::DecodeToString(hexContent.c_str(), hexContent.size(), byteContent.get(), contentSize + 1)); - cipherText = - strs[0] + ":" + strs[1].substr(strs[1].size() - hexTagLen) + ":" + std::string(byteContent.get(), contentSize); - return Status::OK(); -} - -Status AkSkManager::ConstructAesAndDecrypt(SensitiveValue &encryptData) -{ - SensitiveValue systemDataKey; - { - std::shared_lock lock(mutex_); - systemDataKey = clientKey_.dataKey; - } - - if (!systemDataKey.Empty()) { - SensitiveValue plainText; - auto aes = std::make_unique(systemDataKey, AesImpl::Algorithm::AES_256_GCM); - std::string cipherText(encryptData.GetData(), encryptData.GetSize()); - RETURN_IF_NOT_OK(DecodeEncryptData(cipherText)); - Raii raii([&cipherText] { std::fill(cipherText.begin(), cipherText.end(), 0); }); - RETURN_IF_NOT_OK(aes->Decrypt(cipherText, plainText)); - encryptData = std::move(plainText); - } - return Status::OK(); -} - Status AkSkManager::SetTenantAkSk(const std::string &accessKey, SensitiveValue &secretKey) { - RETURN_IF_NOT_OK(ConstructAesAndDecrypt(secretKey)); - - INJECT_POINT("TestAES", [] { return Status::OK(); }); std::lock_guard lock(mutex_); AkSkData data; data.accessKey = accessKey; @@ -143,23 +95,7 @@ AkSkManager::AkSkManager(const uint32_t requestExpireTimeSec) : Signature(), req Status AkSkManager::CopyDk(SensitiveValue dataKey, AkSkData &data) { - if (SecretManager::Instance()->IsRootKeyActive()) { - std::unique_ptr plainDk; - int plainDkSize = 0; - std::string cipherDk(dataKey.GetData(), dataKey.GetSize()); - Raii raii([&cipherDk, &plainDk, &plainDkSize] { - std::fill(cipherDk.begin(), cipherDk.end(), 0); - (void)memset_s(plainDk.get(), plainDkSize, 0, plainDkSize); - }); - RETURN_IF_NOT_OK_PRINT_ERROR_MSG(SecretManager::Instance()->Decrypt(cipherDk, plainDk, plainDkSize), - "DataKey decrypt failed."); - const auto decodeDkSize = static_cast(plainDkSize) / BYTE_PRE_HEX; - auto decodeDk = std::make_unique(decodeDkSize + 1); - RETURN_IF_NOT_OK(AesImpl::DecodeToString(plainDk.get(), plainDkSize, decodeDk.get(), decodeDkSize + 1, true)); - data.dataKey = SensitiveValue(std::move(decodeDk), decodeDkSize); - } else { - data.dataKey = std::move(dataKey); - } + data.dataKey = std::move(dataKey); return Status::OK(); } diff --git a/src/datasystem/common/ak_sk/ak_sk_manager.h b/src/datasystem/common/ak_sk/ak_sk_manager.h index d909caeaa0a21fcd9d45788e28395ed7331e3818..f7e1ed9898015e13b592ec3a6354f8c0330501a1 100644 --- a/src/datasystem/common/ak_sk/ak_sk_manager.h +++ b/src/datasystem/common/ak_sk/ak_sk_manager.h @@ -80,7 +80,7 @@ public: SensitiveValue dataKey = SensitiveValue()); /** - * @brief Construct AES_256_GCM and use dataKey to decrypt the secret key. + * @brief Construct and use dataKey to decrypt the secret key. * @param[in] accessKey The access key used by AK/SK authentication. * @param[in] secretKey The secret key need to be decrypted and used by AK/SK authorize. * @return Status of the call. @@ -173,20 +173,6 @@ protected: Status CopyAkSk(const std::string &accessKey, SensitiveValue secretKey, AkSkType type, AkSkData &data) override; Status CopyDk(SensitiveValue dataKey, AkSkData &data); - /** - * @brief Construct AES_256_GCM and use dataKey to decrypt the secret key. - * @param[in] endecryData The secret data need to be decrypted. - * @return Status of the call. - */ - Status ConstructAesAndDecrypt(SensitiveValue &encryptData); - - /** - * @brief Decode encrypt data. - * @param[in] cipherText The cipher text. - * @return Status of the call. - */ - Status DecodeEncryptData(std::string &cipherText); - private: bool systemAuthEnabled_{ false }; const uint32_t SECOND_TO_US = 1000000; diff --git a/src/datasystem/common/iam/tenant_auth_manager.cpp b/src/datasystem/common/iam/tenant_auth_manager.cpp index ebc325bc3dd3ab7e5e6b0557cfae627a0cad4b9a..f513c78106dd1cf3e9919da466921118461b45e8 100644 --- a/src/datasystem/common/iam/tenant_auth_manager.cpp +++ b/src/datasystem/common/iam/tenant_auth_manager.cpp @@ -149,7 +149,7 @@ Status TenantAuthManager::TenantAkAuth(const std::string &accessKey, const std:: tenantId, std::hash()(accessKey), GetTruncatedStr(std::to_string(std::hash()(secretKey.GetData()))), expireSec, isSystemRole); (void)clientAkTable_.insert({ accessKey, { tenantId, isSystemRole } }); - // Create AES and use dataKey to decrypt secertKey when set tenant aksk. + // Create and use dataKey to decrypt secertKey when set tenant aksk. RETURN_IF_NOT_OK(akSkManager_->SetTenantAkSk(accessKey, secretKey)); RETURN_OK_IF_TRUE(expireSec == 0); // Add timer and callback func for client aksk. diff --git a/tests/kvconnector/README.md b/tests/kvconnector/README.md index c73a230953ee2cdb78e177f4aee064858dfc8913..ea0864273643220d8ea9b94a7c2204fe9c332a4d 100644 --- a/tests/kvconnector/README.md +++ b/tests/kvconnector/README.md @@ -8,7 +8,7 @@ ```shell # Update the vllm-ascend image -export IMAGE=ddl.test.huawei.com/datasystem/vllm-ascend:v0.10.0rc1-openeuler +export IMAGE=ddl.test.example.com/datasystem/vllm-ascend:v0.10.0rc1-openeuler docker run \ --name "容器名" \ --privileged -itu root -d --shm-size 64g \ diff --git a/tests/st/client/kv_cache/kv_client_cross_az_test.cpp b/tests/st/client/kv_cache/kv_client_cross_az_test.cpp index b800db06971e629cc6ff5f1b16a144a05bf2ac90..04166d3e2edd5261871b85421a92942adb76dcdd 100644 --- a/tests/st/client/kv_cache/kv_client_cross_az_test.cpp +++ b/tests/st/client/kv_cache/kv_client_cross_az_test.cpp @@ -473,15 +473,13 @@ public: { opts.waitWorkerReady = false; opts.numEtcd = 1; + opts.numOBS = 1; opts.numWorkers = DEFAULT_WORKER_NUM; opts.enableDistributedMaster = "true"; opts.addNodeTime = SCALE_RESTART_ADD_TIME; std::string obsGflag = - "-obs_endpoint=ddl.test.huawei.com:19000 " - "-obs_access_key=3rtJpvkP4zowTDsx6XiE -obs_secret_key=SJx5Zecs7SL7I6Au9XpylG9LwPF29kMwIxisI5Xs" "-shared_memory_size_mb=5120 -node_timeout_s=3 -node_dead_timeout_s=8 -auto_del_dead_node=false " - "-other_az_names=AZ1,AZ2 " - "-l2_cache_type=obs -obs_bucket=test -v=1 -log_monitor=true"; + "-other_az_names=AZ1,AZ2 -v=1 -log_monitor=true"; FLAGS_v = 1; opts.workerGflagParams = obsGflag; for (size_t i = 0; i < DEFAULT_WORKER_NUM; i++) { diff --git a/tests/st/common/kvstore/etcd_store_test.cpp b/tests/st/common/kvstore/etcd_store_test.cpp index dc3235fca8b1fd073ad0d02bce6b1f97369c51b0..8ce7e69172351a536ea84f6118af001277e341ba 100644 --- a/tests/st/common/kvstore/etcd_store_test.cpp +++ b/tests/st/common/kvstore/etcd_store_test.cpp @@ -916,7 +916,7 @@ TEST_F(EtcdSslTest, TestCreateSessionWithTls) { InitTestEtcdInstance(); std::string stsP12Path = "./certs/etcd.p12"; - std::string pass = "huawei"; + std::string pass = "example"; SensitiveValue passphrase(pass); std::string CA; diff --git a/tests/st/common/obs_client/obs_client_test.cpp b/tests/st/common/obs_client/obs_client_test.cpp index f7903223bb00529880ed595ea7ecbc27f14f02c7..dbef45826f3bc558dc3d798e8faed66f4813b83a 100644 --- a/tests/st/common/obs_client/obs_client_test.cpp +++ b/tests/st/common/obs_client/obs_client_test.cpp @@ -45,7 +45,7 @@ protected: void StreamingUpload(); RandomData randData_; - const std::string obsEndpoint_ = "ddl.test.huawei.com:19000"; + const std::string obsEndpoint_ = "ddl.test.com:19000"; const std::string obsAk_ = "3rtJpvkP4zowTDsx6XiE"; const std::string obsSk_ = "SJx5Zecs7SL7I6Au9XpylG9LwPF29kMwIxisI5Xs"; const std::string bucket_ = "test"; @@ -83,12 +83,12 @@ void ObsClientTest::StreamingUpload() ASSERT_EQ(list.size(), 0u); } -TEST_F(ObsClientTest, StreamingUpload) +TEST_F(ObsClientTest, DISABLED_StreamingUpload) { StreamingUpload(); } -TEST_F(ObsClientTest, LEVEL2_MultiPartUpload) +TEST_F(ObsClientTest, DISABLED_MultiPartUpload) { size_t sz = 201 * 1024 * 1024; std::shared_ptr buf = std::make_shared(randData_.GetRandomString(sz)); @@ -153,7 +153,7 @@ TEST_F(ObsClientTest, DISABLED_ConcurrentUploadDownload) ASSERT_EQ(list.size(), 0u); } -TEST_F(ObsClientTest, ConcurrentOperations) +TEST_F(ObsClientTest, DISABLED_ConcurrentOperations) { size_t numThread = 50; auto job = [this] (int i) { @@ -221,7 +221,7 @@ TEST_F(ObsClientTest, DISABLED_ListLargeAmountObjects) ASSERT_EQ(list.size(), 0u); } -TEST_F(ObsClientTest, ListMultiVersion) +TEST_F(ObsClientTest, DISABLED_ListMultiVersion) { size_t numObj = 100; std::vector paths(numObj); @@ -260,7 +260,7 @@ TEST_F(ObsClientTest, ListMultiVersion) ASSERT_EQ(list.size(), 0u); } -TEST_F(ObsClientTest, LEVEL1_HandleFailedUpload) +TEST_F(ObsClientTest, DISABLED_HandleFailedUpload) { int timeoutMs = 5000; DS_ASSERT_OK(datasystem::inject::Set("ObsClient.OnePartUpload.sleepReturnFailure", "1*call(10000)")); diff --git a/tests/st/common/obs_client/obs_persistence_api_test.cpp b/tests/st/common/obs_client/obs_persistence_api_test.cpp index 0a7775d57031c3c29c4591325092a684606e4c0c..cb9d16bfc17ee6bb70a4f210ce4ed3d6e42ee4b3 100644 --- a/tests/st/common/obs_client/obs_persistence_api_test.cpp +++ b/tests/st/common/obs_client/obs_persistence_api_test.cpp @@ -58,7 +58,7 @@ void ObsPersistenceApiTest::SetUp() pApi_->Init(); } -TEST_F(ObsPersistenceApiTest, SaveSmallObject) +TEST_F(ObsPersistenceApiTest, DISABLED_SaveSmallObject) { size_t sz = 100; std::string key = "SaveSmallObject"; @@ -73,7 +73,7 @@ TEST_F(ObsPersistenceApiTest, SaveSmallObject) DS_ASSERT_NOT_OK(pApi_->Get(key, 0, timeout_, content)); } -TEST_F(ObsPersistenceApiTest, LEVEL2_SaveLargeObject) +TEST_F(ObsPersistenceApiTest, DISABLED__SaveLargeObject) { size_t sz = 200 * 1024 * 1024; std::string key = "SaveLargeObject"; @@ -88,7 +88,7 @@ TEST_F(ObsPersistenceApiTest, LEVEL2_SaveLargeObject) DS_ASSERT_NOT_OK(pApi_->Get(key, 0, timeout_, content)); } -TEST_F(ObsPersistenceApiTest, GetLatestFromMultiVersion) +TEST_F(ObsPersistenceApiTest, DISABLED_GetLatestFromMultiVersion) { size_t sz = 200 * 1024; std::string key = "GetLatest"; diff --git a/tests/ut/common/ak_sk/ak_sk_test.cpp b/tests/ut/common/ak_sk/ak_sk_test.cpp index c3006c673f0aec73dfc73404bbb8750d583eba73..982c3eed54f88f58693c1cd9a90d6603382dd649 100644 --- a/tests/ut/common/ak_sk/ak_sk_test.cpp +++ b/tests/ut/common/ak_sk/ak_sk_test.cpp @@ -26,7 +26,6 @@ #include "datasystem/common/inject/inject_point.h" #include "datasystem/common/encrypt/secret_manager.h" #include "datasystem/common/util/raii.h" -#include "datasystem/common/aes/aes_impl.h" #include "common.h" #include "datasystem/utils/sensitive_value.h" @@ -34,7 +33,6 @@ namespace datasystem { namespace ut { class AkSkManagerHelper : public AkSkManager { public: - using datasystem::AkSkManager::ConstructAesAndDecrypt; }; class AkSkTest : public CommonTest { @@ -64,20 +62,6 @@ public: } } - Status EncodeEncryptedData(std::string &cipherText) - { - auto strs = Split(cipherText, ":"); - const auto splitLen = 3; - if (strs.size() != splitLen) { - LOG(ERROR) << "Failed to encode cipherText, invalid strs size:" << strs.size(); - RETURN_STATUS(K_INVALID, "Invalid cipherText format"); - } - auto byteContent = strs[splitLen - 1]; - auto hexContent = AesImpl::EncodeToHexString(strs[splitLen - 1]); - cipherText = strs[0] + ":" + hexContent + strs[1]; - return Status::OK(); - } - protected: std::string accessKey_ = "QTWAOYTTINDUT2QVKYUC"; std::string secretKey_ = "MFyfvK41ba2giqM7**********KGpownRZlmVmHc"; @@ -130,27 +114,5 @@ TEST_F(AkSkTest, AkSkCompatibility) std::string expectSign(expectSignRaw, sizeof(expectSignRaw) - 1); ASSERT_EQ(req.signature(), expectSign); } - -TEST_F(AkSkTest, TestAesDecryptData) -{ - // construct encrypted secret key from iam, format: iv:cipherText+tag - std::string secretKey = "123456"; - std::string hexDataKey = "1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF1234567890ABCDEF"; - auto bytePerHex = 2; - const auto decodeDkSize = hexDataKey.size() / bytePerHex; - auto decodeDk = std::make_unique(decodeDkSize + 1); - DS_ASSERT_OK( - AesImpl::DecodeToString(hexDataKey.c_str(), hexDataKey.size(), decodeDk.get(), decodeDkSize + 1, true)); - auto aes = std::make_unique(SensitiveValue(decodeDk.get(), decodeDkSize), AesImpl::Algorithm::AES_256_GCM); - std::string cipherText; - DS_ASSERT_OK(aes->Encrypt(SensitiveValue(secretKey), cipherText)); - DS_ASSERT_OK(EncodeEncryptedData(cipherText)); - - datasystem::inject::Set("SecretManager.RootKeyActive", "return()"); - SensitiveValue encryptData(cipherText); - DS_ASSERT_OK(akSkManager_->SetClientAkSk("ak", "sk", hexDataKey)); - DS_ASSERT_OK(akSkManager_->ConstructAesAndDecrypt(encryptData)); - ASSERT_EQ(encryptData.GetData(), secretKey); -} } // namespace ut } // namespace datasystem \ No newline at end of file diff --git a/tests/ut/common/obs_client/cloud_service_rotation_test.cpp b/tests/ut/common/obs_client/cloud_service_rotation_test.cpp index bf58725d691b6dd25682875b298071cb6e428ad7..9f7f6f581546d0810b4fee267f36d57bd296ee8a 100644 --- a/tests/ut/common/obs_client/cloud_service_rotation_test.cpp +++ b/tests/ut/common/obs_client/cloud_service_rotation_test.cpp @@ -32,7 +32,7 @@ const int DEFAULT_TTL_SECOND = 86400; const std::string DEFAULT_PROJECT_ID = "mock_projectID"; const std::string DEFAULT_REGION_ID = "mock_regionID"; const std::string DEFAULT_IDENTITY_PROVIDER = "mock_provider"; -const std::string DEFAULT_IAM_HOST_NAME = "iam.cn-north-7.myhuaweicloud.com"; +const std::string DEFAULT_IAM_HOST_NAME = "iam.cn-north-7.mycloud.com"; namespace datasystem { namespace ut { diff --git a/tests/ut/common/obs_client/obs_client_test.cpp b/tests/ut/common/obs_client/obs_client_test.cpp index 06f8cc550676b0db016d4f5096a74ba16f00e46a..a2565bbb3e68830b7f97ba6c7098e94429593ee8 100644 --- a/tests/ut/common/obs_client/obs_client_test.cpp +++ b/tests/ut/common/obs_client/obs_client_test.cpp @@ -40,7 +40,7 @@ const int DEFAULT_TTL_SECOND = 86400; const std::string DEFAULT_PROJECT_ID = "mock_projectID"; const std::string DEFAULT_REGION_ID = "mock_regionID"; const std::string DEFAULT_IDENTITY_PROVIDER = "mock_provider"; -const std::string DEFAULT_IAM_HOST_NAME = "iam.cn-north-7.myhuaweicloud.com"; +const std::string DEFAULT_IAM_HOST_NAME = "iam.cn-north-7.mycloud.com"; namespace datasystem { namespace ut { @@ -68,7 +68,7 @@ public: protected: RandomData randData_; - const std::string obsEndpoint_ = "ddl.test.huawei.com:19000"; + const std::string obsEndpoint_ = "ddl.test.com:19000"; const std::string bucket_ = "test"; const std::string tokenRotationConfig_ = "TOKEN_ROTATION_CONFIG"; RotationTokenConf rotationConf_; @@ -132,7 +132,7 @@ void ObsClientTokenRotationTest::TestTokenRotation(size_t checkOriginTokenNum, b DS_ASSERT_OK(client_->CheckValidRotationToken()); } -TEST_F(ObsClientTokenRotationTest, TestObsClientInitSuccess) +TEST_F(ObsClientTokenRotationTest, DISABLED_TestObsClientInitSuccess) { InitializeCsmsToken(); DS_ASSERT_OK(datasystem::inject::Set("ObsClient.TokenRotationInit.FirstInitCredentialInfo", @@ -141,7 +141,7 @@ TEST_F(ObsClientTokenRotationTest, TestObsClientInitSuccess) DS_ASSERT_OK(client_->Init()); } -TEST_F(ObsClientTokenRotationTest, TestObsClientReadCsmsTokenError) +TEST_F(ObsClientTokenRotationTest, DISABLED_TestObsClientReadCsmsTokenError) { std::string csmsTokenPath = FLAGS_log_dir + "/csms-token"; DS_ASSERT_OK(datasystem::inject::Set("ObsClient.ReadCSMSToken.readTestOidcToken", @@ -152,7 +152,7 @@ TEST_F(ObsClientTokenRotationTest, TestObsClientReadCsmsTokenError) DS_ASSERT_NOT_OK(client_->Init()); } -TEST_F(ObsClientTokenRotationTest, TestObsClientReadConfigEnvError) +TEST_F(ObsClientTokenRotationTest, DISABLED_TestObsClientReadConfigEnvError) { int initTimes = 5; InitializeCsmsToken(initTimes); @@ -200,14 +200,14 @@ TEST_F(ObsClientTokenRotationTest, TestObsClientReadConfigEnvError) DS_ASSERT_NOT_OK(client_->Init()); } -TEST_F(ObsClientTokenRotationTest, TestObsClientSuccessUpdateToken) +TEST_F(ObsClientTokenRotationTest, DISABLED_TestObsClientSuccessUpdateToken) { size_t checkOriginTokenNum = 2; bool wantFirstUpdateFailed = false; TestTokenRotation(checkOriginTokenNum, wantFirstUpdateFailed); } -TEST_F(ObsClientTokenRotationTest, TestObsClientFirstFailedAndFinalSuccessUpdateToken) +TEST_F(ObsClientTokenRotationTest, DISABLED_TestObsClientFirstFailedAndFinalSuccessUpdateToken) { size_t checkOriginTokenNum = 3; bool wantFirstUpdateFailed = true; diff --git a/tests/ut/common/util/aes_test.cpp b/tests/ut/common/util/aes_test.cpp deleted file mode 100644 index 2c19f38254e50f4f5246b78cedc93e250c8c06ae..0000000000000000000000000000000000000000 --- a/tests/ut/common/util/aes_test.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (c) Huawei Technologies Co., Ltd. 2022. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Description: A very, very boring logging test. - */ - -#include "datasystem/utils/aes.h" -#include -#include - -#include "common.h" -#include "datasystem/utils/sensitive_value.h" -#include "datasystem/common/log/log.h" - -namespace datasystem { -namespace ut { -class AesTest : public CommonTest {}; - -TEST_F(AesTest, TestAes128) -{ - std::string keyStr(16, 'a'); - SensitiveValue key(keyStr); - Aes aes(key, Aes::Algorithm::AES_128_GCM); - SensitiveValue plainText("test encrypt"); - std::string cipherText; - DS_EXPECT_OK(aes.Encrypt(plainText, cipherText)); - SensitiveValue plainText2; - DS_EXPECT_OK(aes.Decrypt(cipherText, plainText2)); - EXPECT_EQ(plainText, plainText2); -} - -TEST_F(AesTest, TestAes192) -{ - std::string keyStr(24, 'a'); - SensitiveValue key(keyStr); - Aes aes(key, Aes::Algorithm::AES_192_GCM); - SensitiveValue plainText("test encrypt"); - std::string cipherText; - DS_EXPECT_OK(aes.Encrypt(plainText, cipherText)); - SensitiveValue plainText2; - DS_EXPECT_OK(aes.Decrypt(cipherText, plainText2)); - EXPECT_EQ(plainText, plainText2); -} - -TEST_F(AesTest, TestAes256) -{ - std::string keyStr(32, 'a'); - SensitiveValue key(keyStr); - Aes aes(key, Aes::Algorithm::AES_256_GCM); - SensitiveValue plainText("test encrypt"); - std::string cipherText; - DS_EXPECT_OK(aes.Encrypt(plainText, cipherText)); - SensitiveValue plainText2; - DS_EXPECT_OK(aes.Decrypt(cipherText, plainText2)); - EXPECT_EQ(plainText, plainText2); -} - -TEST_F(AesTest, TestBigData) -{ - size_t dataSize = 10 * 1024 * 1024; - std::string data(dataSize, 'a'); - std::string keyStr(32, 'a'); - SensitiveValue key(keyStr); - Aes aes(key, Aes::Algorithm::AES_256_GCM); - SensitiveValue plainText(data); - std::string cipherText; - DS_EXPECT_OK(aes.Encrypt(plainText, cipherText)); - SensitiveValue plainText2; - DS_EXPECT_OK(aes.Decrypt(cipherText, plainText2)); - EXPECT_EQ(plainText, plainText2); -} - -TEST_F(AesTest, TestSpecialSymbols) -{ - std::string data = "Various symbols: !@#$%^&*()-_=+[]{};:,.<>?/\\|\"'"; - std::string keyStr(32, 'a'); - SensitiveValue key(keyStr); - Aes aes(key, Aes::Algorithm::AES_256_GCM); - SensitiveValue plainText(data); - std::string cipherText; - DS_EXPECT_OK(aes.Encrypt(plainText, cipherText)); - SensitiveValue plainText2; - DS_EXPECT_OK(aes.Decrypt(cipherText, plainText2)); - EXPECT_EQ(plainText, plainText2); -} - -} // namespace ut -} // namespace datasystem \ No newline at end of file diff --git a/tests/ut/common/util/validator_test.cpp b/tests/ut/common/util/validator_test.cpp index ee5c592c049d9837a99ff38177caabf1fe1b7128..bc3a38179ff58f87d8a295d625b748c667c4f72f 100644 --- a/tests/ut/common/util/validator_test.cpp +++ b/tests/ut/common/util/validator_test.cpp @@ -205,11 +205,11 @@ TEST_F(ValidatorTest, TestValidateEtcdAddresses) ASSERT_TRUE( Validator::ValidateEtcdAddresses("FlagName", "localhost:1,yr-core-etcd.default.svc.cluster.local:2379")); ASSERT_TRUE(Validator::ValidateEtcdAddresses( - "FlagName", "huawei.com:6553,test.com:0,yr-core-etcd.default.svc.cluster.local:2379")); + "FlagName", "huahuahua.com:6553,test.com:0,yr-core-etcd.default.svc.cluster.local:2379")); ASSERT_FALSE(Validator::ValidateEtcdAddresses("FlagName", "test:0,yr-core-etcd.default.svc.cluster.local:6")); ASSERT_FALSE(Validator::ValidateEtcdAddresses( - "FlagName", "huawei.com:6553,test:0,yr-core-etcd.default.svc.cluster.local:65536")); + "FlagName", "huahuahua.com:6553,test:0,yr-core-etcd.default.svc.cluster.local:65536")); } TEST_F(ValidatorTest, ValidateFailed) diff --git a/tests/ut/gen_cert.sh b/tests/ut/gen_cert.sh index 04b589eefa1037400fc23fdad0a73f0b07ff7d33..1426b660525b116b33d8c40f5cafb95e5dc88fa6 100644 --- a/tests/ut/gen_cert.sh +++ b/tests/ut/gen_cert.sh @@ -27,26 +27,26 @@ EOF unset LD_LIBRARY_PATH # Create the CA Certificate and Key -openssl req -keyout certs/ca.key -out certs/ca.crt -passin pass:huawei -passout pass:huawei \ - -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=huawei/OU=Test/CN=etcd CA" -config certs/etcd_ssl.conf -new -x509 -extensions v3_ca +openssl req -keyout certs/ca.key -out certs/ca.crt -passin pass:example -passout pass:example \ + -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=example/OU=Test/CN=etcd CA" -config certs/etcd_ssl.conf -new -x509 -extensions v3_ca # Generate valid Server Key/Cert -openssl genrsa -passout pass:huawei -out certs/etcd-server.key 4096 -openssl req -passin pass:huawei -new -key certs/etcd-server.key -out server.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=huawei/OU=Server/CN=etcd" -config certs/etcd_ssl.conf -openssl x509 -req -passin pass:huawei -days 365 -in server.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-server.crt -extensions v3_req -extfile certs/etcd_ssl.conf +openssl genrsa -passout pass:example -out certs/etcd-server.key 4096 +openssl req -passin pass:example -new -key certs/etcd-server.key -out server.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=example/OU=Server/CN=etcd" -config certs/etcd_ssl.conf +openssl x509 -req -passin pass:example -days 365 -in server.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-server.crt -extensions v3_req -extfile certs/etcd_ssl.conf # Remove passphrase from the Server Key -openssl rsa -passin pass:huawei -in certs/etcd-server.key -out certs/etcd-server.key +openssl rsa -passin pass:example -in certs/etcd-server.key -out certs/etcd-server.key # Generate valid Client Key/Cert -openssl genrsa -passout pass:huawei -out certs/etcd-client.key 4096 -openssl req -passin pass:huawei -new -key certs/etcd-client.key -out client.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=huawei/OU=Client/CN=etcd" -openssl x509 -passin pass:huawei -req -days 365 -in client.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-client.crt -extensions v3_req -extfile certs/etcd_ssl.conf +openssl genrsa -passout pass:example -out certs/etcd-client.key 4096 +openssl req -passin pass:example -new -key certs/etcd-client.key -out client.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=example/OU=Client/CN=etcd" +openssl x509 -passin pass:example -req -days 365 -in client.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-client.crt -extensions v3_req -extfile certs/etcd_ssl.conf # Remove passphrase from Client Key -openssl rsa -passin pass:huawei -in certs/etcd-client.key -out certs/etcd-client.key +openssl rsa -passin pass:example -in certs/etcd-client.key -out certs/etcd-client.key -openssl pkcs12 -export -in certs/etcd-client.crt -inkey certs/etcd-client.key -passout pass:huawei -certfile certs/ca.crt -out certs/etcd.p12 +openssl pkcs12 -export -in certs/etcd-client.crt -inkey certs/etcd-client.key -passout pass:example -certfile certs/ca.crt -out certs/etcd.p12 rm -f ./server.csr rm -f ./client.csr diff --git a/tests/ut/gen_cert_with_passphrase.sh b/tests/ut/gen_cert_with_passphrase.sh index 119d2a978e35348381541ba761f4b9987ca3604c..056cc6a1aa30cc93550f3ed5a03ad4c2b333ba63 100644 --- a/tests/ut/gen_cert_with_passphrase.sh +++ b/tests/ut/gen_cert_with_passphrase.sh @@ -27,24 +27,24 @@ EOF unset LD_LIBRARY_PATH # Create the CA Certificate and Key -openssl req -keyout certs/ca.key -out certs/ca.crt -passin pass:huawei -passout pass:huawei \ - -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=huawei/OU=Test/CN=etcd CA" -config certs/etcd_ssl.conf -new -x509 -extensions v3_ca +openssl req -keyout certs/ca.key -out certs/ca.crt -passin pass:example -passout pass:example \ + -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=example/OU=Test/CN=etcd CA" -config certs/etcd_ssl.conf -new -x509 -extensions v3_ca # Generate valid Server Key/Cert -openssl genrsa -passout pass:huawei -out certs/etcd-server.key 4096 -openssl req -passin pass:huawei -new -key certs/etcd-server.key -out server.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=huawei/OU=Server/CN=etcd" -config certs/etcd_ssl.conf -openssl x509 -req -passin pass:huawei -days 365 -in server.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-server.crt -extensions v3_req -extfile certs/etcd_ssl.conf +openssl genrsa -passout pass:example -out certs/etcd-server.key 4096 +openssl req -passin pass:example -new -key certs/etcd-server.key -out server.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=example/OU=Server/CN=etcd" -config certs/etcd_ssl.conf +openssl x509 -req -passin pass:example -days 365 -in server.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-server.crt -extensions v3_req -extfile certs/etcd_ssl.conf # Remove passphrase from the Server Key -openssl rsa -passin pass:huawei -in certs/etcd-server.key -out certs/etcd-server.key +openssl rsa -passin pass:example -in certs/etcd-server.key -out certs/etcd-server.key # Generate valid Client Key/Cert -openssl genrsa -aes128 -passout pass:huawei -out certs/etcd-client.key 4096 -openssl req -passin pass:huawei -new -key certs/etcd-client.key -out client.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=huawei/OU=Client/CN=etcd" -openssl x509 -passin pass:huawei -req -days 365 -in client.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-client.crt -extensions v3_req -extfile certs/etcd_ssl.conf +openssl genrsa -aes128 -passout pass:example -out certs/etcd-client.key 4096 +openssl req -passin pass:example -new -key certs/etcd-client.key -out client.csr -subj "/C=CN/ST=GuangDong/L=ShenZhen/O=huaOU=Client/CN=etcd" +openssl x509 -passin pass:example -req -days 365 -in client.csr -CA certs/ca.crt -CAkey certs/ca.key -set_serial 01 -out certs/etcd-client.crt -extensions v3_req -extfile certs/etcd_ssl.conf cat > certs/passphrase << EOF -huawei +example EOF rm -f ./server.csr diff --git a/third_party/patches/obs/3.21.8/obs-sdk-cmake-install.patch b/third_party/patches/obs/3.21.8/obs-sdk-cmake-install.patch deleted file mode 100644 index 1ef19835e13eb2cf255424eb1eb4ee7f1769e701..0000000000000000000000000000000000000000 --- a/third_party/patches/obs/3.21.8/obs-sdk-cmake-install.patch +++ /dev/null @@ -1,303 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 12bb146..a32192c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -25,49 +25,33 @@ if(NOT CMAKE_HOST_WIN32) - endif() - - option(USE_CUSTOM "option for custom library path" OFF) --set(SECUREC_INC_DIR ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/include) -+set(SECUREC_INC_DIR ${SECUREC_ROOT_DIR}/include) - set(CURL_VERSION curl-7.78.0) - set(OPENSSL_VERSION openssl-1.1.1k) --set(LIBXML2_VERSION libxml2-2.9.9) -+set(LIBXML2_VERSION libxml2-2.9.12) - set(PCRE_VERSION pcre-8.45) - set(ICONV_VERSION iconv-1.15) - - -- -+set(PCRE_INC_DIR ${PCRE_ROOT_DIR}/include) -+set(ICONV_INC_DIR ${ICONV_ROOT_DIR}/include) -+set(LIBXML2_INC_DIR ${XML2_ROOT_DIR}/include/libxml2) - execute_process(COMMAND uname -m OUTPUT_VARIABLE OARCH) - string(STRIP "${OARCH}" ARCH) - message(">>> ARCH ${ARCH}") - if (${ARCH} STREQUAL "aarch64") -- set(ESDK_LOG_INC_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10) -- set(ESDK_LOG_LIB_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/C/aarch64) - set(LINKARCH "arm") -- #execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile.aarch64) -+ execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile.aarch64) - elseif(${ARCH} STREQUAL "x86_64") -- set(ESDK_LOG_INC_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10) -- set(ESDK_LOG_LIB_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/C/linux_64) - set(LINKARCH "linux") -- #execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile) -+ execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile) - endif() - - if(NOT USE_CUSTOM) -- set(CURL_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${CURL_VERSION}/include) -- set(CURL_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${CURL_VERSION}/lib) -- set(OPENSSL_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${OPENSSL_VERSION}/include) -- set(OPENSSL_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${OPENSSL_VERSION}/lib) -- set(LIBXML2_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${LIBXML2_VERSION}/include) -- set(LIBXML2_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${LIBXML2_VERSION}/lib) -- set(PCRE_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${PCRE_VERSION}/include/pcre) -- set(PCRE_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${PCRE_VERSION}/lib) -- set(ICONV_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${ICONV_VERSION}/include) -- set(ICONV_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${ICONV_VERSION}/lib) -- set(SECUREC_LIB_DIR ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/lib/${LINKARCH}) -+ set(OPENSSL_INC_DIR ${OPENSSL_ROOT_DIR}/include) -+ set(OPENSSL_LIB_DIR ${OPENSSL_ROOT_DIR}/lib) -+ set(SECUREC_LIB_DIR ${SECUREC_ROOT_DIR}/lib) - else() -- if(NOT DEFINED CURL_INC_DIR) -- set(CURL_INC_DIR "/usr/include" CACHE STRING "") -- endif() -- if(NOT DEFINED CURL_LIB_DIR) -- set(CURL_LIB_DIR "/usr/lib64" CACHE STRING "") -- endif() - if(NOT DEFINED OPENSSL_INC_DIR) - set(OPENSSL_INC_DIR "/usr/include" CACHE STRING "") - endif() -@@ -80,12 +64,6 @@ execute_process(COMMAND uname -m OUTPUT_VARIABLE OARCH) - if(NOT DEFINED LIBXML2_LIB_DIR) - set(LIBXML2_LIB_DIR "/usr/lib64" CACHE STRING "") - endif() -- if(NOT DEFINED PCRE_INC_DIR) -- set(PCRE_INC_DIR "/usr/include" CACHE STRING "") -- endif() -- if(NOT DEFINED PCRE_LIB_DIR) -- set(PCRE_LIB_DIR "/usr/lib64" CACHE STRING "") -- endif() - if(NOT DEFINED ICONV_INC_DIR) - set(ICONV_INC_DIR "/usr/include" CACHE STRING "") - endif() -@@ -94,16 +72,12 @@ execute_process(COMMAND uname -m OUTPUT_VARIABLE OARCH) - endif() - endif() - --message(STATUS "CURL_INC_DIR: ${CURL_INC_DIR}") --message(STATUS "CURL_LIB_DIR: ${CURL_LIB_DIR}") - message(STATUS "OPENSSL_INC_DIR: ${OPENSSL_INC_DIR}") - message(STATUS "OPENSSL_LIB_DIR: ${OPENSSL_LIB_DIR}") - message(STATUS "LIBXML2_INC_DIR: ${LIBXML2_INC_DIR}") --message(STATUS "LIBXML2_LIB_DIR: ${LIBXML2_LIB_DIR}") - message(STATUS "PCRE_INC_DIR: ${PCRE_INC_DIR}") --message(STATUS "PCRE_LIB_DIR: ${PCRE_LIB_DIR}") - message(STATUS "ICONV_INC_DIR: ${ICONV_INC_DIR}") --message(STATUS "ICONV_LIB_DIR: ${ICONV_LIB_DIR}") -+message(STATUS "SECUREC_LIB_DIR: ${SECUREC_LIB_DIR}") - - #*********************************************************************** - #* -@@ -153,31 +127,180 @@ message(STATUS ">>> CXX_FLAGS : " ${CMAKE_CXX_FLAGS}) - #*********************************************************************** - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) - set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) -+ -+#*********************************************************************** -+#* -+#* log dir -+#* -+#*********************************************************************** -+execute_process( -+ COMMAND ${CMAKE_CXX_COMPILER} -dumpversion -+ OUTPUT_VARIABLE GCC_VERSION -+ OUTPUT_STRIP_TRAILING_WHITESPACE -+) -+ -+message(STATUS "start build log4cpp") -+set(log4cpp_PATH ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/log4cpp/) -+ -+INCLUDE_DIRECTORIES(${log4cpp_PATH}/include/) -+INCLUDE_DIRECTORIES(${log4cpp_PATH}) -+add_library(log4cpp STATIC -+ ${log4cpp_PATH}/src/Appender.cpp -+ ${log4cpp_PATH}/src/AppenderSkeleton.cpp -+ ${log4cpp_PATH}/src/AppendersFactory.cpp -+ ${log4cpp_PATH}/src/BufferingAppender.cpp -+ ${log4cpp_PATH}/src/FactoryParams.cpp -+ ${log4cpp_PATH}/src/LayoutsFactory.cpp -+ ${log4cpp_PATH}/src/LevelEvaluator.cpp -+ ${log4cpp_PATH}/src/Localtime.cpp -+ ${log4cpp_PATH}/src/PassThroughLayout.cpp -+ ${log4cpp_PATH}/src/TriggeringEventEvaluatorFactory.cpp -+ ${log4cpp_PATH}/src/LayoutAppender.cpp -+ ${log4cpp_PATH}/src/FileAppender.cpp -+ ${log4cpp_PATH}/src/DailyRollingFileAppender.cpp -+ ${log4cpp_PATH}/src/RollingFileAppender.cpp -+ ${log4cpp_PATH}/src/FixedContextCategory.cpp -+ ${log4cpp_PATH}/src/IdsaAppender.cpp -+ ${log4cpp_PATH}/src/OstreamAppender.cpp -+ ${log4cpp_PATH}/src/StringQueueAppender.cpp -+ ${log4cpp_PATH}/src/SyslogAppender.cpp -+ ${log4cpp_PATH}/src/RemoteSyslogAppender.cpp -+ ${log4cpp_PATH}/src/SimpleLayout.cpp -+ ${log4cpp_PATH}/src/BasicLayout.cpp -+ ${log4cpp_PATH}/src/PatternLayout.cpp -+ ${log4cpp_PATH}/src/Category.cpp -+ ${log4cpp_PATH}/src/CategoryStream.cpp -+ ${log4cpp_PATH}/src/HierarchyMaintainer.cpp -+ ${log4cpp_PATH}/src/Configurator.cpp -+ ${log4cpp_PATH}/src/BasicConfigurator.cpp -+ ${log4cpp_PATH}/src/SimpleConfigurator.cpp -+ ${log4cpp_PATH}/src/PropertyConfigurator.cpp -+ ${log4cpp_PATH}/src/PropertyConfiguratorImpl.cpp -+ ${log4cpp_PATH}/src/LoggingEvent.cpp -+ ${log4cpp_PATH}/src/Priority.cpp -+ ${log4cpp_PATH}/src/NDC.cpp -+ ${log4cpp_PATH}/src/Filter.cpp -+ ${log4cpp_PATH}/src/TimeStamp.cpp -+ ${log4cpp_PATH}/src/StringUtil.cpp -+ ${log4cpp_PATH}/src/Properties.cpp -+ ${log4cpp_PATH}/src/Win32DebugAppender.cpp -+ ${log4cpp_PATH}/src/NTEventLogAppender.cpp -+ ${log4cpp_PATH}/src/DllMain.cpp -+ ${log4cpp_PATH}/src/DummyThreads.cpp -+ ${log4cpp_PATH}/src/MSThreads.cpp -+ ${log4cpp_PATH}/src/OmniThreads.cpp -+ ${log4cpp_PATH}/src/PThreads.cpp -+ ${log4cpp_PATH}/src/PortabilityImpl.cpp -+ ${log4cpp_PATH}/src/AbortAppender.cpp -+ ) -+ -+add_definitions(-fPIC) -+ -+# 检查 GCC 版本号是否为 7.5 -+if(GCC_VERSION MATCHES "7") -+ target_compile_options(log4cpp PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+else() -+ target_compile_options(log4cpp PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=catch-value= -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+endif() -+# set_target_properties(log4cpp PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/lib/liblog4cpp.so) -+ -+message(STATUS "start build eSDKLogAPI") -+ -+set(eSDKLogAPI_PATH ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/eSDKLogAPI/) -+set(vos_PATH ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/vos/) -+ -+INCLUDE_DIRECTORIES(${eSDKLogAPI_PATH}) -+INCLUDE_DIRECTORIES(${SECUREC_INC_DIR}) -+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/) -+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/vos/) -+ -+file(GLOB eSDKLogAPI_SOURCES -+ "${eSDKLogAPI_PATH}/*.cpp" -+ "${vos_PATH}/*.cpp") -+ -+add_library(eSDKLogAPI SHARED -+ ${eSDKLogAPI_SOURCES}) -+# 检查 GCC 版本号是否为 7.5 -+if(GCC_VERSION MATCHES "7") -+ target_compile_options(eSDKLogAPI PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+else() -+ target_compile_options(eSDKLogAPI PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=catch-value= -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+endif() -+target_link_libraries(eSDKLogAPI log4cpp pthread) - - #*********************************************************************** - #* - #* Link lib - #* - #*********************************************************************** --include_directories(${CURL_INC_DIR}) -+find_package(CURL REQUIRED PATHS ${CURL_ROOT_DIR} CONFIG) -+find_library(PCRE -+ NAMES pcre -+ PATHS ${PCRE_ROOT_DIR} -+ PATH_SUFFIXES lib lib64 -+ REQUIRED -+ NO_DEFAULT_PATH) -+find_library(ICONV -+ NAMES iconv -+ PATHS ${ICONV_ROOT_DIR} -+ PATH_SUFFIXES lib lib64 -+ REQUIRED -+ NO_DEFAULT_PATH) -+find_library(XML2 -+ NAMES xml2 -+ PATHS ${XML2_ROOT_DIR} -+ PATH_SUFFIXES lib lib64 -+ REQUIRED -+ NO_DEFAULT_PATH) - include_directories(${OPENSSL_INC_DIR}) - include_directories(${LIBXML2_INC_DIR}) - include_directories(${PCRE_INC_DIR}) - include_directories(${ICONV_INC_DIR}) - include_directories(${SECUREC_INC_DIR}) --include_directories(${ESDK_LOG_INC_DIR}) - --link_directories(${CURL_LIB_DIR}) - link_directories(${OPENSSL_LIB_DIR}) - link_directories(${LIBXML2_LIB_DIR}) --link_directories(${PCRE_LIB_DIR}) - link_directories(${ICONV_LIB_DIR}) - link_directories(${SECUREC_LIB_DIR}) --link_directories(${ESDK_LOG_LIB_DIR}) - include_directories(${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/inc) - aux_source_directory(${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/src SOURCE_DIR) - add_library(eSDKOBS SHARED ${SOURCE_DIR}) --target_link_libraries(eSDKOBS curl ssl xml2 pcre iconv securec eSDKLogAPI) -+ -+target_link_libraries(eSDKOBS CURL::libcurl ssl ${XML2} ${PCRE} ${ICONV} securec eSDKLogAPI) -+install(TARGETS eSDKOBS eSDKLogAPI log4cpp -+ EXPORT OBSTargets -+ DESTINATION lib) -+install(FILES ${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/inc/eSDKOBS.h -+ DESTINATION include) -+install(EXPORT OBSTargets -+ FILE OBSTargets.cmake -+ DESTINATION lib/cmake/OBS) -+ -+include(CMakePackageConfigHelpers) -+configure_package_config_file(${CMAKE_SOURCE_DIR}/config.cmake.in -+ "${CMAKE_CURRENT_BINARY_DIR}/OBSConfig.cmake" -+ INSTALL_DESTINATION "lib/cmake/OBS" -+ NO_SET_AND_CHECK_MACRO -+ NO_CHECK_REQUIRED_COMPONENTS_MACRO) -+write_basic_package_version_file( -+ "${CMAKE_CURRENT_BINARY_DIR}/OBSConfigVersion.cmake" -+ VERSION 3.21.8 -+ COMPATIBILITY AnyNewerVersion) -+install(FILES -+ ${CMAKE_CURRENT_BINARY_DIR}/OBSConfig.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/OBSConfigVersion.cmake -+ DESTINATION lib/cmake/OBS -+) -+set(OBS_DEP_LIBS ${PCRE_ROOT_DIR}/lib/libpcre.so* ${ICONV_ROOT_DIR}/lib/libiconv.so* ${XML2_ROOT_DIR}/lib/libxml2.so*) -+foreach(PATTERN IN LISTS OBS_DEP_LIBS) -+ file(GLOB_RECURSE PATH_LIST ${PATTERN}) -+ foreach(FILE_PATH ${PATH_LIST}) -+ message("${FILE_PATH}") -+ install(FILES ${FILE_PATH} DESTINATION lib) -+ endforeach() -+endforeach() -+ -+ - - #*********************************************************************** - #* -@@ -201,4 +324,4 @@ unset(ICONV_LIB_DIR CACHE) - #* add source code dir - #* - #*********************************************************************** --#add_subdirectory(src) -\ No newline at end of file -+#add_subdirectory(src) -diff --color -Npur huaweicloud-sdk-c-obs-3.21.8_old/config.cmake.in huaweicloud-sdk-c-obs-3.21.8_new/config.cmake.in ---- huaweicloud-sdk-c-obs-3.21.8_old/config.cmake.in 1970-01-01 08:00:00.000000000 +0800 -+++ huaweicloud-sdk-c-obs-3.21.8_new/config.cmake.in 2023-12-29 11:00:38.103422780 +0800 -@@ -0,0 +1,9 @@ -+@PACKAGE_INIT@ -+ -+include("${CMAKE_CURRENT_LIST_DIR}/OBSTargets.cmake") -+ -+# installation prefix -+get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -+get_filename_component(_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) -+ -+set(OBS_INCLUDE_DIR "${_INSTALL_PREFIX}/include") -\ No newline at end of file diff --git a/third_party/patches/obs/3.23.3/obs-sdk-cmake-install.patch b/third_party/patches/obs/3.23.3/obs-sdk-cmake-install.patch deleted file mode 100644 index 8a7d970a6fd34e6d3ac513a935b1755578167e6e..0000000000000000000000000000000000000000 --- a/third_party/patches/obs/3.23.3/obs-sdk-cmake-install.patch +++ /dev/null @@ -1,337 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index cf07ace..d013992 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -25,52 +25,35 @@ if(NOT CMAKE_HOST_WIN32) - endif() - - option(USE_CUSTOM "option for custom library path" OFF) --set(SECUREC_INC_DIR ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/include) -+set(SECUREC_INC_DIR ${SECUREC_ROOT_DIR}/include) - set(CURL_VERSION curl-7.78.0) - set(OPENSSL_VERSION openssl-1.1.1k) --set(LIBXML2_VERSION libxml2-2.9.9) -+set(LIBXML2_VERSION libxml2-2.9.12) - set(PCRE_VERSION pcre-8.45) - set(ICONV_VERSION iconv-1.15) - set(CJSON_VERSION cjson-1.7.15) - -- -- -+set(PCRE_INC_DIR ${PCRE_ROOT_DIR}/include) -+set(ICONV_INC_DIR ${ICONV_ROOT_DIR}/include) -+set(LIBXML2_INC_DIR ${XML2_ROOT_DIR}/include/libxml2) -+set(CJSON_INC_DIR ${CJSON_ROOT_DIR}/include) -+set(CJSON_LIB_DIR ${CJSON_ROOT_DIR}/lib) - execute_process(COMMAND uname -m OUTPUT_VARIABLE OARCH) - string(STRIP "${OARCH}" ARCH) - message(">>> ARCH ${ARCH}") - if (${ARCH} STREQUAL "aarch64") -- set(ESDK_LOG_INC_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10) -- set(ESDK_LOG_LIB_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/C/aarch64) - set(LINKARCH "arm") -- #execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile.aarch64) -+ execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile.aarch64) - elseif(${ARCH} STREQUAL "x86_64") -- set(ESDK_LOG_INC_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10) -- set(ESDK_LOG_LIB_DIR ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/C/linux_64) - set(LINKARCH "linux") -- #execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile) -+ execute_process(COMMAND make -f ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/src/Makefile) - endif() - - if(NOT USE_CUSTOM) -- set(CURL_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${CURL_VERSION}/include) -- set(CURL_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${CURL_VERSION}/lib) -- set(OPENSSL_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${OPENSSL_VERSION}/include) -- set(OPENSSL_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${OPENSSL_VERSION}/lib) -- set(LIBXML2_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${LIBXML2_VERSION}/include) -- set(LIBXML2_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${LIBXML2_VERSION}/lib) -- set(PCRE_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${PCRE_VERSION}/include/pcre) -- set(PCRE_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${PCRE_VERSION}/lib) -- set(ICONV_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${ICONV_VERSION}/include) -- set(ICONV_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${ICONV_VERSION}/lib) -- set(CJSON_INC_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${CJSON_VERSION}/include) -- set(CJSON_LIB_DIR ${PROJECT_SOURCE_DIR}/build/script/Provider/build/${LINKARCH}/${CJSON_VERSION}/lib) -- set(SECUREC_LIB_DIR ${PROJECT_SOURCE_DIR}/platform/huaweisecurec/lib/${LINKARCH}) -+ set(OPENSSL_INC_DIR ${OPENSSL_ROOT_DIR}/include) -+ set(OPENSSL_LIB_DIR ${OPENSSL_ROOT_DIR}/lib) -+ set(SECUREC_LIB_DIR ${SECUREC_ROOT_DIR}/lib) - else() -- if(NOT DEFINED CURL_INC_DIR) -- set(CURL_INC_DIR "/usr/include" CACHE STRING "") -- endif() -- if(NOT DEFINED CURL_LIB_DIR) -- set(CURL_LIB_DIR "/usr/lib64" CACHE STRING "") -- endif() - if(NOT DEFINED OPENSSL_INC_DIR) - set(OPENSSL_INC_DIR "/usr/include" CACHE STRING "") - endif() -@@ -83,12 +66,6 @@ execute_process(COMMAND uname -m OUTPUT_VARIABLE OARCH) - if(NOT DEFINED LIBXML2_LIB_DIR) - set(LIBXML2_LIB_DIR "/usr/lib64" CACHE STRING "") - endif() -- if(NOT DEFINED PCRE_INC_DIR) -- set(PCRE_INC_DIR "/usr/include" CACHE STRING "") -- endif() -- if(NOT DEFINED PCRE_LIB_DIR) -- set(PCRE_LIB_DIR "/usr/lib64" CACHE STRING "") -- endif() - if(NOT DEFINED ICONV_INC_DIR) - set(ICONV_INC_DIR "/usr/include" CACHE STRING "") - endif() -@@ -103,18 +80,14 @@ execute_process(COMMAND uname -m OUTPUT_VARIABLE OARCH) - endif() - endif() - --message(STATUS "CURL_INC_DIR: ${CURL_INC_DIR}") --message(STATUS "CURL_LIB_DIR: ${CURL_LIB_DIR}") - message(STATUS "OPENSSL_INC_DIR: ${OPENSSL_INC_DIR}") - message(STATUS "OPENSSL_LIB_DIR: ${OPENSSL_LIB_DIR}") - message(STATUS "LIBXML2_INC_DIR: ${LIBXML2_INC_DIR}") --message(STATUS "LIBXML2_LIB_DIR: ${LIBXML2_LIB_DIR}") - message(STATUS "PCRE_INC_DIR: ${PCRE_INC_DIR}") --message(STATUS "PCRE_LIB_DIR: ${PCRE_LIB_DIR}") - message(STATUS "ICONV_INC_DIR: ${ICONV_INC_DIR}") --message(STATUS "ICONV_LIB_DIR: ${ICONV_LIB_DIR}") - message(STATUS "CJSON_INC_DIR: ${CJSON_INC_DIR}") - message(STATUS "CJSON_LIB_DIR: ${CJSON_LIB_DIR}") -+message(STATUS "SECUREC_LIB_DIR: ${SECUREC_LIB_DIR}") - - #*********************************************************************** - #* -@@ -164,36 +137,198 @@ message(STATUS ">>> CXX_FLAGS : " ${CMAKE_CXX_FLAGS}) - #*********************************************************************** - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) - set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) -- -+ -+#*********************************************************************** -+#* -+#* log dir -+#* -+#*********************************************************************** -+execute_process( -+ COMMAND ${CMAKE_CXX_COMPILER} -dumpversion -+ OUTPUT_VARIABLE GCC_VERSION -+ OUTPUT_STRIP_TRAILING_WHITESPACE -+) -+ -+message(STATUS "start build log4cpp") -+set(log4cpp_PATH ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/log4cpp/) -+ -+INCLUDE_DIRECTORIES(${log4cpp_PATH}/include/) -+INCLUDE_DIRECTORIES(${log4cpp_PATH}) -+add_library(log4cpp STATIC -+ ${log4cpp_PATH}/src/Appender.cpp -+ ${log4cpp_PATH}/src/AppenderSkeleton.cpp -+ ${log4cpp_PATH}/src/AppendersFactory.cpp -+ ${log4cpp_PATH}/src/BufferingAppender.cpp -+ ${log4cpp_PATH}/src/FactoryParams.cpp -+ ${log4cpp_PATH}/src/LayoutsFactory.cpp -+ ${log4cpp_PATH}/src/LevelEvaluator.cpp -+ ${log4cpp_PATH}/src/Localtime.cpp -+ ${log4cpp_PATH}/src/PassThroughLayout.cpp -+ ${log4cpp_PATH}/src/TriggeringEventEvaluatorFactory.cpp -+ ${log4cpp_PATH}/src/LayoutAppender.cpp -+ ${log4cpp_PATH}/src/FileAppender.cpp -+ ${log4cpp_PATH}/src/DailyRollingFileAppender.cpp -+ ${log4cpp_PATH}/src/RollingFileAppender.cpp -+ ${log4cpp_PATH}/src/FixedContextCategory.cpp -+ ${log4cpp_PATH}/src/IdsaAppender.cpp -+ ${log4cpp_PATH}/src/OstreamAppender.cpp -+ ${log4cpp_PATH}/src/StringQueueAppender.cpp -+ ${log4cpp_PATH}/src/SyslogAppender.cpp -+ ${log4cpp_PATH}/src/RemoteSyslogAppender.cpp -+ ${log4cpp_PATH}/src/SimpleLayout.cpp -+ ${log4cpp_PATH}/src/BasicLayout.cpp -+ ${log4cpp_PATH}/src/PatternLayout.cpp -+ ${log4cpp_PATH}/src/Category.cpp -+ ${log4cpp_PATH}/src/CategoryStream.cpp -+ ${log4cpp_PATH}/src/HierarchyMaintainer.cpp -+ ${log4cpp_PATH}/src/Configurator.cpp -+ ${log4cpp_PATH}/src/BasicConfigurator.cpp -+ ${log4cpp_PATH}/src/SimpleConfigurator.cpp -+ ${log4cpp_PATH}/src/PropertyConfigurator.cpp -+ ${log4cpp_PATH}/src/PropertyConfiguratorImpl.cpp -+ ${log4cpp_PATH}/src/LoggingEvent.cpp -+ ${log4cpp_PATH}/src/Priority.cpp -+ ${log4cpp_PATH}/src/NDC.cpp -+ ${log4cpp_PATH}/src/Filter.cpp -+ ${log4cpp_PATH}/src/TimeStamp.cpp -+ ${log4cpp_PATH}/src/StringUtil.cpp -+ ${log4cpp_PATH}/src/Properties.cpp -+ ${log4cpp_PATH}/src/Win32DebugAppender.cpp -+ ${log4cpp_PATH}/src/NTEventLogAppender.cpp -+ ${log4cpp_PATH}/src/DllMain.cpp -+ ${log4cpp_PATH}/src/DummyThreads.cpp -+ ${log4cpp_PATH}/src/MSThreads.cpp -+ ${log4cpp_PATH}/src/OmniThreads.cpp -+ ${log4cpp_PATH}/src/PThreads.cpp -+ ${log4cpp_PATH}/src/PortabilityImpl.cpp -+ ${log4cpp_PATH}/src/AbortAppender.cpp -+ ) -+ -+add_definitions(-fPIC) -+ -+# 检查 GCC 版本号是否为 7.5 -+if(GCC_VERSION MATCHES "7") -+ target_compile_options(log4cpp PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+else() -+ target_compile_options(log4cpp PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=catch-value= -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+endif() -+# set_target_properties(log4cpp PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/lib/liblog4cpp.so) -+ -+message(STATUS "start build eSDKLogAPI") -+ -+set(eSDKLogAPI_PATH ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/eSDKLogAPI/) -+set(vos_PATH ${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/vos/) -+ -+INCLUDE_DIRECTORIES(${eSDKLogAPI_PATH}) -+INCLUDE_DIRECTORIES(${SECUREC_INC_DIR}) -+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/) -+INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/platform/eSDK_LogAPI_V2.1.10/vos/) -+ -+file(GLOB eSDKLogAPI_SOURCES -+ "${eSDKLogAPI_PATH}/*.cpp" -+ "${vos_PATH}/*.cpp") -+ -+add_library(eSDKLogAPI SHARED -+ ${eSDKLogAPI_SOURCES}) -+# 检查 GCC 版本号是否为 7.5 -+if(GCC_VERSION MATCHES "7") -+ target_compile_options(eSDKLogAPI PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+else() -+ target_compile_options(eSDKLogAPI PRIVATE -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wno-error=dangling-else -Wno-error=format-nonliteral -Wno-error=catch-value= -Wno-error=parentheses -Wno-error=unused-result -Wno-error=unknown-pragmas) -+endif() -+target_link_libraries(eSDKLogAPI log4cpp pthread) -+ - #*********************************************************************** - #* - #* Link lib - #* - #*********************************************************************** --include_directories(${CURL_INC_DIR}) -+find_package(CURL REQUIRED PATHS ${CURL_ROOT_DIR} CONFIG) -+find_library(PCRE -+ NAMES pcre -+ PATHS ${PCRE_ROOT_DIR} -+ PATH_SUFFIXES lib lib64 -+ REQUIRED -+ NO_DEFAULT_PATH) -+find_library(ICONV -+ NAMES iconv -+ PATHS ${ICONV_ROOT_DIR} -+ PATH_SUFFIXES lib lib64 -+ REQUIRED -+ NO_DEFAULT_PATH) -+find_library(XML2 -+ NAMES xml2 -+ PATHS ${XML2_ROOT_DIR} -+ PATH_SUFFIXES lib lib64 -+ REQUIRED -+ NO_DEFAULT_PATH) -+find_library(CJSON -+ NAMES cjson -+ PATHS ${CJSON_ROOT_DIR} -+ PATH_SUFFIXES lib lib64 -+ REQUIRED -+ NO_DEFAULT_PATH) - include_directories(${OPENSSL_INC_DIR}) - include_directories(${LIBXML2_INC_DIR}) - include_directories(${PCRE_INC_DIR}) - include_directories(${ICONV_INC_DIR}) - include_directories(${CJSON_INC_DIR}) - include_directories(${SECUREC_INC_DIR}) --include_directories(${ESDK_LOG_INC_DIR}) - --link_directories(${CURL_LIB_DIR}) - link_directories(${OPENSSL_LIB_DIR}) - link_directories(${LIBXML2_LIB_DIR}) --link_directories(${PCRE_LIB_DIR}) - link_directories(${ICONV_LIB_DIR}) - link_directories(${CJSON_LIB_DIR}) - link_directories(${SECUREC_LIB_DIR}) --link_directories(${ESDK_LOG_LIB_DIR}) - include_directories(${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/inc) - include_directories(${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/include) - aux_source_directory(${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/src SOURCE_DIR) - aux_source_directory(${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/bucket BUCKET_SOURCE_DIR) - aux_source_directory(${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/object OBJECT_SOURCE_DIR) - add_library(eSDKOBS SHARED ${SOURCE_DIR} ${BUCKET_SOURCE_DIR} ${OBJECT_SOURCE_DIR}) --target_link_libraries(eSDKOBS curl ssl xml2 pcre iconv cjson securec eSDKLogAPI) -+ -+target_link_libraries(eSDKOBS CURL::libcurl ssl ${XML2} ${PCRE} ${ICONV} ${CJSON} securec eSDKLogAPI) -+install(TARGETS eSDKOBS eSDKLogAPI log4cpp -+ EXPORT OBSTargets -+ DESTINATION lib) -+install(FILES ${CMAKE_SOURCE_DIR}/source/eSDK_OBS_API/eSDK_OBS_API_C++/inc/eSDKOBS.h -+ DESTINATION include) -+install(EXPORT OBSTargets -+ FILE OBSTargets.cmake -+ DESTINATION lib/cmake/OBS) -+ -+include(CMakePackageConfigHelpers) -+configure_package_config_file(${CMAKE_SOURCE_DIR}/config.cmake.in -+ "${CMAKE_CURRENT_BINARY_DIR}/OBSConfig.cmake" -+ INSTALL_DESTINATION "lib/cmake/OBS" -+ NO_SET_AND_CHECK_MACRO -+ NO_CHECK_REQUIRED_COMPONENTS_MACRO) -+write_basic_package_version_file( -+ "${CMAKE_CURRENT_BINARY_DIR}/OBSConfigVersion.cmake" -+ VERSION 3.23.3 -+ COMPATIBILITY AnyNewerVersion) -+install(FILES -+ ${CMAKE_CURRENT_BINARY_DIR}/OBSConfig.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/OBSConfigVersion.cmake -+ DESTINATION lib/cmake/OBS -+) -+ -+if (EXISTS ${CJSON_ROOT_DIR}/lib64) -+ set(_CJSON_ROOT_DIR ${CJSON_ROOT_DIR}/lib64) -+else() -+ set(_CJSON_ROOT_DIR ${CJSON_ROOT_DIR}/lib) -+endif() -+ -+set(OBS_DEP_LIBS ${PCRE_ROOT_DIR}/lib/libpcre.so* ${ICONV_ROOT_DIR}/lib/libiconv.so* ${XML2_ROOT_DIR}/lib/libxml2.so* ${_CJSON_ROOT_DIR}/libcjson.so*) -+foreach(PATTERN IN LISTS OBS_DEP_LIBS) -+ message("PATTERN: ${PATTERN}") -+ file(GLOB_RECURSE PATH_LIST ${PATTERN}) -+ foreach(FILE_PATH ${PATH_LIST}) -+ message("${FILE_PATH}") -+ install(FILES ${FILE_PATH} DESTINATION lib) -+ endforeach() -+endforeach() -+ - - #*********************************************************************** - #* -diff --git a/config.cmake.in b/config.cmake.in -new file mode 100644 -index 0000000..013c193 ---- /dev/null -+++ b/config.cmake.in -@@ -0,0 +1,9 @@ -+@PACKAGE_INIT@ -+ -+include("${CMAKE_CURRENT_LIST_DIR}/OBSTargets.cmake") -+ -+# installation prefix -+get_filename_component(CMAKE_CURRENT_LIST_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -+get_filename_component(_INSTALL_PREFIX "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE) -+ -+set(OBS_INCLUDE_DIR "${_INSTALL_PREFIX}/include") -\ No newline at end of file -diff --git a/platform/huaweisecurec/src/Makefile.aarch64 b/platform/huaweisecurec/src/Makefile.aarch64 -index 88d66d0..9fd5646 100644 ---- a/platform/huaweisecurec/src/Makefile.aarch64 -+++ b/platform/huaweisecurec/src/Makefile.aarch64 -@@ -17,7 +17,7 @@ $(PROJECT):$(OBJECTS) - @mkdir -p ../obj - mkdir -p ../lib - $(GCC) -shared -o ../lib/$@ $(patsubst %.o,../obj/%.o,$^) $(CFLAG) -- cp ../lib/libsecurec.so /usr/local/lib/libsecurec.so -+ #cp ../lib/libsecurec.so /usr/local/lib/libsecurec.so - echo "finish $(PROJECT)" - .c.o: - @mkdir -p ../obj