diff --git a/dependency/esdk_obs_api/Makefile b/dependency/esdk_obs_api/Makefile index 9c8a33b16cd4068e936d2c66a89b64f4ee499188..89975e4dcc06546cf7837141c2a5a082c4509524 100644 --- a/dependency/esdk_obs_api/Makefile +++ b/dependency/esdk_obs_api/Makefile @@ -3,7 +3,7 @@ ARCH = $(shell uname -m) top_builddir = ./../../../../../../ CXX = g++ -CXXFLAGS = -fPIC -fstack-protector-all -Wl,-z,relro,-z,now +CXXFLAGS = -fPIC -fstack-protector-all -std=c++11 -Wl,-z,relro,-z,now SHARED = -shared TARGET = libeSDKLogAPI.so LIBS = ../../../../../../output/kernel/platform/Huawei_Secure_C/comm/lib/libsecurec.a diff --git a/dependency/esdk_obs_api/build.sh b/dependency/esdk_obs_api/build.sh index af37b078a71f5c6d130a6d219a2599db18629fb5..81a043fcf4d9de51388cbf15af764926b49e970d 100644 --- a/dependency/esdk_obs_api/build.sh +++ b/dependency/esdk_obs_api/build.sh @@ -65,6 +65,8 @@ main() cd ${SRC_DIR} log "[Info] patching ......... " patch -p1 < ../obs.patch >> $LOG_FILE 2>&1 + patch -p1 < ../obs-add-openssl3-compat.patch >> $LOG_FILE 2>&1 + patch -p1 < ../obs-fix-gcc-build-error.patch >> $LOG_FILE 2>&1 if [[ "$ARCH"x = "loongarch64"x ]];then cp -rf ${TRUNK_DIR}/build-aux/* ./platform/eSDK_LogAPI_V2.1.10/log4cpp/config/ fi diff --git a/dependency/esdk_obs_api/obs-add-openssl3-compat.patch b/dependency/esdk_obs_api/obs-add-openssl3-compat.patch new file mode 100644 index 0000000000000000000000000000000000000000..11d9129cfd0c4dfcc7209b5c6e73fcb17acae375 --- /dev/null +++ b/dependency/esdk_obs_api/obs-add-openssl3-compat.patch @@ -0,0 +1,210 @@ +From 77a449bef2c867f26460ad35dba19fa81367989c Mon Sep 17 00:00:00 2001 +From: huangji +Date: Mon, 6 Jan 2025 07:27:36 +0000 +Subject: [PATCH] add openssl3 compat + +Signed-off-by: huangji +--- + .../eSDK_OBS_API/eSDK_OBS_API_C++/GNUmakefile | 2 +- + .../eSDK_OBS_API_C++/inc/openssl3_compat.h | 8 +++++++ + .../eSDK_OBS_API_C++/src/bucket.c | 21 +++++++++++++++---- + .../eSDK_OBS_API_C++/src/general.c | 7 +++++++ + .../eSDK_OBS_API_C++/src/object.c | 9 ++++++-- + .../eSDK_OBS_API_C++/src/openssl3_compat.c | 13 ++++++++++++ + .../eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c | 5 +++-- + 7 files changed, 56 insertions(+), 9 deletions(-) + create mode 100644 source/eSDK_OBS_API/eSDK_OBS_API_C++/inc/openssl3_compat.h + create mode 100644 source/eSDK_OBS_API/eSDK_OBS_API_C++/src/openssl3_compat.c + +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/GNUmakefile b/source/eSDK_OBS_API/eSDK_OBS_API_C++/GNUmakefile +index 884c95c..cd6d1b1 100644 +--- a/source/eSDK_OBS_API/eSDK_OBS_API_C++/GNUmakefile ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/GNUmakefile +@@ -267,7 +267,7 @@ LIBOBS_STATIC = $(BUILD)/lib/libeSDKOBS.a + .PHONY: libeSDKOBS + libeSDKOBS: $(LIBOBS_SHARED) $(LIBOBS_STATIC) + +-LIBOBS_SOURCES := bucket.c object.c request.c request_context.c \ ++LIBOBS_SOURCES := openssl3_compat.c bucket.c object.c request.c request_context.c \ + response_headers_handler.c simplexml.c util.c log.c \ + request_util.c general.c error_parser.c + +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/inc/openssl3_compat.h b/source/eSDK_OBS_API/eSDK_OBS_API_C++/inc/openssl3_compat.h +new file mode 100644 +index 0000000..61e6d45 +--- /dev/null ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/inc/openssl3_compat.h +@@ -0,0 +1,8 @@ ++#ifndef OPENSSL3_COMPAT_H ++#define OPENSSL3_COMPAT_H ++ ++#include ++ ++void MD5_OPENSSL3(const unsigned char *input, size_t length, unsigned char *output); ++ ++#endif /* OPENSSL3_COMPAT_H */ +\ No newline at end of file +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/bucket.c b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/bucket.c +index 219c308..38e29dd 100644 +--- a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/bucket.c ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/bucket.c +@@ -22,6 +22,9 @@ + #include "bucket.h" + #include "request_util.h" + #include ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++#include "openssl3_compat.h" ++#endif + + static int update_bucket_common_data_callback(int buffer_size, char *buffer, + void *callback_data) +@@ -2732,8 +2735,11 @@ void set_bucket_tagging(const obs_options *options, obs_name_value * tagging_lis + + memset_s(&properties, sizeof(obs_put_properties), 0, sizeof(obs_put_properties)); + properties.canned_acl = OBS_CANNED_ACL_PRIVATE; +- ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++ MD5_OPENSSL3((unsigned char*)tagging_data->xml_document, (size_t)tagging_data->xml_document_len, doc_md5); ++#else + MD5((unsigned char*)tagging_data->xml_document, (size_t)tagging_data->xml_document_len, doc_md5); ++#endif + base64Encode(doc_md5, sizeof(doc_md5), base64_md5); + properties.md5 = base64_md5; + +@@ -3188,7 +3194,11 @@ static set_lifecycle_data* init_set_lifecycle_data( obs_lifecycle_conf* bucket_l + } + COMMLOG(OBS_LOGERROR, "sblcData-doc: %s.", sblcData->doc); + sblcData->docBytesWritten = 0; +- MD5((unsigned char *)sblcData->doc, (size_t)sblcData->docLen, doc_md5); ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++ MD5_OPENSSL3((unsigned char *)sblcData->doc, (size_t)sblcData->docLen, doc_md5); ++#else ++ MD5((unsigned char *)sblcData->doc, (size_t)sblcData->docLen, doc_md5); ++#endif + base64Encode(doc_md5, sizeof(doc_md5), sblcData->doc_md5); + + return sblcData; +@@ -3705,8 +3715,11 @@ static set_cors_config_data* init_cors_data(obs_bucket_cors_conf *obs_cors_conf_ + return NULL; + } + COMMLOG(OBS_LOGERROR, "request xml: %s.", sbccData->doc); +- +- MD5((unsigned char *)sbccData->doc, (size_t)sbccData->doc_len, doc_md5); ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++ MD5_OPENSSL3((unsigned char *)sbccData->doc, (size_t)sbccData->doc_len, doc_md5); ++#else ++ MD5((unsigned char *)sbccData->doc, (size_t)sbccData->doc_len, doc_md5); ++#endif + base64Encode(doc_md5, sizeof(doc_md5), sbccData->doc_md5); + + return sbccData; +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/general.c b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/general.c +index ae06308..33d1a10 100644 +--- a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/general.c ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/general.c +@@ -22,6 +22,9 @@ + #include + #include + #include ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++#include "openssl3_compat.h" ++#endif + + #if defined __GNUC__ || defined LINUX + #include +@@ -376,7 +379,11 @@ void compute_md5(const char *buffer, int64_t buffer_size, char *outbuffer) + { + unsigned char buffer_md5[16] = {0}; + char base64_md5[64] = {0}; ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++ MD5_OPENSSL3((unsigned char*)buffer, (size_t)buffer_size, buffer_md5); ++#else + MD5((unsigned char*)buffer, (size_t)buffer_size, buffer_md5); ++#endif + base64Encode(buffer_md5, sizeof(buffer_md5), base64_md5); + strcpy(outbuffer,base64_md5); + } +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/object.c b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/object.c +index f5ecc96..0be4559 100644 +--- a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/object.c ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/object.c +@@ -19,10 +19,12 @@ + #include "securec.h" + #include "object.h" + #include +- + #include + #include + #include ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++#include "openssl3_compat.h" ++#endif + + #if defined __GNUC__ || defined LINUX + #include +@@ -817,8 +819,11 @@ void batch_delete_objects(const obs_options *options, obs_object_info *object_in + } + + COMMLOG(OBS_LOGDEBUG, "batch_delete_objects doc = %s!",doData->doc); +- ++#if OPENSSL_VERSION_NUMBER >= 0x30000000L ++ MD5_OPENSSL3((unsigned char*)doData->doc, (size_t)doData->docLen, doc_md5); ++#else + MD5((unsigned char*)doData->doc, (size_t)doData->docLen, doc_md5); ++#endif + base64Encode(doc_md5, sizeof(doc_md5), base64_md5); + properties.md5 = base64_md5; + +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/openssl3_compat.c b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/openssl3_compat.c +new file mode 100644 +index 0000000..3c7ae17 +--- /dev/null ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/openssl3_compat.c +@@ -0,0 +1,13 @@ ++#include "openssl3_compat.h" ++ ++void MD5_OPENSSL3(const unsigned char *input, size_t length, unsigned char *output) ++{ ++ EVP_MD_CTX *mdctx; ++ unsigned int md_len; ++ ++ mdctx = EVP_MD_CTX_new(); ++ EVP_DigestInit_ex(mdctx, EVP_md5(), NULL); ++ EVP_DigestUpdate(mdctx, input, length); ++ EVP_DigestFinal_ex(mdctx, output, &md_len); ++ EVP_MD_CTX_free(mdctx); ++} +\ No newline at end of file +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c +index bcb74c2..c3f7afd 100644 +--- a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c +@@ -500,7 +500,6 @@ char * base64Decode(const char *base64Char, const long base64CharSize, char *ori + #define R4D(i) R4(d, e, a, b, c, i) + #define R4E(i) R4(e, a, b, c, d, i) + +- + static void SHA1_transform(uint32_t state[5], const unsigned char buffer[64]) + { + uint32_t a, b, c, d, e; +@@ -686,7 +685,7 @@ void HMAC_SHA256(unsigned char hmac[32], const unsigned char *key, int key_len, + HMAC_Update(&ctx, message, message_len); + HMAC_Final(&ctx, temp, &tempLength); + HMAC_CTX_cleanup(&ctx); +-#else ++#elif OPENSSL_VERSION_NUMBER >= 0x10100000L && OPENSSL_VERSION_NUMBER < 0x30000000L + HMAC_CTX *ctx; + ctx = HMAC_CTX_new(); + if (NULL == ctx) +@@ -701,6 +700,8 @@ void HMAC_SHA256(unsigned char hmac[32], const unsigned char *key, int key_len, + HMAC_Update(ctx, message, message_len); + HMAC_Final(ctx, temp, &tempLength); + HMAC_CTX_free(ctx); ++#else ++ HMAC(engine, key, key_len, message, message_len, temp, &tempLength); + #endif + + memset_s(hmac, 32, 0, 32); +-- +2.33.0 + diff --git a/dependency/esdk_obs_api/obs-fix-gcc-build-error.patch b/dependency/esdk_obs_api/obs-fix-gcc-build-error.patch new file mode 100644 index 0000000000000000000000000000000000000000..1a1d54ef54b019b397323595246df0f0002cadf1 --- /dev/null +++ b/dependency/esdk_obs_api/obs-fix-gcc-build-error.patch @@ -0,0 +1,29 @@ +From 9a015d1969e766b9138e1211dd367e2e8b6b0c1f Mon Sep 17 00:00:00 2001 +From: huangji +Date: Sun, 19 Jan 2025 11:40:29 +0000 +Subject: [PATCH] fix gcc build error + +Signed-off-by: huangji +--- + source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c +index c3f7afd..cc0f6b0 100644 +--- a/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c ++++ b/source/eSDK_OBS_API/eSDK_OBS_API_C++/src/util.c +@@ -500,7 +500,11 @@ char * base64Decode(const char *base64Char, const long base64CharSize, char *ori + #define R4D(i) R4(d, e, a, b, c, i) + #define R4E(i) R4(e, a, b, c, d, i) + ++#if __GNUC__ < 12 + static void SHA1_transform(uint32_t state[5], const unsigned char buffer[64]) ++#else ++static void SHA1_transform(uint32_t state[5], const unsigned char *buffer) ++#endif + { + uint32_t a, b, c, d, e; + typedef union { +-- +2.41.0 +